:root {
  color-scheme: dark;
  --ink: #0b100e;
  --ink-2: #121a16;
  --surface: #17221c;
  --surface-2: #1d2b23;
  --ivory: #f1e3c3;
  --muted: #b9b39f;
  --gold: #c78d18;
  --gold-light: #efbb4d;
  --green: #2d8a52;
  --blue: #328bd0;
  --red: #c65b4a;
  --line: rgba(241, 227, 195, 0.18);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html { max-width: 100%; scroll-behavior: smooth; overflow-x: clip; }
body { max-width: 100%; margin: 0; background: var(--ink); color: var(--ivory); font-family: Inter, Calibri, system-ui, sans-serif; line-height: 1.55; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 4px; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 99; transform: translateY(-160%); background: var(--ivory); color: var(--ink); padding: .7rem 1rem; }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 5vw, 5rem); background: rgba(11, 16, 14, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ivory); text-decoration: none; font-family: Georgia, serif; letter-spacing: .08em; font-weight: 700; }
.brand-mark { color: var(--gold-light); font-size: 1.35rem; }
nav { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.8rem); }
nav a, .nav-action { min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; padding: .55rem .25rem; }
nav a:hover, .nav-action:hover { color: var(--ivory); }

.hero { min-height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); align-items: center; gap: 4vw; padding: clamp(2rem, 4vh, 3.5rem) clamp(1.25rem, 7vw, 7rem); overflow: hidden; background: #0b100e; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 .7rem; color: var(--gold-light); font-size: .78rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; font-family: Georgia, Cambria, serif; line-height: 1.06; }
h1 { margin-bottom: 1.35rem; max-width: 780px; font-size: clamp(3rem, 5.2vw, 5.5rem); letter-spacing: -.045em; }
h2 { margin-bottom: 1rem; font-size: clamp(2.1rem, 4vw, 4rem); letter-spacing: -.025em; }
h3 { margin-bottom: .65rem; font-size: 1.55rem; }
p { margin-top: 0; }
.hero-lead { max-width: 650px; color: #d8d0bb; font-size: clamp(1.05rem, 1.6vw, 1.28rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: 2rem 0 1.3rem; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: .38rem; padding: .75rem 1.15rem; border: 1px solid transparent; border-radius: 4px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .16s ease, background .16s ease; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--gold); color: #11150f; }
.button-primary:hover { background: var(--gold-light); }
.button-secondary { border-color: var(--line); background: transparent; color: var(--ivory); }
.button-secondary:hover { background: rgba(241, 227, 195, .08); }
.button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.review-note { max-width: 650px; color: var(--muted); font-size: .82rem; }

.card-fan { position: relative; min-height: 520px; display: flex; justify-content: center; align-items: center; }
.card-fan::after { content: ""; position: absolute; width: 74%; height: 36%; bottom: 7%; border: 1px solid rgba(199,141,24,.3); border-radius: 50%; box-shadow: 0 0 80px rgba(199,141,24,.16); }
.card-fan img { position: absolute; z-index: 2; width: min(240px, 42%); border-radius: 13px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.2); }
.card-fan img:nth-child(1) { transform: translate(-43%, 4%) rotate(-13deg); }
.card-fan img:nth-child(2) { transform: translate(0, -6%); z-index: 3; }
.card-fan img:nth-child(3) { transform: translate(43%, 4%) rotate(13deg); }

