/* Builders section.
   Inherits the club's look from the league stylesheet so the whole site stays
   one design, then adds the three-pane layout the force builder needs. */
@import url('/league/league.css');

main { width: min(1500px, 97vw); }

/* ---- builder chooser ---- */

.builder-card { cursor: pointer; transition: transform .1s, border-color .1s; }
.builder-card:hover { transform: translateY(-3px); border-top-color: var(--rust); }
.builder-card h3 { font-size: 21px; color: var(--bone); }
.builder-card .meta { color: var(--dust); font-size: 14px; margin-top: 6px; }
.builder-card .game { color: var(--rust); font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase; }

/* ---- three-pane force builder ---- */

.bt-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 360px;
  gap: 12px;
  align-items: start;
}

.bt-pane {
  background: var(--panel);
  border: 1px solid #2b221b;
  border-top: 3px solid var(--rust-dk);
  padding: 14px 16px;
  min-width: 0;              /* let the middle pane actually shrink in a grid */
}

.bt-pane h2 { margin: 0 0 10px; font-size: 16px; }

.bt-filters label { margin-bottom: 10px; }
.bt-filters .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bt-filters select, .bt-filters input { max-width: 100%; }

/* Vertical scrolling only. Anything that would widen the table past the pane
   is wrapped or truncated instead -- a horizontal scrollbar hides the add
   button, which is the one control that has to stay reachable. */
.bt-scroll { max-height: 64vh; overflow-y: auto; overflow-x: hidden; }

.bt-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.bt-table th {
  position: sticky; top: 0; background: var(--panel); z-index: 1;
  padding: 6px 6px; font-size: 11.5px;
}
.bt-table td { padding: 7px 6px; vertical-align: top; }

.bt-table .c-add  { width: 34px; padding-right: 0; }
.bt-table .c-pv   { width: 44px; }
.bt-table .c-mv   { width: 52px; }
.bt-table .c-dmg  { width: 62px; }
.bt-table .c-as   { width: 50px; }
.bt-table .c-name { width: auto; }

/* Name cell stacks: name, then a muted line of type/role/tonnage, then
   abilities. Long values wrap rather than widening the table. */
.c-name { white-space: normal; word-break: break-word; }
.c-name .uname { display: block; line-height: 1.2; }
.c-name .usub {
  display: block; color: var(--dust); font-size: 12.5px; line-height: 1.3;
  text-transform: uppercase; letter-spacing: .04em;
}
.c-name .uabil {
  display: block; color: #8a7f6f; font-size: 12.5px; line-height: 1.3; margin-top: 2px;
}

