/* The existing game, framed as an experience inside Jessica's portfolio. */
:root {
  --paper: #f7f8f6;
  --ink: #123448;
  --green: #08293d;
  --muted: #5b717b;
  --line: #d7e1e1;
  --accent: #236874;
  --sans: 'DM Sans', 'Segoe UI', Arial, sans-serif;
}
html { scroll-behavior: auto; }
body { background: var(--paper); }
/* Button labels use editorial Title Case in app.js and index.html. */
main { max-width: none; margin: 0; }
.game-shell { box-shadow: none; border-radius: 0; }
.table-panel { background-color: #edf3ef; }
.guide-panel { color: #f4fbfc; }
.stage-copy { color: #d0e0e3; font-size: 15px; }
.stage-kicker, .reassurance, .guide-bottom p { color: #b9d8d8; }
.primary-button { background: #c4e5de; border-color: #c4e5de; color: var(--green); font-size: 14px; }
.secondary-button { color: #f4fbfc; border-color: #789ea8; font-size: 13px; }
.hand-choice { font-size: 14px; }
.hands.is-opening { display: block; min-height: 0; }
.opening-hand h3 { font-size: 12px; letter-spacing: .5px; color: var(--muted); font-weight: 500; text-align: center; margin: 6px 0 10px; }
.opening-fan { --card-width: 78px; --card-height: 116px; list-style: none; position: relative; height: 225px; padding: 0; margin: 0 12px; }
.opening-card { position: absolute; top: calc(25px + var(--arc)); left: calc((100% - var(--card-width)) * var(--order) / 20); width: var(--card-width); height: var(--card-height); transform: rotate(calc(var(--position) * 2deg)); transform-origin: 50% 120%; transition: transform .18s; }
.opening-card:hover { z-index: 30 !important; transform: translateY(-12px); }
.table-actions { display: flex; justify-content: center; margin: 0 0 10px; }
.table-actions .primary-button { min-width: 205px; border-color: var(--accent); background: var(--green); color: #fff; }
.table-actions .primary-button:hover { background: var(--accent); }
[data-phase="memorize"] .table-footnote { margin-top: 3px; }
.behind { padding: 35px 0 10px; grid-template-columns: .8fr 1.2fr; gap: 45px; }
.behind-intro > p:last-child, .detail-copy { font-size: 15px; line-height: 1.75; }
summary { font-size: 15px; }
.game-credit { font-size: 12px; color: var(--muted); margin: 22px 0 0; }
@media(max-width:960px) {
  main { margin: 0; }
}

/* A compact instruction strip and a steady table keep every round in view. */
.game-shell { --play-height: 270px; display: flex; flex-direction: column; }
.guide-panel { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); grid-template-rows: 16px 1fr; align-items: center; gap: 6px 28px; height: 118px; min-height: 118px; padding: 16px 28px; }
.table-label { grid-column: 1; grid-row: 1; }
.edition { margin-left: 16px; }
.table-flourish, .stage-kicker, .reassurance, .guide-bottom { display: none; }
.guide-panel h2 { grid-column: 1; grid-row: 2; font-size: 28px; line-height: 1.06; letter-spacing: -.6px; margin: 0; }
.stage-copy { grid-column: 2; grid-row: 1 / -1; font-size: 14px; line-height: 1.6; margin: 0; max-width: 540px; }
.table-panel { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 34px var(--play-height) 48px 22px; padding: 14px 28px 18px; }
.table-top { grid-column: 1; grid-row: 1; margin: 0; font-size: 10px; }
.hands, .dealing-scene, .reveal-panel { grid-column: 1; grid-row: 2; min-height: 0; height: 100%; }
.hands { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-content: center; }
.card-hand { display: grid; grid-template-rows: 20px 175px 44px; align-items: center; }
.card-hand:last-child { grid-column: auto; width: 100%; justify-self: stretch; }
.card-hand h3 { grid-column: 1; grid-row: 1; margin: 0; font-size: 11px; color: var(--accent); }
.card-fan { grid-column: 1; grid-row: 2; --card-width: 78px; --card-height: 112px; --fan-step: 20px; height: 175px; }
.hand-choice { grid-column: 1; grid-row: 3; justify-self: center; width: 100%; max-width: 195px; margin: 0; min-height: 44px; font-size: 13px; }
.hands.is-opening { min-height: 0; }
.opening-fan { height: 225px; }
.table-actions, .stage-actions { grid-column: 1; grid-row: 3; margin: 0; align-self: center; }
.stage-actions { display: flex; flex-direction: row; justify-content: center; gap: 10px; }
.stage-actions:empty { display: none; }
.stage-actions button { min-height: 44px; padding: 9px 16px; }
.stage-actions .secondary-button { color: var(--ink); background: #fff; border-color: #789ea8; }
.stage-actions .secondary-button:hover { background: #dcece9; }
.table-footnote { grid-column: 1; grid-row: 4; margin: 6px 0 0; line-height: 1.5; }
.dealing-scene { padding: 10px 30px; gap: 18px; }
.dealing-caption { margin: 5px 0 0; }
.reveal-panel { padding: 10px; }
.large-card { width: 136px; height: 196px; }
.reveal-panel h3 { font-size: 25px; margin: 15px 0 0; }

@media (max-width: 760px) {
  .game-shell { --play-height: 360px; }
  .game-shell[data-phase="memorize"] { --play-height: 305px; }
  .guide-panel { grid-template-columns: minmax(120px, .9fr) minmax(0, 1.1fr); height: 156px; min-height: 156px; padding: 14px 18px; gap: 8px 16px; }
  .table-label { grid-column: 1 / -1; }
  .guide-panel h2 { font-size: 25px; }
  .stage-copy { grid-column: 2; grid-row: 2; font-size: 13px; line-height: 1.5; }
  .table-panel { padding: 10px 14px 14px; }
  .table-top { font-size: 9px; letter-spacing: .5px; }
  .hands { grid-template-columns: 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .card-hand { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 42px 72px; gap: 0 8px; }
  .card-hand h3 { grid-column: 1; grid-row: 1; text-align: left; font-size: 12px; }
  .hand-choice { grid-column: 2; grid-row: 1; width: auto; min-width: 146px; min-height: 42px; padding: 7px 12px; }
  .card-fan { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: center; gap: 5px; height: 72px; }
  .fan-card { position: relative; top: auto; left: auto; width: 100%; max-width: 48px; height: auto; aspect-ratio: 2 / 3; justify-self: center; transform: none; }
  .fan-card:hover { transform: translateY(-3px); }
  .fan-card .playing-card { border-radius: 4px; }
  .fan-card .card-corner { top: 4px; left: 4px; font-size: 15px; gap: 1px; }
  .fan-card .card-corner small { font-size: 12px; }
  .fan-card .bottom-corner { display: none; }
  .fan-card .card-symbol { position: absolute; bottom: 4px; right: 4px; font-size: 20px; }
  .is-dealing .fan-card { animation-name: compact-card-arrive; }
  .opening-fan { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px 5px; height: auto; margin: 15px 0 20px; }
  .opening-card { position: relative; top: auto; left: auto; transform: none; width: 100%; max-width: 48px; height: auto; aspect-ratio: 2 / 3; justify-self: center; }
  .stage-actions button { padding: 8px 12px; font-size: 12px; }
  .table-actions .primary-button { width: 100%; }
  .table-footnote { font-size: 9px; }
}

@keyframes compact-card-arrive {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@media(max-width:660px) {
  main { margin: 0; }
  .primary-button, .secondary-button { font-size: 14px; }
  .behind { grid-template-columns: 1fr; gap: 15px; padding: 30px 5px 10px; }
  summary { font-size: 15px; }
  .opening-fan { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px 5px; height: auto; margin: 15px 0 20px; }
  .opening-card { position: relative; top: auto; left: auto; transform: none; width: 100%; height: auto; aspect-ratio: 2/3; }
  .opening-card:hover { transform: translateY(-3px); }
  .opening-card .playing-card { border-radius: 4px; box-shadow: 0 2px 4px #12344812; }
  .opening-card .card-corner { top: 4px; left: 4px; font-size: 15px; gap: 1px; }
  .opening-card .card-corner small { font-size: 12px; }
  .opening-card .bottom-corner { display: none; }
  .opening-card .card-symbol { position: absolute; bottom: 4px; right: 4px; font-size: 20px; }
  .table-actions .primary-button { width: 100%; }
}
