/* Page layouts. Materials and base components come from pirate-tavern.css. */
html { background: #100e0a; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- landing ---------- */
.backdrop { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.landing { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 100svh; width: 100%; padding: calc(20px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom)); }
.landing-top { width: 100%; max-width: 440px; display: flex; justify-content: flex-end; }
.lang-switch { display: flex; gap: 4px; padding: 3px; border-radius: 8px; background: #0b0a08b0; border: 1px solid #7e684880; }
.lang-switch button, .menu-langs button { background: transparent; border: 0; color: var(--muted); padding: 6px 10px; border-radius: 6px; font-size: 14px; letter-spacing: .05em; min-height: 34px; }
.lang-switch button[aria-pressed='true'], .menu-langs button[aria-pressed='true'] { color: #181005; background: linear-gradient(105deg, #bd8d42, #e3b86e); }
.brand { width: min(46vw, 220px); filter: drop-shadow(0 3px 4px #0009); margin-top: 4px; }
.brand img { display: block; width: 100%; height: auto; }
.welcome { width: 100%; max-width: 440px; margin-top: auto; padding-top: clamp(40px, 12svh, 220px); text-align: center; }
.welcome h1 { font-weight: 400; text-transform: uppercase; font-size: clamp(34px, 9.4vw, 54px); line-height: .99; letter-spacing: -.025em; margin: 0; color: var(--cream); text-shadow: 0 3px 8px #000, 0 1px 1px #000; }
.tagline { margin: 14px 0 0; font-size: clamp(10px, 2.75vw, 14px); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); text-shadow: 0 2px 4px #000; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 9px; height: 34px; margin: 4px 0 8px; }
.ornament span { height: 2px; width: 70px; background: linear-gradient(90deg, transparent, var(--brass), var(--gold)); border-radius: 50%; }
.ornament span:last-child { transform: rotate(180deg); }
.ornament svg { height: 25px; width: 25px; fill: var(--gold); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.auth-tabs button { background: #0b0a08c0; border: 1px solid #7e684880; color: var(--muted); border-radius: 8px; min-height: 42px; font-size: 16px; }
.auth-tabs button[aria-selected='true'] { color: var(--gold-light); border-color: var(--gold); }
.auth-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.tavern-field > svg, .eye svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tavern .tavern-field input { font-size: 17px; }
.eye { display: flex; align-items: center; justify-content: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--cream); text-shadow: 0 1px 3px #000; padding: 2px 4px; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); flex-shrink: 0; margin: 1px 0 0; }
.hint { font-size: 12px; color: var(--muted); margin: -4px 4px 0; text-shadow: 0 1px 2px #000; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-status { font-size: 14px; padding: 10px 12px; margin: 0; }
.form-status[data-kind='error'] { color: #ffb4ad; border-color: var(--danger); }
.landing footer { margin-top: 14px; text-align: center; }
.age { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid var(--line); border-top-color: var(--gold); border-radius: 50%; font-size: 20px; background: #10101055; }
.landing footer p { font-size: 11px; margin: 6px 0 0; text-transform: uppercase; color: var(--muted); text-shadow: 0 1px 3px #000; }
.turnstile-box { display: flex; justify-content: center; min-height: 0; }

/* ---------- app shell ---------- */
.game-shell { max-width: 480px; margin: auto; min-height: 100svh; display: flex; flex-direction: column; background: inherit; box-shadow: 0 0 60px #0008; position: relative; }
.game-header { position: relative; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: #0b0a08eb; }
.game-logo { width: 34%; max-width: 150px; flex-shrink: 0; }
.game-logo img { width: 100%; height: auto; display: block; }
.tavern-balance { margin-left: auto; font-size: clamp(13px, 3.7vw, 18px); gap: 6px; padding: 5px 7px; }
.tavern-balance strong { font-size: 1.2em; font-weight: 400; }
.tavern-balance .tavern-button--small { width: 28px; min-height: 28px; padding: 0; font-size: 22px; border-radius: 5px; }
.coin { display: grid; place-items: center; background: linear-gradient(120deg, #509c83, #176c5d); color: #e3f2dd; border-radius: 50%; width: 26px; height: 26px; font: bold 18px Georgia, serif; flex-shrink: 0; }
.currency-select { background: #0b0a08; color: var(--gold-light); border: 1px solid var(--line); border-radius: 5px; font-size: 12px; padding: 2px; max-width: 70px; }
.demo-badge { font-size: 11px; color: #181005; background: var(--gold); border-radius: 4px; padding: 1px 5px; letter-spacing: .05em; }
.tavern-menu { display: grid; align-content: center; gap: 6px; min-width: 32px; padding: 5px; }
.tavern-menu span { display: block; width: 24px; height: 2px; background: var(--gold); border-radius: 2px; }
#game-menu { position: absolute; right: 10px; top: 100%; z-index: 30; min-width: 200px; display: grid; gap: 6px; padding: 12px; }
#game-menu a, #game-menu > button { display: block; padding: 9px 6px; text-align: left; background: none; border: 0; color: var(--cream); text-decoration: none; font-size: 16px; border-top: 1px solid #7e684840; }
.menu-langs { display: flex; gap: 6px; }
.game-nav { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); position: sticky; bottom: 0; z-index: 20; border-top: 1px solid #b58d483f; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: #0d0b08f5; }
.game-nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; font: 15px Georgia, serif; color: #aaa69d; text-decoration: none; min-height: 52px; justify-content: center; }
.game-nav [aria-current] { color: var(--gold-light); }
.game-nav svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.game-nav .nav-dice { stroke: none; }
.page { padding: 16px 14px 24px; display: grid; gap: 14px; align-content: start; }
.page-title { margin: 6px 0 0; font-weight: 400; font-size: clamp(30px, 9vw, 42px); line-height: 1.1; text-align: center; color: var(--gold-light); text-shadow: 0 3px 10px #000; }
.page-hero { position: relative; padding: 26px 14px 6px; background: linear-gradient(180deg, #0000 40%, #100e0a), var(--hero) center / cover; }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; width: min(92vw, 440px); padding: 12px 14px; font-size: 15px; text-align: center; }
.toast[data-kind='error'] { color: #ffb4ad; border-color: var(--danger); }
.toast[data-kind='ok'] { color: var(--success); }

/* ---------- game ---------- */
.pirate-scene { position: relative; width: 100%; aspect-ratio: 1 / .9; background: #15110d; overflow: hidden; }
.pirate-scene video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .12s linear; }
.pirate-scene video.is-front { opacity: 1; }
.scene-hud { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 40px 10px 10px; background: linear-gradient(180deg, transparent, #000a 35%, #000d); text-shadow: 0 2px 4px #000; pointer-events: none; }
.scene-caption { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: clamp(15px, 4.4vw, 19px); line-height: 1.2; color: var(--gold-light); }
.scene-caption.is-win { color: var(--gold-light); }
.scene-caption.is-loss { color: #ff8a80; }
.caption-amount { font-size: 1.1em; }
.caption-amount:empty { display: none; }
.scene-hud.no-dice .hud-side { visibility: hidden; }
.hud-side { display: grid; justify-items: center; gap: 2px; min-width: 64px; }
.hud-side small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.dice-pair { display: flex; justify-content: center; gap: 5px; min-height: 30px; align-items: center; }
.die { width: 28px; height: 28px; }
.die.is-rolling { animation: shake .35s ease-in-out infinite; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) translateY(-2px); } 75% { transform: rotate(14deg) translateY(1px); } }
.dice-sum { font-size: 16px; color: var(--cream); }
.betting { padding: 12px 14px 16px; }
.betting .roll-button { margin-bottom: 12px; }
.tavern-bet { grid-template-columns: 1fr auto auto auto; gap: 10px; margin-bottom: 12px; }
.tavern-bet label { font-size: 22px; }
.bet-amount { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; font-size: 18px; color: var(--gold-light); }
.tavern-bet input { width: 74px; font-family: Georgia, serif; font-size: 28px; appearance: textfield; -moz-appearance: textfield; padding: 0; }
.tavern-bet input::-webkit-inner-spin-button, .tavern-bet input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tavern-bet input:focus { outline: none; border-bottom: 1px solid var(--gold); }
.tavern-bet .tavern-button--small { width: 44px; min-height: 44px; font-size: 28px; font-weight: 400; }
.quick-bets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: -2px 0 12px; }
.quick-bets button { min-height: 36px; font-size: 15px; color: var(--cream); background: #0b0a08c0; border: 1px solid #7e684880; border-radius: 7px; }
.roll-button { font-size: 21px; min-height: 60px; letter-spacing: 0; }
.roll-button svg { width: 32px; height: 32px; }
.rules { text-align: center; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 14px 4px; color: var(--cream); text-decoration: none; border-top: 1px solid #b58d4830; margin: 4px 14px 0; font-size: 17px; }
.link-row svg { width: 20px; height: 20px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---------- lists, cards, forms ---------- */
.card { padding: 16px; }
.card h2, .card h3 { margin: 0 0 10px; font-weight: 400; color: var(--gold-light); }
.big-balance { display: flex; align-items: center; gap: 14px; }
.big-balance .coin { width: 54px; height: 54px; font-size: 34px; }
.big-balance small { display: block; color: var(--muted); font-size: 14px; }
.big-balance strong { display: block; font-weight: 400; color: var(--gold-light); font-size: clamp(28px, 8vw, 38px); line-height: 1.15; }
.row-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-actions .tavern-button { min-height: 50px; font-size: 16px; }
.net-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.net-row small { display: block; color: var(--muted); font-size: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 2px -4px; }
.section-head h2 { margin: 0; font-weight: 400; font-size: 22px; }
.list { display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { display: block; color: var(--muted); font-size: 12px; }
.list-item .amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plus { color: var(--success); }
.minus { color: var(--cream); }
.op-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 17px; flex-shrink: 0; }
.op-icon.in { color: var(--success); border-color: #75cbaa80; }
.op-icon.out { color: var(--danger); border-color: #ef514780; }
.op-icon.win { color: var(--gold); border-color: #deb46b80; }
.form { display: grid; gap: 10px; }
.form label > span { display: block; font-size: 14px; color: var(--muted); margin: 0 0 4px 2px; }
.form .tavern-field { min-height: 48px; }
.form .tavern-field input { padding: 11px 0; font-size: 16px; }
.form .tavern-button { min-height: 48px; font-size: 16px; }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.warn { font-size: 14px; color: var(--gold-light); margin: 0; }
.address-box { word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: 14px; padding: 10px; background: #0007; border-radius: 6px; border: 1px dashed var(--line); }
.qr { width: 180px; height: 180px; margin: 6px auto; display: block; background: #fff; border-radius: 8px; padding: 6px; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.small-btn { background: transparent; color: var(--gold-light); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; }

/* ---------- profile ---------- */
.avatar { width: 116px; height: 116px; border-radius: 50%; margin: 6px auto 8px; display: grid; place-items: center; border: 3px double var(--gold); box-shadow: 0 0 0 5px #332414, 0 6px 22px #0009; background: radial-gradient(circle at 50% 35%, #3a2a17, #0c0a07); overflow: hidden; }
.avatar img { width: 82%; }
.profile-name { text-align: center; font-size: 28px; margin: 0; }
.profile-sub { text-align: center; color: var(--muted); margin: 2px 0 0; font-size: 15px; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; padding: 14px 8px; }
.stat-tiles > div { display: grid; justify-items: center; }
.stat-tiles > div + div { border-left: 1px solid #b78b4438; }
.stat-tiles small { color: var(--muted); font-size: 14px; }
.stat-tiles strong { font-weight: 400; font-size: 34px; color: var(--gold-light); line-height: 1.1; }
details.tavern-panel { padding: 0; }
details > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px; cursor: pointer; font-size: 18px; }
details > summary::-webkit-details-marker { display: none; }
details > summary svg { width: 20px; height: 20px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform .15s; }
details[open] > summary svg { transform: rotate(90deg); }
details > .details-body { padding: 0 16px 16px; display: grid; gap: 14px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; color: var(--cream); }
.game-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 12px; }
.game-row .rounds { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.qr-2fa { width: 190px; height: 190px; background: #fff; padding: 6px; border-radius: 8px; margin: 0 auto; }
.qr-2fa svg { width: 100%; height: 100%; }

@media (max-width: 359px) {
  .game-header { padding-inline: 8px; gap: 5px; }
  .game-logo { width: 30%; }
  .tavern-bet label { font-size: 19px; }
  .roll-button { font-size: 18px; }
}
@media (max-height: 700px) and (max-width: 699px) {
  .welcome { padding-top: 30px; }
  .welcome h1 { font-size: clamp(30px, 8.5vw, 42px); }
}
#verify-result { white-space: pre-line; word-break: break-all; font-size: 13px; }