.c-mv, .c-dmg, .c-as, .c-pv { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv { color: var(--rust); font-family: 'Black Ops One'; font-size: 14px; }

.addbtn {
  cursor: pointer; background: transparent; color: var(--dust);
  border: 1px solid #3a2f26; padding: 2px 7px; font-family: 'Black Ops One'; font-size: 14px;
  line-height: 1.1;
}
.addbtn:hover { background: var(--ok); border-color: var(--ok); color: #0c0a08; }

/* ---- force pane ---- */

.force-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.force-table th { padding: 6px 6px; font-size: 11.5px; }
.force-table td { padding: 6px 6px; vertical-align: middle; }
.force-table .f-name { width: auto; white-space: normal; word-break: break-word; line-height: 1.25; }
.force-table .f-skill { width: 60px; }
.force-table .f-pv { width: 46px; }
.force-table .f-rm { width: 32px; }

.rmbtn {
  cursor: pointer; background: transparent; color: var(--dust);
  border: 1px solid transparent; padding: 1px 6px; font-size: 14px;
}
.rmbtn:hover { background: var(--blood); border-color: var(--blood); color: #fff; }

.skillsel { padding: 2px 4px; font-size: 14px; width: 100%; }

.force-total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 2px solid #2b221b; margin-top: 10px; padding-top: 10px;
}
.force-total b { font-family: 'Black Ops One'; color: var(--rust); font-size: 22px; }

.force-bar { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; margin-bottom: 10px; }
.force-bar input { min-width: 0; }
.force-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.force-actions .btn { flex: 1; text-align: center; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--rust); color: var(--bone);
  padding: 9px 18px; box-shadow: 4px 4px 0 #000; z-index: 50;
}

.warn {
  background: #3a1a10; border: 1px solid var(--blood); color: #ffb59b;
  padding: 10px 14px; margin-bottom: 14px; font-size: 15px;
}

/* Below three-pane width the panes stack, and the tables get the full width. */
@media (max-width: 1200px) {
  .bt-layout { grid-template-columns: 1fr; }
  .bt-scroll { max-height: none; }
}

/* ---- unit detail modal ---- */

.c-name .uname { cursor: pointer; }
.c-name .uname:hover { color: var(--rust); text-decoration: underline; }

.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 2vw; z-index: 100; overflow: auto;
}
.modal {
  position: relative; background: var(--panel); border: 1px solid #2b221b;
  border-top: 3px solid var(--rust); box-shadow: 6px 6px 0 #000;
  padding: 20px 24px; width: min(980px, 96vw);
}
.modal h2 { margin: 0 0 2px; font-size: 22px; }
.modal h3 { font-size: 15px; color: var(--rust); margin: 16px 0 8px; }
.modal-x {
  position: absolute; top: 10px; right: 12px; background: transparent;
  border: 1px solid #3a2f26; color: var(--dust); cursor: pointer; padding: 2px 8px;
}
.modal-x:hover { background: var(--blood); border-color: var(--blood); color: #fff; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }

.unit-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
.unit-card img { width: 100%; height: auto; border: 1px solid #2b221b; background: #fff; }
.unit-card .btn { margin-top: 8px; display: inline-block; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px 12px; }
.st { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #2b221b; padding: 3px 0; }
.st span { color: var(--dust); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.st b { font-family: 'Black Ops One'; font-size: 14px; }

.abilities { margin-top: 12px; font-size: 15px; line-height: 1.4; }
.abilities span { color: var(--dust); text-transform: uppercase; font-size: 12.5px; letter-spacing: .08em; }

.era { border-bottom: 1px dashed #2b221b; padding: 5px 0; }
.era summary { cursor: pointer; color: var(--bone); }
.era summary:hover { color: var(--rust); }
.factions { color: var(--dust); font-size: 14px; padding: 6px 0 4px 14px; line-height: 1.5; }

@media (max-width: 760px) { .unit-body { grid-template-columns: 1fr; } }

/* ---- printable play sheet ---- */

#printsheet { display: none; }

@media print {
  /* Print the sheet, nothing else — no nav, no filters, no app chrome. */
  body > *:not(#printsheet) { display: none !important; }

  #printsheet {
    display: block; color: #000; background: #fff;
    font-family: 'Barlow Condensed', Arial, sans-serif;
  }
  #printsheet h1 { font-size: 20pt; margin: 0 0 2mm; color: #000; text-shadow: none; }
  #printsheet .p-meta { font-size: 10pt; margin-bottom: 4mm; color: #333; }
  #printsheet table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  #printsheet th {
    text-align: left; border-bottom: 1.5pt solid #000; padding: 1.5mm 1mm;
    color: #000; font-size: 8pt; text-transform: uppercase; background: none;
  }
  #printsheet td { border-bottom: 0.4pt solid #999; padding: 1.5mm 1mm; vertical-align: top; }
  #printsheet .num { text-align: right; }
  #printsheet .p-name { font-weight: 700; }
  #printsheet .p-abil { font-size: 7.5pt; }
  /* Blank box for marking damage during play. */
  #printsheet .p-track { width: 34mm; border-bottom: 0.4pt solid #999; }
  #printsheet tbody tr { page-break-inside: avoid; }
  #printsheet .p-foot { margin-top: 4mm; font-size: 7.5pt; color: #666; }

  @page { margin: 10mm; size: landscape; }
}

/* ---- Alpha Strike / Total Warfare switch ---- */
.modeswitch { display: flex; gap: 8px; margin: -8px 0 16px; }
.modeswitch .btn { padding: 5px 16px; }
