/* The box lid: rules that belong to the create screen and the card editor only.
   Loaded after style.css, so anything here wins a tie with the shared sheet. */

/* ---------------------------------------------------------------- seats
   Token · name · human-or-bot · remove, on one line. The bot levels must never be clipped: on a phone the
   whole strip drops to its own full-width row rather than shrinking "Hard" off the edge. */

.seat { grid-template-columns: 58px minmax(0, 1fr) auto 40px; row-gap: 6px; }
.seat-name { grid-column: 2; }
.seat-kind button { justify-content: center; }
.seat-kind .ic { width: 13px; height: 13px; flex: none; }
.seat .discord { grid-column: 2 / -1; min-height: 38px; font-size: 0.86rem; }
.seat .token-strip { grid-column: 1 / -1; }

.token-strip button.taken { opacity: 0.5; }
.token-strip button.taken:hover { opacity: 1; }

.seat.bad { box-shadow: 0 0 0 2px var(--bad); }
.seat.bad .seat-name { border-color: var(--bad); }
.seat-why { grid-column: 2 / -1; display: flex; align-items: center; gap: 5px; font-size: 0.8rem; font-style: italic; color: var(--bad); }
.seat-why .ic { width: 13px; height: 13px; flex: none; }

/* ---------------------------------------------------------------- open seats, joining with a code, a table that waits */

.open-coin { display: grid; place-items: center; font: 800 1.3rem var(--font); color: var(--ink-3); }
span.seat-token.open-coin { border-style: dashed; background: transparent; }
.seat.is-open { background: rgba(246, 239, 220, 0.55); border-style: dashed; border-left: 8px solid rgba(27, 20, 12, 0.14); }
.seat-open { grid-column: 2; display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.seat-open b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-open small { font-size: 0.78rem; color: var(--ink-3); }
.sum-seats li.open .open-coin { width: 34px; height: 34px; border: 1.5px dashed var(--ink-3); border-radius: 50%; font-size: 1rem; }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-switch a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid rgba(246, 239, 220, 0.25); border-radius: 12px; background: rgba(246, 239, 220, 0.08); color: var(--card); text-decoration: none; }
.mode-switch a:hover { background: rgba(246, 239, 220, 0.16); }
.mode-switch a .ic { width: 22px; height: 22px; flex: none; }
.mode-switch span { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.mode-switch b { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.9rem; }
.mode-switch small { font-size: 0.76rem; opacity: 0.75; }
.mode-switch a[aria-current='page'] { background: var(--card); border-color: var(--ink); color: var(--ink); box-shadow: var(--shadow); }

.code-row { display: flex; gap: 10px; align-items: stretch; }
.code-input { flex: 1; min-width: 0; font: 800 1.6rem var(--font); letter-spacing: 0.3em; text-transform: uppercase; text-align: center; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); }
.code-input::placeholder { color: var(--ink-3); opacity: 0.45; }
.join-seat .token-strip { padding-top: 6px; }

