/* JustChat Solitaire — the Porch styling (§11).
 * Phase 2 art pass: photographic table plates (Porch up front, felt and
 * Midnight lazy), code-set pips, indices and plain court middles over a
 * shared paper texture, the teal lantern back, and wooden-token
 * buttons. Themes change the table only (§11.4). (The Phase 2 portrait
 * courts were retired 2026-11-19 by Robert's plain-courts ruling.) */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  color: #f3e7d3;
  background: #241a12;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body[data-theme="porch"]   { --table1:#5a3d22; --table2:#3a2614; --table-edge:#241708; --felt-line:rgba(255,220,160,.07); }
body[data-theme="felt"]    { --table1:#2e6b3e; --table2:#1d4729; --table-edge:#122b19; --felt-line:rgba(255,255,255,.05); }
body[data-theme="midnight"]{ --table1:#2b3350; --table2:#171c2e; --table-edge:#0d1020; --felt-line:rgba(160,190,255,.06); }

.hidden { display: none !important; }
.screen { min-height: 100dvh; padding: 18px 16px 28px; max-width: 880px; margin: 0 auto; }
button { font-family: inherit; cursor: pointer; }

/* ---------- lobby ---------- */
.lobby-head { text-align: center; padding: 26px 0 8px; }
.lockup { font-size: 2.5rem; font-weight: normal; letter-spacing: .02em; color: #f7ead2;
  text-shadow: 0 2px 14px rgba(255,180,80,.35), 0 1px 2px rgba(0,0,0,.6); }
.lockup span { color: #ffc978; }
.promise { margin-top: 8px; font-style: italic; color: #e8d5b5; opacity: .92; }
.doors { display: grid; gap: 14px; margin-top: 26px; }
@media (min-width: 640px) { .doors { grid-template-columns: repeat(3, 1fr); } }
.door { background: linear-gradient(160deg, var(--table1), var(--table2)); border: 1px solid rgba(255,215,150,.25);
  border-radius: 14px; padding: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.door h2 { font-size: 1.45rem; font-weight: normal; color: #ffe9c4; }
.door p { margin: 8px 0 14px; color: #efdfc2; min-height: 2.4em; }
.door.soon { opacity: .62; }
.soon-tag { display: inline-block; border: 1px dashed rgba(255,220,160,.5); border-radius: 999px;
  padding: 6px 12px; font-size: .85rem; color: #ffe1a8; }
.daily-row { margin-top: 26px; background: rgba(0,0,0,.22); border: 1px solid rgba(255,215,150,.18);
  border-radius: 14px; padding: 16px 18px; }
.daily-row h3 { font-weight: normal; color: #ffe9c4; margin-bottom: 10px; }
.daily-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.daily-card strong { display: block; }
.daily-state { color: #d9c49c; font-size: .92rem; }
.daily-streak { margin-top: 10px; color: #ffc978; }
.record-strip { margin-top: 18px; color: #e8d5b5; text-align: center; font-size: .98rem; }
.lobby-foot { margin-top: 22px; text-align: center; }

/* ---------- buttons & tokens ---------- */
.btn { background: #efe0c3; color: #33240f; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 1rem; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.btn.primary { background: linear-gradient(180deg, #ffcf87, #eda93f); color: #2e1d05; font-weight: bold; }
.btn.ghost { background: transparent; color: #ffe1a8; border: 1px solid rgba(255,215,150,.45); box-shadow: none; }
.btn.big { width: 100%; padding: 15px; font-size: 1.15rem; margin-top: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.token { background-image: url('assets/token-wood.webp'); background-size: cover; background-position: center;
  background-color: #c39a58; color: #3a2410; font-weight: bold; border: 2px solid #6b4a26; border-radius: 999px;
  padding: 9px 16px; font-size: .98rem; text-shadow: 0 1px 0 rgba(255,240,200,.45);
  box-shadow: inset 0 0 0 2px rgba(96,64,28,.35), inset 0 2px 3px rgba(255,238,196,.55), 0 3px 7px rgba(0,0,0,.45); }
.token .glyph { margin-right: 7px; }
.token .glyph svg { vertical-align: -2px; }
.token.small { padding: 5px 11px; font-size: .9rem; }
.token:active { transform: translateY(1px); }

/* ---------- setup ---------- */
.sub-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.sub-head h2 { font-weight: normal; color: #ffe9c4; font-size: 1.35rem; }
.setup-block { margin: 20px 0; }
.setup-block h3 { font-weight: normal; color: #ffc978; margin-bottom: 10px; }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { flex: 1 1 100px; background: rgba(0,0,0,.25); color: #efdfc2; border: 1px solid rgba(255,215,150,.3);
  border-radius: 10px; padding: 10px 8px; font-size: 1rem; }
.seg span { display: block; font-size: .8rem; opacity: .8; margin-top: 2px; }
.seg.on { background: linear-gradient(180deg, #ffcf87, #eda93f); color: #2e1d05; font-weight: bold; }
.deal-opt { display: flex; gap: 10px; align-items: flex-start; background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,215,150,.2); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.deal-opt.disabled { opacity: .5; cursor: default; }
.deal-note { color: #ffc978; font-size: .95rem; min-height: 1.2em; }
.variant-records { color: #e8d5b5; }

/* ---------- game ---------- */
#screen-game { display: flex; flex-direction: column; height: 100dvh; padding: 10px 8px 12px; max-width: 1100px; }
.game-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.game-label { color: #ffe9c4; font-size: 1.02rem; }
.game-counters { color: #d9c49c; font-size: .9rem; margin-left: auto; }
.toprow { display: flex; justify-content: space-between; align-items: center; margin: 8px 2px 4px; min-height: 44px; }
.runs-rail { display: flex; gap: 5px; }
.run-slot { width: 30px; height: 42px; border: 1.5px dashed rgba(255,225,170,.4); border-radius: 5px;
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: rgba(255,225,170,.55); }
.run-slot.filled { border-style: solid; border-color: #0e4d4a;
  background: url('assets/card-back.webp') center / cover no-repeat; color: #ffe9c4; }
.stock-wrap { display: flex; align-items: center; gap: 8px; }
.stock-pile { width: 46px; height: 62px; border-radius: 6px; cursor: pointer; position: relative;
  background: url('assets/card-back.webp') center / cover no-repeat;
  border: 1.5px solid rgba(233,223,201,.85); box-shadow: 2px 3px 6px rgba(0,0,0,.5); }
.stock-pile.empty { background: rgba(0,0,0,.25); border: 1.5px dashed rgba(255,225,170,.4); box-shadow: none; cursor: default; }
.stock-pile.blocked { animation: shake .3s; }
.stock-count { color: #d9c49c; font-size: .88rem; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

#board { position: relative; flex: 1 1 auto; margin-top: 4px; border-radius: 12px;
  /* the photographic plate is the top layer (--plate-img is set by the
   * app: Porch up front, the others only when chosen, §11.2); the
   * gradient table remains underneath as the no-plate fallback */
  background-image:
    var(--plate-img, none),
    repeating-linear-gradient(0deg, var(--felt-line) 0 2px, transparent 2px 90px),
    linear-gradient(165deg, var(--table1), var(--table2) 70%, var(--table-edge));
  background-size: cover, auto, auto;
  background-position: center, 0 0, 0 0;
  background-repeat: no-repeat, repeat, repeat;
  box-shadow: inset 0 0 60px rgba(0,0,0,.45); touch-action: none; overflow-x: hidden; overflow-y: auto; }
.col-slot { position: absolute; border: 1.5px dashed rgba(255,225,170,.28); border-radius: 7px; }
.col-slot.glow { border-color: #ffd98c; box-shadow: 0 0 0 2px rgba(255,200,110,.5), 0 0 18px rgba(255,190,90,.45); }
.card { position: absolute; border-radius: 7px; user-select: none; -webkit-user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 5px 10px rgba(0,0,0,.35); transition: box-shadow .12s; }
/* lamplight: a soft sheen from the upper left and a shaded lower edge,
 * so a card sits IN the plate's light instead of floating on it (§11) */
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(155deg, rgba(255,240,200,.20), rgba(255,240,200,0) 42%, rgba(60,30,0,.12)); }
.card.up { background-color: #f7efdb; background-image: url('assets/paper.webp'); background-size: cover;
  color: #232323; border: 1px solid #c9b98f; }
.card.up.red { color: #A52A21; }
.card.down { background: url('assets/card-back.webp') center / cover no-repeat; border: 1px solid rgba(20,30,30,.55); }
.card .idx { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 0.92; font-weight: bold; }
.card .idx.tl { top: 1px; left: 3px; }
.card .idx.br { bottom: 1px; right: 3px; transform: rotate(180deg); }
.card .pips { position: absolute; inset: 0; }
.card .pp { position: absolute; transform: translate(-50%, -50%); line-height: 1; }
.card .pp.inv { transform: translate(-50%, -50%) rotate(180deg); }
/* plain courts (Robert's ruling, 2026-11-19): no portrait panel —
 * a large centred rank letter with its suit glyph beneath, centred in
 * a middle zone that starts clear of the corner-index column */
.card .court-plain { position: absolute; left: 30%; top: 20%; width: 40%; height: 60%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.card .court-plain .cp-rank { font-weight: bold; }
.card .court-plain .cp-suit { line-height: 1; }
.card.sel { box-shadow: 0 0 0 2.5px #ffcf6e, 0 8px 16px rgba(0,0,0,.55); z-index: 40 !important; }
.card.hintsrc { box-shadow: 0 0 0 2.5px #8fd0ff, 0 6px 14px rgba(0,0,0,.5); }
.drag-unit { position: fixed; z-index: 200; pointer-events: none; filter: drop-shadow(0 14px 14px rgba(0,0,0,.5)); }
.drag-unit .card { transition: none; }

/* Phase 3: Klondike/FreeCell piles live on the board's top row —
 * empty cells, empty foundations and the spent stock are slotted
 * outlines in the same dashed language as the column slots. */
.pile-slot { position: absolute; border: 1.5px dashed rgba(255,225,170,.28); border-radius: 7px;
  display: flex; align-items: center; justify-content: center; color: rgba(255,225,170,.45); font-size: 20px; }
.pile-slot.glow { border-color: #ffd98c; box-shadow: 0 0 0 2px rgba(255,200,110,.5), 0 0 18px rgba(255,190,90,.45); }
.card.hintdest { box-shadow: 0 0 0 2.5px #8fd0ff, 0 6px 14px rgba(0,0,0,.5); }
.pile-count { position: absolute; right: 2px; bottom: 1px; z-index: 5; pointer-events: none;
  background: rgba(20,12,4,.75); color: #ffe9c4; border-radius: 6px; padding: 0 4px;
  font-size: 10px; line-height: 1.5; }
.daily-card + .daily-card { margin-top: 10px; }
.deal-note-static { color: #e8d5b5; line-height: 1.45; background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,215,150,.2); border-radius: 10px; padding: 12px 14px; }
.number-row { display: flex; gap: 10px; flex-wrap: wrap; }
.number-row input { flex: 1 1 150px; background: rgba(0,0,0,.3); color: #f3e7d3; font-family: inherit;
  border: 1px solid rgba(255,215,150,.35); border-radius: 10px; padding: 10px 12px; font-size: 1rem; }
.howto-tabs { margin-bottom: 14px; }

.status-line { min-height: 1.5em; text-align: center; color: #ffe9c4; padding: 8px 6px 2px; font-size: 1rem; }
.token-row { display: flex; justify-content: center; gap: 12px; padding-top: 8px; flex-wrap: wrap; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12,7,3,.72); display: flex;
  align-items: center; justify-content: center; z-index: 300; padding: 18px; }
.sheet { background: linear-gradient(165deg, var(--table1), var(--table2)); border: 1px solid rgba(255,215,150,.35);
  border-radius: 16px; padding: 24px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 11px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6); max-height: 92dvh; overflow-y: auto; }
.sheet.wide { max-width: 560px; }
.sheet h2 { font-weight: normal; color: #ffe9c4; text-align: center; }
.sheet h3 { font-weight: normal; color: #ffc978; margin-top: 10px; }
.howto-body p { margin-bottom: 10px; line-height: 1.45; color: #f3e7d3; }
.end-stats { text-align: center; color: #ffe9c4; }
#end-line { text-align: center; color: #e8d5b5; line-height: 1.45; }
