* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f3f3;
  color: #222;
}
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 28px 120px;
}
.section h1 {
  margin: 0 0 22px;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
}
.divider {
  border: 0;
  border-top: 1px solid #e3e3e3;
  margin: 46px 0 36px;
}
.products-table-wrap { width: 100%; overflow-x: auto; }
.products-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: transparent;
}
.products-table th,
.products-table td {
  border: 1px solid #e0e0e0;
  background: #f5f5f5;
  padding: 18px 20px;
  font-size: 18px;
}
.products-table th {
  font-weight: 700;
  white-space: nowrap;
}
.products-table td {
  background: transparent;
  text-align: center;
}
.actions-col,
.actions-col-cell {
  width: 210px;
  text-align: left !important;
}
.link-action,
.row-link {
  color: #0d7cff;
  text-decoration: none;
  font-weight: 400;
}
.row-link + .row-link { margin-left: 18px; }
.sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.sort-btn.active .sort-indicator {
  color: #0d7cff;
}
.sort-indicator {
  display: inline-block;
  min-width: 18px;
  color: #0d7cff;
}
.check-cell { text-align: center; }
.fake-check {
  width: 34px;
  height: 34px;
  display: inline-block;
  border: 2px solid #8e8e8e;
  border-radius: 4px;
  background: white;
  position: relative;
}
.fake-check.checked {
  background: #0d7cff;
  border-color: #0d7cff;
}
.fake-check.checked::after {
  content: '✓';
  position: absolute;
  left: 8px;
  top: 1px;
  color: white;
  font-size: 28px;
  line-height: 1;
}
.fields-area {
  max-width: 940px;
  padding: 8px 22px 0;
}
.field-label {
  display: block;
  font-size: 18px;
  margin: 16px 0 6px;
  color: #444;
}
.number-input {
  width: 100%;
  height: 42px;
  border: 1px solid #cfcfcf;
  border-radius: 3px;
  background: white;
  padding: 8px 12px;
  font-size: 18px;
}
.number-input.disabled {
  background: #f4f4f4;
  color: #c0c0c0;
}
.generate-btn {
  width: 100%;
  margin-top: 2px;
  height: 42px;
  border: 1px solid #9c9c9c;
  border-radius: 4px;
  background: #e0e0e0;
  font-size: 18px;
  color: #444;
  cursor: pointer;
}
.generate-btn:hover,
.generate-btn:focus {
  background: linear-gradient(#2496ea, #0c7ad6);
  color: white;
  border-color: #0c75cb;
}
.action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 2px;
}
.action-row .generate-btn {
  margin-top: 0;
  flex: 1 1 auto;
}
.reset-btn {
  height: 42px;
  min-width: 160px;
  border: 1px solid #bcbcbc;
  border-radius: 4px;
  background: white;
  font-size: 18px;
  color: #444;
  cursor: pointer;
}
.reset-btn:hover,
.reset-btn:focus {
  background: #f1f1f1;
}
.roll-row {
  margin-top: 34px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.roll-row label {
  font-size: 18px;
  color: #444;
}
.roll-checkbox {
  width: 36px;
  height: 36px;
  accent-color: #0d7cff;
}
.results-divider { margin-top: 22px; }
.results {
  text-align: center;
  min-height: 160px;
}
.results.empty .stats p { color: #888; }
.stats p {
  margin: 0 0 28px;
  font-size: 18px;
}
.layouts {
  margin-top: 22px;
}
.layouts.single-layout {
  display: flex;
  justify-content: center;
}
.layouts.multi-layout {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  row-gap: 34px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.layout-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.layout-card.large {
  max-width: 760px;
}
.layout-card.thumb {
  min-width: 90px;
  min-height: 90px;
}
.panel-box {
  position: relative;
  border: 2px solid #5f5f5f;
  background: transparent;
  overflow: hidden;
}
.piece-footprint {
  position: absolute;
  background: transparent;
}
.piece-box {
  position: absolute;
  border: 1.5px solid #9d9d9d;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.piece-label {
  font-size: 12px;
  line-height: 1.1;
  color: #4d4d4d;
  white-space: pre-line;
  text-align: center;
}
.error-text {
  color: #b00020;
  font-size: 18px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-backdrop.hidden { display: none; }
.modal {
  width: min(460px, 100%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  padding: 22px;
}
.modal h2 {
  margin: 0 0 18px;
  font-size: 28px;
}
.modal-form label {
  display: block;
  font-size: 16px;
  margin-bottom: 14px;
}
.modal-form input[type="number"] {
  width: 100%;
  margin-top: 6px;
  height: 40px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 16px;
}
.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 10px;
}
.checkbox-line input {
  width: 20px;
  height: 20px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.primary-btn,
.secondary-btn {
  height: 40px;
  border-radius: 4px;
  padding: 0 16px;
  border: 1px solid #c8c8c8;
  background: white;
  font-size: 16px;
  cursor: pointer;
}
.primary-btn {
  background: #0d7cff;
  border-color: #0d7cff;
  color: white;
}
@media (max-width: 900px) {
  .page { padding: 38px 16px 80px; }
  .section h1 { font-size: 34px; }
  .products-table th,
  .products-table td { padding: 14px 12px; font-size: 16px; }
  .actions-col,
  .actions-col-cell { width: 175px; }
  .fields-area { padding-left: 4px; padding-right: 4px; }
  .action-row { flex-direction: column; align-items: stretch; }
  .reset-btn { width: 100%; min-width: 0; }
}