.table-code { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 12px; border: 2px dashed var(--ink); border-radius: 14px; background: #fff; text-align: center; }
.table-code small { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.table-code b { font-size: clamp(2.2rem, 8vw, 3.2rem); font-weight: 800; letter-spacing: 0.22em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.table-code .btns { justify-content: center; }
.wait-seats .seat { grid-template-columns: 58px minmax(0, 1fr) auto 40px; }
.wait-seats .seat-token { cursor: default; }
.wait-seats .seat-rm { grid-column: 4; }
.wait-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.wait-acts .ic { width: 14px; height: 14px; }

@media (max-width: 899px) {
  .mode-switch a { padding: 10px; gap: 8px; }
  .wait-seats .seat { grid-template-columns: 52px minmax(0, 1fr) 40px; }
  .wait-acts { grid-column: 1 / -1; justify-content: stretch; }
  .wait-acts .btn { flex: 1; }
  .code-row { flex-direction: column; }
}

/* ---------------------------------------------------------------- the rest of the form */

.rematch { display: flex; align-items: center; gap: 9px; background: var(--paper); border: 1.5px dashed var(--ink); border-radius: 10px; padding: 9px 12px; font-size: 0.9rem; }
.rematch .ic { width: 20px; height: 20px; flex: none; }

.field.num.off { opacity: 0.5; }
.field.num.off .moneyfield { background: var(--card-2); }

.formerr { display: flex; align-items: center; gap: 8px; background: #fdecec; border: 2px solid var(--bad); border-radius: 10px; padding: 10px 12px; color: var(--bad); font-weight: 600; }
.formerr .ic { width: 20px; height: 20px; flex: none; }

/* ---------------------------------------------------------------- card editor */

.sheet-packs .btns.sticky { background: var(--card); box-shadow: 0 -14px 16px -10px var(--card), 0 -1px 0 var(--line); }
.sheet-packs .seg { flex-wrap: wrap; }
.sheet-packs .seg button { flex-direction: column; align-items: flex-start; gap: 0; padding-block: 0.25em; }
.sheet-packs .seg button small { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; opacity: 0.7; text-transform: none; }

.varbox { position: relative; flex: 1; min-width: 0; }
.varbox textarea { padding-bottom: 18px; }
.count { position: absolute; right: 8px; bottom: 4px; font-size: 0.66rem; font-variant-numeric: tabular-nums; color: var(--ink-3); pointer-events: none; }
.cardrow [data-reset][hidden] { display: none; }
.cardrow .live { position: sticky; top: 0; }

@media (max-width: 899px) {
  .seat { grid-template-columns: 52px minmax(0, 1fr) 40px; }
  .seat-token { grid-area: 1 / 1; }
  .seat-name { grid-area: 1 / 2; }
  .seat-rm { grid-area: 1 / 3; }
  .seat-kind { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* Beats .seg.small button (32px): a seat's human/bot choice is a thumb target like any other. */
  .seg.small.seat-kind button { min-height: 42px; }
  .seat-rm { width: 40px; height: 40px; }
  .seat-why, .seat .discord { grid-column: 1 / -1; }
  .cardrow .live { position: static; max-width: 300px; }
  .sheet-packs .seg { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---------------------------------------------------------------- the two ways in (round 8) */

.starts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.start { position: relative; display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
a.start, .start-go { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 16px 16px 16px 18px; min-height: 96px; text-align: left; width: 100%; color: inherit; font: inherit; cursor: pointer; }
.start-go { border: 0; background: transparent; border-radius: 12px; }
.start-ic { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); color: #fff; box-shadow: 0 3px 0 var(--ink); }
.start.learn .start-ic { background: var(--felt); }
.start-ic .ic { width: 26px; height: 26px; }
.start-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.start-t b { font-size: 1.12rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.start-t small { font-size: 0.88rem; color: var(--ink-2); line-height: 1.3; }
.start > .ic, .start-go > .ic { flex: none; width: 20px; height: 20px; color: var(--ink-3); }
.start:hover, .start.learn:has(.start-go:hover) { background: #fbf4e0; }
.start:hover > .ic, .start-go:hover > .ic { color: var(--ink); }
.start-go:disabled { cursor: progress; opacity: 0.7; }
.learn-code { padding: 0 16px 14px 84px; }

/* ---------------------------------------------------------------- the setup, step by step (round 8) */

.setup-page { gap: 16px; }
.setup-top { display: flex; align-items: center; gap: 12px; }
.setup-top h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--card); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.setup-top .btn.ghost { color: var(--card); }
.setup-top .btn.ghost:hover { background: rgba(255, 255, 255, 0.1); }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; list-style: none; margin: 0; padding: 0; }
.steps button { width: 100%; height: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: rgba(246, 239, 220, 0.08); border: 2px solid rgba(246, 239, 220, 0.25); border-radius: 12px; color: var(--card); text-align: left; font: inherit; cursor: pointer; }
.steps button:hover { background: rgba(246, 239, 220, 0.16); }
.steps i { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid currentColor; font-style: normal; font-weight: 800; font-size: 0.9rem; }
.steps i .ic { width: 16px; height: 16px; }
.steps span { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.steps b { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.86rem; }
.steps small { font-size: 0.72rem; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps button[aria-current='step'] { background: var(--card); border-color: var(--ink); color: var(--ink); box-shadow: var(--shadow); }
.steps button[aria-current='step'] i { background: var(--red); border-color: var(--ink); color: #fff; }
.steps button.past i { background: var(--felt); border-color: var(--card); }

.guide { font: italic 1rem/1.45 var(--serif); color: var(--ink-2); margin-top: -8px; }
.setup-sub { display: flex; align-items: baseline; gap: 8px; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; margin: 4px 0 8px; }
.setup-sub small { font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--ink-3); }

.seat.is-you { border-left-width: 8px; background: #fffaf0; box-shadow: 0 0 0 2px var(--gold); }
.you-tag { justify-self: start; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; background: var(--ink); color: var(--card); border-radius: 99px; padding: 3px 10px; }

.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; text-align: left; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 0 2px 0 var(--ink); color: var(--ink); font: inherit; cursor: pointer; }
.pick b { font-weight: 800; font-size: 0.95rem; }
.pick small { font-size: 0.76rem; color: var(--ink-3); line-height: 1.25; }
.pick:hover { background: #fff; }
.pick.on { background: var(--ink); color: var(--card); }
.pick.on small { color: rgba(246, 239, 220, 0.75); }

.rule-group + .rule-group { border-top: 1px dashed var(--line); padding-top: 10px; }
.discord-ids { display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 8px 0 0; padding: 0; }
.discord-ids li { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr); gap: 10px; align-items: center; }
.discord-ids b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.discord-ids input { border: 2px solid var(--ink); border-radius: 9px; background: #fff; padding: 0 12px; min-height: 40px; width: 100%; min-width: 0; font-size: 0.9rem; }

.summary { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 12px; padding: 10px 14px 12px; }
.summary header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.summary .setup-sub { margin: 0; }
.sum-seats { display: flex; flex-wrap: wrap; gap: 8px 16px; list-style: none; margin: 8px 0 0; padding: 0; }
.sum-seats li { display: flex; align-items: center; gap: 7px; }
.sum-seats svg { height: 34px; width: auto; flex: none; }
.sum-seats b { font-weight: 700; }
.sum-seats small { font-size: 0.72rem; color: var(--ink-3); }
.sum-rules { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 8px 0 0; padding: 0; }
.sum-rules li { font-size: 0.84rem; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 3px 11px; }

.setup-nav { display: flex; gap: 10px; align-items: center; justify-content: flex-end; border-top: 1.5px dashed var(--line); padding-top: 14px; }
.setup-nav > .btn:first-child:not(:last-child) { margin-right: auto; }
.setup-nav .btn.primary:not(.big) { min-width: 11em; }
.setup-nav .btn .ic { width: 18px; height: 18px; }

@media (max-width: 899px) {
  .starts { grid-template-columns: 1fr; }
  .learn-code { padding-left: 16px; }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .steps button { flex-direction: column; justify-content: center; gap: 4px; padding: 7px 4px; text-align: center; }
  .steps small { display: none; }
  .steps b { font-size: 0.7rem; letter-spacing: 0.04em; }
  .picks { grid-template-columns: 1fr; }
  .seat.is-you { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .seat.is-you .you-tag { grid-area: 1 / 3; }
  .discord-ids li { grid-template-columns: 1fr; gap: 4px; }
}