.learn-section, .deck-section, .modes-section, .regulations-section { padding: clamp(4rem, 8vw, 8rem) clamp(1.25rem, 7vw, 7rem); }
.learn-section { background: #eee5d2; color: #18201b; }
.section-heading { max-width: 760px; margin-bottom: 2.7rem; }
.section-heading > p:last-child { color: inherit; opacity: .74; font-size: 1.08rem; }
.learning-grid, .mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.learning-grid article { min-height: 230px; padding: 1.5rem; border-top: 3px solid #176b3a; background: rgba(255,255,255,.46); }
.learning-grid p { color: #475148; }
.learning-grid a { min-height: 44px; display: inline-flex; align-items: center; color: #176b3a; font-weight: 800; text-underline-offset: .2em; }
.step, .mode-index { display: block; color: #176b3a; font-weight: 800; letter-spacing: .14em; }
.text-action { min-height: 44px; margin-top: 1.5rem; padding: .5rem 0; border: 0; background: transparent; color: #176b3a; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; }

.modes-section { background: var(--ink-2); }
.mode-card { min-height: 360px; display: flex; flex-direction: column; justify-content: space-between; padding: 1.7rem; border: 1px solid var(--line); background: var(--surface); }
.mode-card.standard { border-top: 4px solid var(--green); }
.mode-card.duel { border-top: 4px solid var(--blue); }
.mode-card.pairs { border-top: 4px solid var(--red); }
.mode-card p:not(.mode-index) { color: var(--muted); }
.mode-card .button { width: 100%; }

.deck-section { background: #101b15; }
.territory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.territory-card { min-height: 210px; display: grid; grid-template-columns: 132px 1fr; align-items: center; gap: 1.25rem; padding: 1.2rem; border: 1px solid var(--line); border-left: 4px solid var(--territory-accent); background: var(--surface); }
.territory-card img { width: 132px; border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.34); }
.territory-card h3 { margin-bottom: .45rem; }
.territory-card p:last-child { margin-bottom: 0; color: var(--muted); }
.territory-index { margin-bottom: .35rem; color: var(--territory-accent); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.territory-ko { --territory-accent: var(--blue); }
.territory-mawida { --territory-accent: var(--green); }
.territory-kurruf { --territory-accent: var(--gold-light); }
.territory-wigkul { --territory-accent: var(--red); }
.card-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.card-types article { padding: 1.4rem; border: 1px solid var(--line); background: rgba(241,227,195,.045); }
.card-types h3 { font-size: 1.35rem; }
.card-types p:last-child { margin-bottom: 0; color: var(--muted); }
.card-explorer { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.explorer-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.explorer-heading > div { max-width: 780px; }
.explorer-heading h3 { margin-bottom: .65rem; font-size: clamp(1.9rem, 3.4vw, 3rem); }
.explorer-heading > div > p:last-child { margin-bottom: 0; color: var(--muted); }
.explorer-total { min-width: 142px; margin: 0; padding-left: 1rem; border-left: 3px solid var(--gold); }
.explorer-total strong, .explorer-total span { display: block; }
.explorer-total strong { font-family: Georgia, Cambria, serif; font-size: 2.7rem; line-height: 1; }
.explorer-total span { color: var(--muted); font-size: .8rem; }
.explorer-controls { min-width: 0; max-width: 100%; display: grid; grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(145px, .7fr)); gap: .75rem; padding: 1rem; border: 1px solid var(--line); background: var(--surface); }
.explorer-controls label { min-width: 0; max-width: 100%; display: grid; gap: .35rem; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .06em; }
.explorer-controls input, .explorer-controls select { min-width: 0; width: 100%; max-width: 100%; min-height: 46px; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 2px; background: var(--ink); color: var(--ivory); font: inherit; }
.explorer-controls input:focus-visible, .explorer-controls select:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.explorer-actions { min-width: 0; grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; }
.explorer-legend { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; margin: 1rem 0 .4rem; color: var(--muted); font-size: .8rem; }
.explorer-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.status-dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--status-color); }
.status-validated { --status-color: #58aa75; }
.status-nuance { --status-color: var(--gold-light); }
.status-pending { --status-color: #ef806d; }
.explorer-summary { margin: .75rem 0; color: var(--ivory); font-weight: 800; }
.explorer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .75rem; }
.explorer-card { min-width: 0; padding: 0; border: 1px solid var(--line); border-top: 3px solid var(--territory-accent); background: var(--surface); color: var(--ivory); text-align: left; cursor: pointer; overflow: hidden; transition: transform .16s ease, border-color .16s ease; }
.explorer-card:hover { transform: translateY(-3px); border-color: var(--territory-accent); }
.explorer-card-image { position: relative; display: block; aspect-ratio: 320 / 350; overflow: hidden; background: #243029; }
.explorer-card-image img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.catalog-status { display: inline-flex; align-items: center; min-height: 24px; padding: .25rem .5rem; border: 1px solid var(--status-color); background: rgba(11,16,14,.9); color: var(--ivory); font-size: .68rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.explorer-card-image .catalog-status { position: absolute; right: .45rem; bottom: .45rem; }
.explorer-card-copy { display: grid; padding: .75rem; }
.explorer-card-copy small { color: var(--territory-accent); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.explorer-card-copy strong { margin-top: .25rem; font-family: Georgia, Cambria, serif; font-size: 1.15rem; line-height: 1.1; }
.explorer-card-copy > span:last-child { margin-top: .22rem; color: var(--muted); font-size: .8rem; }
.territory-special { --territory-accent: #d8d0bb; }
.explorer-empty { margin: 1rem 0 0; padding: 1.2rem; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.language-note { margin-top: 2.25rem; padding: 1.35rem 1.5rem; border-left: 4px solid var(--gold-light); background: rgba(241,227,195,.075); }
.language-note h3 { margin-bottom: .55rem; font-size: 1.45rem; }
.language-note p:last-child { max-width: 850px; margin-bottom: 0; color: #d8d0bb; }
.subsection-heading { margin: 2.5rem 0 1.1rem; }
.subsection-heading h3 { margin-bottom: 0; font-size: clamp(1.65rem, 2.8vw, 2.4rem); }
.term-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.term-grid article { padding: 1.35rem; border: 1px solid var(--line); background: var(--surface); }
.term-grid article:last-child { grid-column: 1 / -1; }
.term-grid h4 { margin: 0 0 .55rem; color: var(--gold-light); font-family: Georgia, Cambria, serif; font-size: 1.35rem; }
.term-grid p { margin-bottom: 0; color: var(--muted); }
.game-vocabulary dl { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; margin: 0; }
.game-vocabulary dl > div { padding: 1rem; border-top: 2px solid var(--gold); background: rgba(241,227,195,.045); }
.game-vocabulary dt { margin-bottom: .4rem; font-weight: 800; }
.game-vocabulary dd { margin: 0; color: var(--muted); font-size: .92rem; }
.source-note { max-width: 900px; margin: 1.4rem 0 0; color: var(--muted); font-size: .82rem; }
.source-note a { min-height: 44px; display: inline-flex; align-items: center; color: var(--gold-light); text-underline-offset: .2em; }

.regulations-section { background: #eee5d2; color: #18201b; }
.regulation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.regulation-card { min-height: 350px; display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; padding: 1.5rem; border: 1px solid rgba(24,32,27,.2); border-top: 4px solid #176b3a; background: rgba(255,255,255,.56); }
.regulation-card p { color: #475148; }
.status-badge { display: inline-block; margin-bottom: 1rem; padding: .25rem .55rem; background: #176b3a; color: white; font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.document-actions { display: grid; gap: .55rem; }
.regulations-section .button-secondary { border-color: rgba(24,32,27,.28); color: #18201b; }
.regulations-section .button-secondary:hover { background: rgba(24,32,27,.08); }
.regulations-section > .review-note { margin: 1.25rem 0 0; color: #59625b; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.4rem clamp(1.25rem, 7vw, 7rem); border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
footer a { min-height: 44px; display: inline-flex; align-items: center; color: var(--ivory); text-underline-offset: .2em; }
.footer-action { min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--ivory); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }

dialog { width: min(760px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); overflow-x: hidden; overflow-y: auto; padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ivory); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(3, 6, 5, .82); }
.dialog-head { position: sticky; z-index: 5; top: 0; display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem; border-bottom: 1px solid var(--line); background: rgba(23,34,28,.98); }
.dialog-head > div { min-width: 0; }
.dialog-head h2 { min-width: 0; margin: 0; font-size: clamp(1.55rem, 5.6vw, 2rem); overflow-wrap: normal; }
.icon-button { width: 44px; min-width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 1.6rem; }
.rules-list { padding: .5rem 1.5rem; }
.rules-list article { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.rules-list article > a { color: var(--gold-light); font-weight: 800; text-underline-offset: .2em; overflow-wrap: anywhere; }
dialog .review-note { margin: 1.2rem 1.5rem 1.5rem; }
.credits-content { display: grid; gap: 0; padding: .5rem 1.5rem 1.5rem; }
.credits-content section { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.credits-content h3 { margin-bottom: .45rem; font-size: 1.18rem; }
.credits-content p { margin: 0 0 .65rem; color: #d8d0bb; }
.credits-content p:last-child { margin-bottom: 0; }
.credits-content ul { margin: 0; padding-left: 1.2rem; }
.credits-content a { color: var(--gold-light); text-underline-offset: .2em; overflow-wrap: anywhere; }
.credits-version { padding-top: 1rem; color: var(--muted) !important; font-size: .8rem; }
.card-dialog { width: min(1050px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); overflow-x: hidden; overflow-y: auto; }
.card-dialog-close { position: sticky; z-index: 6; top: .55rem; display: flex; align-items: center; justify-content: center; float: none; margin: .55rem .55rem -44px auto; background: rgba(11,16,14,.96); }
.card-detail { --territory-accent: var(--gold); display: grid; grid-template-columns: minmax(240px, .72fr) minmax(0, 1.28fr); min-height: 620px; border-top: 4px solid var(--territory-accent); }
.card-detail-visual { display: grid; align-content: center; gap: .75rem; padding: 2rem; background: #0e1712; }
.card-detail-visual img { width: min(100%, 340px); margin: auto; border-radius: 10px; box-shadow: var(--shadow); }
.card-detail-visual p { max-width: 340px; margin: 0 auto; color: var(--muted); font-size: .78rem; }
.card-detail-copy { padding: clamp(1.5rem, 4vw, 3rem); }
.card-detail-status { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-bottom: 1rem; color: var(--muted); font-size: .76rem; }
.card-detail-copy h2 { margin-bottom: .2rem; font-size: clamp(2.4rem, 5vw, 4.5rem); }
.card-spanish { margin-bottom: 1.2rem; color: var(--territory-accent); font-size: 1.2rem; font-weight: 800; }
.card-detail-copy > p:not(.card-spanish) { color: #d8d0bb; }
.card-detail-copy dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 1.3rem 0; }
.card-detail-copy dl > div { padding: .75rem; border: 1px solid var(--line); }
.card-detail-copy dt { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.card-detail-copy dd { margin: .25rem 0 0; }
.catalog-poem, .approved-card-text { margin: 1.25rem 0; padding: 1rem 1.1rem; border-left: 3px solid var(--territory-accent); background: rgba(241,227,195,.06); }
.catalog-poem blockquote { margin: 0; font-family: Georgia, Cambria, serif; font-size: 1.15rem; font-style: italic; }
.approved-card-text { border-color: var(--gold-light); }
.approved-card-text p:last-child { margin: 0; color: var(--ivory); font-family: Georgia, Cambria, serif; font-size: 1.05rem; }
.catalog-note { margin: 1.2rem 0; padding: 1rem; border: 1px solid var(--status-color, var(--gold)); background: #111d16; }
.catalog-note strong { color: var(--gold-light); }
.catalog-note p { margin: .35rem 0 0; color: #d8d0bb; }
.catalog-sources h3 { margin-bottom: .5rem; font-family: inherit; font-size: .95rem; }
.catalog-sources ul { margin: 0; padding-left: 1.2rem; }
.catalog-sources a { color: var(--gold-light); text-underline-offset: .2em; }

.game-view { min-height: calc(100vh - 72px); padding: 1rem clamp(.8rem, 3vw, 2.5rem) 3rem; background: #0e1712; }
.game-shell { max-width: 1320px; margin: auto; }
.game-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0 1rem; }
.game-toolbar h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.7rem); }
.game-abandon { min-height: 44px; margin-top: 0; color: #f0a092; }
.game-meta { display: flex; flex-wrap: wrap; gap: .6rem; }
.meta-block { min-width: 100px; padding: .55rem .75rem; border-left: 2px solid var(--gold); background: var(--surface); }
.meta-block small { display: block; color: var(--muted); }
.scoreboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: .65rem; margin-bottom: .8rem; }
.score { padding: .65rem .8rem; border: 1px solid var(--line); background: var(--surface); }
.score strong { display: block; font-size: 1.25rem; }
.table-surface { min-height: 620px; display: grid; grid-template-rows: auto 1fr auto; gap: 1rem; padding: 1rem; border: 1px solid rgba(199,141,24,.3); background: #14271c; box-shadow: inset 0 0 90px rgba(0,0,0,.34); }
.player-zone h2 { margin-bottom: .55rem; font-size: 1rem; font-family: inherit; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.piles, .hand { display: flex; justify-content: center; flex-wrap: wrap; gap: .65rem; }
.hand .hand-group-start, .prediction-hand .hand-group-start { margin-inline-start: .75rem; }
.card-button, .card-static { position: relative; width: clamp(88px, 10vw, 128px); aspect-ratio: 320 / 440; padding: 0; border: 2px solid transparent; border-radius: 8px; background: #29342e; box-shadow: 0 8px 20px rgba(0,0,0,.32); overflow: hidden; }
.card-button { cursor: pointer; }
.card-button:hover:not(:disabled), .card-button.legal { border-color: var(--gold-light); transform: translateY(-5px); }
.card-button:disabled { opacity: .46; cursor: not-allowed; }
.card-button img, .card-static img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pile-count { position: absolute; right: 4px; bottom: 4px; min-width: 24px; padding: 2px 5px; background: rgba(11,16,14,.9); color: white; font-size: .72rem; }
.table-center { display: grid; grid-template-columns: minmax(120px, .55fr) minmax(220px, 1fr) minmax(220px, 1fr); align-items: center; gap: 1rem; }
.indicator, .trick-area, .coach { min-height: 190px; padding: 1rem; border: 1px solid var(--line); background: rgba(9,16,12,.52); }
.trump-explanation { grid-column: 1 / -1; margin: .6rem 0 0; color: var(--gold-light); font-size: .82rem; line-height: 1.4; }
.indicator .card-static { width: 86px; }
.trick-cards { display: flex; justify-content: center; gap: .65rem; min-height: 135px; align-items: center; }
.coach { border-left: 3px solid var(--gold); }
.coach h3 { font-size: 1.1rem; }
.coach p { margin-bottom: 0; color: #d6cfbc; }
.round-summary, .prediction-panel { max-width: 700px; margin: 3rem auto; padding: 2rem; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.prediction-options { display: flex; flex-wrap: wrap; gap: .6rem; }
.prediction-options button { min-width: 48px; min-height: 48px; border: 1px solid var(--line); background: var(--ink); cursor: pointer; }
.prediction-options button:hover { border-color: var(--gold-light); }
.prediction-panel { max-width: 1060px; }
.trump-selection-panel { max-width: 900px; }
.trump-selection-content { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 1.25rem; margin-top: 1.25rem; }
.trump-selection-content .card-static { width: 96px; }
.trump-selection-content h3 { margin-bottom: .8rem; font-size: 1.05rem; font-family: inherit; color: var(--muted); }
.trump-indicator-summary { display: grid; justify-items: center; }
.trump-indicator-summary .eyebrow { margin-bottom: .45rem; font-size: .68rem; }
.trump-choice-hand-wrap { margin-bottom: 1.6rem; border-color: rgba(218, 171, 63, .45); }
.standard-trump-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.prediction-order-wrap { margin: 1.25rem 0; padding: 1rem; border-left: 3px solid var(--gold); background: rgba(9,16,12,.42); }
.prediction-order-wrap h3 { margin-bottom: .7rem; font-size: 1.05rem; font-family: inherit; color: var(--muted); }
.prediction-order { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .55rem; }
.prediction-order-item { min-width: 0; padding: .6rem .7rem; border: 1px solid var(--line); background: var(--ink); }
.prediction-order-item small, .prediction-order-item strong { display: block; }
.prediction-order-item small { color: var(--muted); }
.prediction-order-item strong { font-size: .92rem; }
.prediction-order-item.current { border-color: var(--gold-light); }
.prediction-hand-wrap { margin: 1.4rem 0; padding: 1rem; border: 1px solid var(--line); background: rgba(9,16,12,.42); }
.prediction-hand-wrap h3 { margin-bottom: .8rem; font-size: 1.05rem; font-family: inherit; color: var(--muted); }
.prediction-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; }
.prediction-card { width: clamp(72px, 8vw, 102px); animation: standard-deal-human 850ms cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--card-index) * 70ms); }
.error-banner { margin-bottom: .7rem; padding: .7rem 1rem; background: #512820; border-left: 3px solid var(--red); }

/* Notukawün: las cuatro cartas de la baza permanecen visibles y rotuladas antes de recogerse. */
.standard-table { position: relative; }
.standard-table .table-center { grid-template-columns: minmax(105px, .4fr) minmax(330px, 1.35fr) minmax(230px, 1fr); }
.standard-trick-cards { display: grid; grid-template-columns: repeat(4, minmax(58px, 1fr)); gap: clamp(.35rem, 1vw, .65rem); }
.standard-play { min-width: 0; margin: 0; display: grid; justify-items: center; gap: .35rem; }
.standard-play figcaption { color: var(--gold-light); font-size: .76rem; font-weight: 800; text-align: center; }
.standard-played-card { width: min(100%, 86px); }
.standard-public-declaration { margin: .45rem 0 0; color: var(--gold-light); font-size: .78rem; font-weight: 800; text-align: center; }
.standard-deal-card { animation: standard-deal-human 850ms cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--card-index) * 70ms); }
.standard-play-p0 { animation: standard-play-human 600ms cubic-bezier(.2,.8,.2,1) both; }
.standard-play-p1 { --standard-x: -48%; --standard-y: -55%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.standard-play-p2 { --standard-x: 0%; --standard-y: -70%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.standard-play-p3 { --standard-x: 48%; --standard-y: -55%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.standard-play-p4 { --standard-x: -35%; --standard-y: -65%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.standard-play-p5 { --standard-x: 35%; --standard-y: -65%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.standard-table[data-player-count="5"] .standard-trick-cards,
.standard-table[data-player-count="6"] .standard-trick-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.standard-capture { animation: standard-capture 850ms ease-in both; }
.standard-baza-result { grid-column: 1 / -1; margin: 0; color: var(--gold-light); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; animation: duel-result 420ms ease-out both; }
.standard-table[aria-busy="true"] .card-button { cursor: wait; }
.standard-declaration { position: absolute; z-index: 8; top: 50%; left: 50%; width: min(520px, calc(100% - 2rem)); max-height: calc(100% - 1rem); overflow: auto; transform: translate(-50%, -50%); padding: 1.15rem; border: 1px solid var(--gold); background: #111d16; box-shadow: 0 18px 55px rgba(0,0,0,.72); }
.standard-declaration h2 { margin-bottom: .4rem; font-size: clamp(1.55rem, 3vw, 2.1rem); }
.standard-declaration > p:not(.eyebrow) { margin-bottom: .8rem; color: #d6cfbc; }
.standard-declaration fieldset { margin: .65rem 0; padding: 0; border: 0; }
.standard-declaration legend { margin-bottom: .35rem; color: var(--muted); font-size: .86rem; font-weight: 800; }
.standard-declaration-options { display: grid; grid-template-columns: repeat(2, minmax(90px, 1fr)); gap: .45rem; }
.standard-declaration-options button { min-height: 44px; padding: .5rem; border: 1px solid var(--line); background: var(--ink); cursor: pointer; }
.standard-declaration-options button[aria-pressed="true"] { border-color: var(--gold-light); background: var(--gold); color: #11150f; font-weight: 800; }
.standard-declaration-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .9rem; }
.standard-table[data-declaration-open="true"] > :not(.standard-declaration) { opacity: .42; }

@keyframes standard-deal-human {
  from { opacity: 0; transform: translateY(38%) scale(.86) rotate(2deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes standard-play-human {
  from { opacity: .35; transform: translateY(70%) scale(.82) rotate(4deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes standard-play-rival {
  from { opacity: .35; transform: translate(var(--standard-x), var(--standard-y)) scale(.82) rotate(-3deg); }
  to { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
@keyframes standard-capture {
  0%, 45% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-45%) scale(.72); }
}

/* Parejas: identidad de jugador y equipo visible durante toda la baza. */
.pairs-table .table-center { grid-template-columns: minmax(105px, .4fr) minmax(330px, 1.35fr) minmax(230px, 1fr); }
.pairs-trick-cards { display: grid; grid-template-columns: repeat(4, minmax(58px, 1fr)); gap: clamp(.35rem, 1vw, .65rem); }
.pairs-play { min-width: 0; margin: 0; display: grid; justify-items: center; gap: .35rem; }
.pairs-play figcaption { min-height: 2.5rem; display: grid; align-content: end; color: var(--gold-light); font-size: .78rem; line-height: 1.2; text-align: center; }
.pairs-play figcaption strong, .pairs-play figcaption span { display: block; }
.pairs-play figcaption span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.pairs-played-card { width: min(100%, 86px); }
.pairs-deal-card { animation: pairs-deal-human 850ms cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--card-index) * 55ms); }
.pairs-play-p0 { animation: standard-play-human 600ms cubic-bezier(.2,.8,.2,1) both; }
.pairs-play-p1 { --standard-x: -48%; --standard-y: -55%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.pairs-play-p2 { --standard-x: 0%; --standard-y: -70%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.pairs-play-p3 { --standard-x: 48%; --standard-y: -55%; animation: standard-play-rival 600ms cubic-bezier(.2,.8,.2,1) both; }
.pairs-capture-team-a { animation: pairs-capture-team-a 850ms ease-in both; }
.pairs-capture-team-b { animation: pairs-capture-team-b 850ms ease-in both; }
.pairs-baza-result { grid-column: 1 / -1; margin: 0; color: var(--gold-light); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; animation: duel-result 420ms ease-out both; }
.pairs-table[aria-busy="true"] .card-button { cursor: wait; }

@keyframes pairs-deal-human {
  from { opacity: 0; transform: translateY(38%) scale(.86) rotate(2deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes pairs-capture-team-a {
  0%, 45% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(65%) scale(.72) rotate(4deg); }
}
@keyframes pairs-capture-team-b {
  0%, 45% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-65%) scale(.72) rotate(-4deg); }
}

/* Duelo: los dos grupos de tres montones permanecen dentro del alto visible. */
.duel-shell { height: calc(100dvh - 136px); min-height: 500px; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.duel-shell .game-toolbar { padding: .35rem 0 .55rem; }
.duel-shell .game-toolbar h1 { font-size: clamp(1.45rem, 2.5vw, 2.15rem); }
.duel-score .scoreboard { grid-template-columns: repeat(2, minmax(140px, 1fr)); margin-bottom: .5rem; }
.duel-score .score { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .65rem; padding: .38rem .7rem; }
.duel-score .score strong { font-size: 1.08rem; }
.duel-score .score span { justify-self: end; color: var(--muted); font-size: .86rem; }
.duel-table { position: relative; min-height: 0; height: 100%; grid-template-rows: minmax(0, 1fr) minmax(150px, .82fr) minmax(0, 1fr); gap: .45rem; padding: .6rem 1rem; overflow: hidden; }
.duel-table .player-zone { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); align-items: center; }
.duel-table .player-zone h2 { margin: 0; font-size: .78rem; text-align: center; }
.duel-table .piles { flex-wrap: nowrap; gap: clamp(.4rem, 1.2vw, .8rem); min-height: 0; align-items: center; }
.duel-table .card-button, .duel-table .card-static { width: clamp(66px, min(9vw, 11.5vh), 112px); flex: 0 0 auto; }
.duel-table .table-center { grid-template-columns: minmax(105px, .45fr) minmax(190px, .85fr) minmax(230px, 1.4fr); gap: .6rem; min-height: 0; }
.duel-table .indicator, .duel-table .trick-area, .duel-table .coach { min-height: 0; height: 100%; padding: .65rem; }
.duel-table .indicator { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .55rem; }
.duel-table .indicator .eyebrow { writing-mode: vertical-rl; transform: rotate(180deg); margin: 0; }
.duel-table .indicator .card-static { width: clamp(58px, min(7vw, 9vh), 82px); }
.duel-table .trick-cards { min-height: 0; height: calc(100% - 1.5rem); }
.duel-table .trick-cards .card-static { width: clamp(58px, min(7vw, 9vh), 82px); }
.duel-table .coach { overflow: auto; }
.duel-table .coach h3 { margin-bottom: .35rem; }
.duel-table .coach p { font-size: clamp(.82rem, 1.2vw, 1rem); line-height: 1.38; }
.duel-table[aria-busy="true"] .card-button { cursor: wait; }
.duel-opponent .duel-deal-card { animation: duel-deal-opponent 850ms cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--pile-index) * 110ms); }
.duel-human .duel-deal-card { animation: duel-deal-human 850ms cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--pile-index) * 110ms); }
.duel-play-human { animation: duel-play-human 600ms cubic-bezier(.2,.8,.2,1) both; }
.duel-play-computer { animation: duel-play-computer 600ms cubic-bezier(.2,.8,.2,1) both; }
.duel-capture-human { animation: duel-capture-human 850ms ease-in both; }
.duel-capture-computer { animation: duel-capture-computer 850ms ease-in both; }
.duel-reveal-card { animation: duel-reveal 420ms ease-out both; }
.duel-baza-result { margin: 0; color: var(--gold-light); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; animation: duel-result 420ms ease-out both; }
.duel-public-declaration { margin: .25rem 0 0; color: var(--gold-light); font-size: .78rem; font-weight: 800; text-align: center; }
.duel-declaration { position: absolute; z-index: 8; top: 50%; left: 50%; width: min(560px, calc(100% - 2rem)); max-height: calc(100% - 1rem); overflow: auto; transform: translate(-50%, -50%); padding: 1.15rem; border: 1px solid var(--gold); background: #111d16; box-shadow: 0 18px 55px rgba(0,0,0,.72); }
.duel-declaration h2 { margin-bottom: .4rem; font-size: clamp(1.55rem, 3vw, 2.1rem); }
.duel-declaration > p:not(.eyebrow) { margin-bottom: .8rem; color: #d6cfbc; }
.duel-declaration fieldset { margin: .65rem 0; padding: 0; border: 0; }
.duel-declaration legend { margin-bottom: .35rem; color: var(--muted); font-size: .86rem; font-weight: 800; }
.duel-declaration-options { display: grid; grid-template-columns: repeat(4, minmax(64px, 1fr)); gap: .45rem; }
.duel-declaration-options button { min-height: 44px; padding: .5rem; border: 1px solid var(--line); background: var(--ink); cursor: pointer; }
.duel-declaration-options button[aria-pressed="true"] { border-color: var(--gold-light); background: var(--gold); color: #11150f; font-weight: 800; }
.duel-declaration fieldset:last-of-type .duel-declaration-options { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
.duel-fixed-suit { padding: .55rem .7rem; border-left: 3px solid var(--gold); background: rgba(241,227,195,.07); }
.duel-declaration-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .9rem; }
.duel-table[data-declaration-open="true"] > :not(.duel-declaration) { opacity: .42; }

@keyframes duel-deal-opponent {
  from { opacity: 0; transform: translate(0, -45%) scale(.84) rotate(-3deg); }
  to { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
@keyframes duel-deal-human {
  from { opacity: 0; transform: translate(0, 45%) scale(.84) rotate(3deg); }
  to { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
@keyframes duel-play-human {
  from { opacity: .35; transform: translateY(70%) scale(.82) rotate(4deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes duel-play-computer {
  from { opacity: .35; transform: translateY(-70%) scale(.82) rotate(-4deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes duel-capture-human {
  0%, 45% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(80%) scale(.72) rotate(5deg); }
}
@keyframes duel-capture-computer {
  0%, 45% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80%) scale(.72) rotate(-5deg); }
}
@keyframes duel-reveal {
  from { opacity: .2; transform: translateY(-8%) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes duel-result {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 860px) {
  .site-header nav a { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 3rem; }
  .card-fan { min-height: 420px; }
  .learning-grid, .mode-grid { grid-template-columns: 1fr; }
  .territory-grid, .regulation-grid { grid-template-columns: 1fr; }
  .card-types { grid-template-columns: 1fr; }
  .explorer-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explorer-search { grid-column: 1 / -1; }
  .card-detail { grid-template-columns: 1fr; }
  .card-detail-visual { padding: 1.5rem; }
  .card-detail-visual img { width: min(62%, 300px); }
  .game-vocabulary dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-card { min-height: 260px; }
  .table-center { grid-template-columns: 1fr; }
  .standard-table .table-center { grid-template-columns: 1fr; }
  .pairs-table .table-center { grid-template-columns: 1fr; }
  .indicator, .trick-area, .coach { min-height: auto; }
  .duel-shell { height: auto; min-height: 0; display: block; }
  .duel-table { height: auto; min-height: 620px; overflow: visible; }
  .duel-table .table-center { grid-template-columns: 1fr 1fr; }
  .duel-table .coach { grid-column: 1 / -1; }
  .duel-table .indicator { grid-template-columns: auto 1fr; }
  footer { flex-direction: column; }
}

@media (max-width: 520px) {
  .site-header { min-height: 64px; }
  .brand { font-size: .9rem; }
  .nav-action { font-size: .86rem; }
  h1 { font-size: 3rem; }
  .card-fan { min-height: 330px; }
  .card-fan img { width: 43%; }
  .territory-card { grid-template-columns: 96px 1fr; gap: .9rem; }
  .territory-card img { width: 96px; }
  .term-grid, .game-vocabulary dl { grid-template-columns: 1fr; }
  .explorer-heading { align-items: start; flex-direction: column; gap: 1rem; }
  .explorer-controls { grid-template-columns: 1fr; }
  .explorer-search { grid-column: auto; }
  .explorer-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .explorer-actions .button { min-width: 0; width: 100%; padding-inline: .55rem; white-space: normal; }
  .explorer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .explorer-card-copy { padding: .6rem; }
  .card-detail-copy dl { grid-template-columns: 1fr; }
  .card-detail-visual img { width: min(78%, 280px); }
  .term-grid article:last-child { grid-column: auto; }
  .game-toolbar { align-items: flex-start; flex-direction: column; }
  .game-meta { width: 100%; }
  .meta-block { flex: 1; }
  .table-surface { padding: .65rem; }
  .card-button, .card-static { width: 84px; }
  .prediction-card { width: clamp(64px, 20vw, 82px); }
  .trump-selection-content { grid-template-columns: 1fr; justify-items: center; }
  .standard-trump-options { width: 100%; }
  .prediction-order { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hand .hand-group-start, .prediction-hand .hand-group-start { margin-inline-start: .3rem; }
  .standard-trick-cards { grid-template-columns: repeat(4, minmax(48px, 1fr)); }
  .standard-play figcaption { font-size: .66rem; }
  .standard-played-card { width: min(100%, 72px); }
  .pairs-trick-cards { grid-template-columns: repeat(4, minmax(48px, 1fr)); }
  .pairs-play figcaption { font-size: .68rem; }
  .pairs-play figcaption span { font-size: .64rem; }
  .pairs-played-card { width: min(100%, 72px); }
  .duel-score .score { grid-template-columns: auto auto; }
  .duel-score .score span { grid-column: 1 / -1; justify-self: start; }
  .duel-table { min-height: 570px; }
  .duel-table .card-button, .duel-table .card-static { width: clamp(64px, 22vw, 82px); }
  .duel-table .table-center { grid-template-columns: 1fr; }
  .duel-table .coach { grid-column: auto; }
  .duel-declaration-options { grid-template-columns: repeat(2, minmax(76px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
/* Niveles del computador: control común antes de iniciar una partida. */
.difficulty-picker { margin: 1rem 0; max-width: 40rem; }
.difficulty-picker label { display: block; font-weight: 700; margin-bottom: .4rem; }
.difficulty-picker select { width: 100%; min-height: 44px; padding: .65rem; border: 1px solid #786a55; border-radius: .5rem; background: #fffaf0; color: #252a26; font: inherit; }
.difficulty-picker select:focus-visible { outline: 3px solid #1473b9; outline-offset: 3px; }
.difficulty-picker p { font-size: .875rem; line-height: 1.5; }

/* El indicador vive fuera del select nativo para mantenerse visible en iOS. */
.select-shell { display: block; position: relative; width: 100%; min-width: 0; border: 2px solid var(--gold); border-radius: .5rem; background: var(--surface); }
.select-shell .select-arrow { position: absolute; top: 0; right: 0; bottom: 0; z-index: 1; width: 3rem; display: flex; align-items: center; justify-content: center; border-radius: 0 .35rem .35rem 0; background: var(--gold); color: #11150f; font: 700 28px/1 system-ui, sans-serif; pointer-events: none; }
.select-shell:focus-within { outline: 3px solid var(--gold-light); outline-offset: 3px; }
.difficulty-picker select, .explorer-controls select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  padding-right: 3.5rem;
  border: 0;
  border-radius: .35rem;
  background: var(--surface);
  color: var(--ivory);
  -webkit-text-fill-color: var(--ivory);
  cursor: pointer;
  font-size: 16px;
}
.explorer-controls .select-shell { display: block; }
#modalidades { scroll-margin-top: 90px; }
#abandon-dialog { width: min(460px, calc(100% - 2rem)); padding: 1.5rem; }
.abandon-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.abandon-actions .button { flex: 1 1 150px; }
