:root {
    --bg: #100316; --panel: rgba(41, 12, 49, .86); --panel2: rgba(68, 20, 70, .72);
    --line: rgba(255,255,255,.13); --text: #fff7ff; --muted: #bdaec4;
    --gold: #ffd46b; --pink: #fa4fc2; --violet: #8d56ff; --red: #ff665e;
    --paper: #fff8e8; --ink: #241523; --success: #75e2ae; --warning: #ffc66d;
    --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
    font-family: Inter, ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; border: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.hidden { display: none !important; }
#app, .screen { width: 100%; height: 100%; min-height: 0; }
.screen { position: relative; background: radial-gradient(circle at 50% 12%, #40114b 0, #16051d 42%, #09020d 100%); }
.menu-screen::before, .game-screen::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(135deg, rgba(255,255,255,.025), transparent 35%); }
.menu-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: calc(24px + var(--safe-t)) max(20px, env(safe-area-inset-right)) calc(30px + var(--safe-b)) max(20px, env(safe-area-inset-left)); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 22px; margin-top: 2vh; }
.brand h1 { margin: 0; font-size: clamp(58px, 13vw, 104px); line-height: .8; letter-spacing: -.08em; text-shadow: 0 0 26px rgba(250,79,194,.7); }
.brand p { margin: 11px 0 0; color: #e4c7e8; font-size: clamp(14px, 2vw, 20px); }
.brand-cards { position: relative; width: 112px; height: 126px; flex: none; }
.brand-cards i { position: absolute; display: block; width: 78px; height: 112px; padding: 9px; border-radius: 11px; color: #d5303a; background: #fff; box-shadow: 0 12px 35px #0008; font-size: 22px; font-style: normal; font-weight: 900; transform: rotate(-10deg); }
.brand-cards i:nth-child(2) { left: 40px; top: 6px; transform: rotate(11deg); }
.brand-cards span { display: block; font-size: 22px; }
.target { margin: -4px 0 2px; color: var(--gold); font-weight: 700; text-align: center; }
.menu-actions { display: grid; width: min(520px, 100%); gap: 10px; }
.primary, .secondary { min-height: 52px; border-radius: 16px; padding: 12px 18px; font-weight: 800; transition: transform .12s, filter .12s; }
.primary { background: linear-gradient(135deg, var(--pink), var(--violet)); box-shadow: 0 10px 28px rgba(150,58,220,.3); }
.secondary { background: rgba(255,255,255,.09); border: 1px solid var(--line); }
.primary:active, .secondary:active { transform: scale(.98); }
.primary:disabled { opacity: .45; cursor: default; }
.menu-actions button { display: flex; flex-direction: column; align-items: flex-start; }
.menu-actions button b { font-size: 18px; }.menu-actions button small { opacity: .74; margin-top: 3px; }
.panel.daily-card { background: linear-gradient(145deg,rgba(255,248,232,.98),rgba(239,224,199,.96)); color: var(--ink); box-shadow: 0 14px 50px #0006, inset 0 0 0 1px #fff9; }
.daily-heading { display: flex; justify-content: space-between; gap: 14px; align-items: start; border-bottom: 1px solid #5b3b4b2b; padding-bottom: 10px; }
.daily-heading h2 { margin: 4px 0 0; color: var(--ink); font-size: 16px; letter-spacing: 0; text-transform: none; }
.daily-heading > b { color: #7b5061; font-size: 12px; font-variant-numeric: tabular-nums; }
.eyebrow { color: #884f68; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.daily-objective { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 8px; }
.daily-objective > span, .daily-streak { color: #765766; font-size: 13px; }.daily-objective strong { font-size: 28px; font-variant-numeric: tabular-nums; }.daily-objective small { font-size: 12px; }
.daily-streak { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }.daily-streak b { color: #4c2940; }
.daily-card .secondary { width: 100%; color: #fff; background: #4c2940; border-color: #4c2940; }
.daily-card.completed .secondary { color: #234b38; background: #bfe9d1; border-color: #8ac9a7; }
.menu-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.panel { width: min(520px, 100%); border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: var(--panel); box-shadow: 0 14px 50px #0005; backdrop-filter: blur(14px); }
.panel h2 { margin: 0 0 12px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.segments button { min-height: 44px; border-radius: 12px; background: rgba(255,255,255,.06); color: var(--muted); font-weight: 750; }
.segments button.active { color: #25112a; background: var(--gold); }
.menu-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px; }
.menu-stats div { text-align: center; border-right: 1px solid var(--line); }.menu-stats div:last-child { border: 0; }
.menu-stats b { display: block; color: var(--gold); font-size: 23px; }.menu-stats span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.text-btn { min-height: 44px; padding: 10px 18px; background: none; color: #e9cfee; text-decoration: underline; text-underline-offset: 4px; }

.game-screen { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; padding: calc(8px + var(--safe-t)) max(10px, env(safe-area-inset-right)) calc(8px + var(--safe-b)) max(10px, env(safe-area-inset-left)); gap: 7px; overflow: hidden; }
.game-header { height: 46px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 13px; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.back-btn span { width: 11px; height: 11px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: 4px; }
.sound-btn svg { width: 24px; height: 24px; fill: currentColor; }
.sound-btn .sound-waves, .sound-btn .sound-off { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sound-btn .sound-off { display: none; }.sound-btn.muted .sound-waves { display: none; }.sound-btn.muted .sound-off { display: block; }
.round-label { text-align: center; }.round-label b { font-size: 14px; }.round-label small { display: block; color: var(--muted); max-width: 65vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scoreboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.score-item { min-width: 0; padding: 7px 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.22); text-align: center; }
.score-item.active { border-color: var(--gold); box-shadow: 0 0 0 1px #ffd46b44 inset; }
.score-item span { display: block; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-item b { font-size: 18px; }.score-item i { color: var(--red); font-size: 10px; font-style: normal; }
.tutorial-strip { position: absolute; z-index: 24; top: calc(58px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(620px,calc(100% - 24px)); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #efcf81; border-radius: 14px; color: var(--ink); background: var(--paper); box-shadow: 0 12px 40px #0009; }
.tutorial-strip b { font-size: 12px; color: #8a4e66; text-transform: uppercase; letter-spacing: .08em; }.tutorial-strip p { margin: 3px 0 0; font-size: 13px; }.tutorial-strip .text-btn { flex: none; min-height: 44px; color: #6f4155; }
.opponents { display: flex; justify-content: space-around; min-height: 52px; }
.opponent { display: flex; align-items: center; gap: 8px; min-width: 112px; padding: 6px 10px; border-radius: 15px; background: rgba(255,255,255,.065); border: 1px solid transparent; }
.opponent.active { border-color: var(--gold); }.avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg,#fc6,#d56cff); color: #2b122e; font-weight: 900; }
.opponent b { display: block; font-size: 12px; }.opponent small { color: var(--muted); font-size: 10px; }
.table { position: relative; min-height: 0; border: 1px solid #ffffff17; border-radius: 28px; background: radial-gradient(circle, #2f704e 0, #17472f 62%, #0c2b1d 100%); box-shadow: inset 0 0 80px #0008, 0 18px 50px #0005; overflow: hidden; }
.table-topline { position: absolute; inset: 10px 12px auto; display: flex; justify-content: space-between; z-index: 2; }
.table-topline span { padding: 5px 9px; border-radius: 99px; background: #051b12aa; color: var(--gold); font-size: 11px; font-weight: 800; }
.trick { position: absolute; inset: 34px 10px 33px; display: flex; justify-content: center; align-items: center; }
.played-card { position: absolute; width: clamp(62px, 19vw, 94px); aspect-ratio: .69; border-radius: 10px; transform: translate(var(--x),var(--y)) rotate(var(--r)); }
.played-card:nth-child(1) { --x: 0px; --y: -24px; --r: -4deg; }.played-card:nth-child(2) { --x: -42px; --y: 30px; --r: -11deg; }.played-card:nth-child(3) { --x: 42px; --y: 30px; --r: 10deg; }
.table-message { position: absolute; bottom: 8px; left: 8px; right: 8px; text-align: center; font-size: 12px; color: #e1f4e7; }
.card { position: relative; flex: none; width: clamp(57px, 16vw, 82px); aspect-ratio: .69; border-radius: 10px; color: #17121b; background: linear-gradient(145deg,#fff,#eee9f1); box-shadow: 0 8px 20px #0007; border: 2px solid #fff; user-select: none; }
.card.red { color: #d92e3b; }.card .corner { position: absolute; top: 5px; left: 6px; font-size: clamp(15px,4vw,21px); line-height: .85; font-weight: 900; }.card .corner span { display: block; font-size: .8em; }.card .suit { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(30px,9vw,47px); }
.card.selected { transform: translateY(-14px); box-shadow: 0 0 0 3px var(--gold),0 12px 25px #0008; }.card.hint { animation: hint 1s ease infinite; }
@keyframes hint { 50% { box-shadow: 0 0 0 5px #7cffb6,0 12px 25px #0008; transform: translateY(-10px); } }
.card.invalid { opacity: .48; filter: saturate(.4); }
.card.back { background: repeating-linear-gradient(45deg,#5b1764 0 7px,#7f2381 7px 14px); border-color: #d9a7e3; }
.card.back::after { content: "1000"; position: absolute; inset: 7px; display: grid; place-items: center; border: 1px solid #ffffff88; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 900; }
.hand-wrap { min-height: 91px; overflow: visible; }.hand { height: 100%; display: flex; justify-content: center; align-items: flex-end; padding-top: 15px; }
.hand .card { margin-left: clamp(-25px,-5.2vw,-12px); }.hand .card:first-child { margin-left: 0; }
.hint-btn { justify-self: center; min-height: 44px; border-radius: 99px; padding: 8px 16px; background: rgba(255,255,255,.09); color: var(--muted); }
.phase-panel { position: absolute; z-index: 10; left: 50%; bottom: calc(105px + var(--safe-b)); transform: translateX(-50%); width: min(440px, calc(100% - 24px)); max-height: min(48vh, 390px); overflow-y: auto; padding: 16px; border: 1px solid #ffffff2b; border-radius: 20px; background: rgba(27,6,32,.96); box-shadow: 0 20px 70px #000b; }
.phase-panel h2 { margin: 0 0 6px; }.phase-panel p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }.phase-panel input { width: 100%; accent-color: var(--pink); }.phase-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; margin-top: 12px; }
.bid-value { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }.bid-value span { color: var(--muted); }.bid-value b { color: var(--gold); font-size: 25px; }
.talon { display: flex; justify-content: center; gap: 8px; margin: 10px 0 8px; }.talon-card { cursor: pointer; }.talon-card.selected { transform: translateY(-8px); }.talon-selection { min-height: 20px; margin: 0 0 10px !important; text-align: center; color: var(--gold) !important; font-weight: 800; }.talon-selection + button { width: 100%; }

.modal { position: fixed; z-index: 50; inset: 0; padding: calc(18px + var(--safe-t)) 18px calc(18px + var(--safe-b)); display: grid; place-items: center; background: #09020dd9; backdrop-filter: blur(12px); }
.modal-card { width: min(500px,100%); max-height: 100%; overflow-y: auto; padding: 22px; border-radius: 24px; background: linear-gradient(155deg,#3b1043,#1b071f); border: 1px solid var(--line); box-shadow: 0 30px 100px #000c; }
.modal-card h2 { margin: 0 0 14px; }.modal-card > button { width: 100%; margin-top: 12px; }.rules-copy { color: #e8dce9; line-height: 1.55; }.rules-copy b { color: var(--gold); }
.result-card { text-align: center; }.result-icon { display: inline-grid; min-height: 40px; place-items: center; padding: 8px 16px; border: 1px solid var(--gold); border-radius: 12px; color: var(--gold); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }.result-card p { color: var(--muted); }.result-scores { display: grid; gap: 5px; margin: 12px 0; }.result-scores div { display: flex; justify-content: space-between; padding: 8px 11px; border-radius: 10px; background: rgba(255,255,255,.06); }
.result-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }.result-metrics div { padding: 9px; border: 1px solid var(--line); border-radius: 12px; }.result-metrics span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }.result-metrics b { display: block; margin-top: 3px; font-size: 18px; font-variant-numeric: tabular-nums; }
.result-progress { height: 8px; margin: 10px 0 0; overflow: hidden; border-radius: 99px; background: #ffffff18; }.result-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--pink),var(--gold)); transition: width .35s ease; }
.result-reward { min-height: 20px; margin: 10px 0 0; color: var(--success) !important; font-weight: 800; }
.result-actions { display: grid; gap: 8px; }.result-actions > button { width: 100%; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); max-width: calc(100% - 30px); padding: 10px 15px; border-radius: 12px; background: #fff; color: #251229; font-weight: 800; box-shadow: 0 12px 40px #0008; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

@media (min-width: 760px) {
    .game-screen { max-width: 980px; margin: auto; grid-template-rows: auto auto auto minmax(260px,1fr) auto auto; padding-left: 20px; padding-right: 20px; }
    .hand .card { margin-left: -17px; }.table { min-height: 280px; }.phase-panel { bottom: 125px; }
}
@media (max-height: 620px) {
    .game-screen { gap: 4px; }.game-header { height: 44px; }.opponents { min-height: 42px; }.opponent { padding: 3px 7px; }.avatar { width: 27px; height: 27px; }
    .score-item { padding: 4px 6px; }.score-item b { font-size: 15px; }.hand-wrap { min-height: 73px; }
    .phase-panel { bottom: calc(82px + var(--safe-b)); max-height: 55vh; }.card { width: clamp(48px,14vw,67px); }.played-card { width: clamp(50px,16vw,72px); }.tutorial-strip { top: calc(51px + var(--safe-t)); }
}
@media (orientation: landscape) and (max-height: 480px) {
    .game-screen { max-width: none; grid-template-columns: 170px 1fr 230px; grid-template-rows: auto auto minmax(0,1fr) auto; gap: 5px; }
    .game-header { grid-column: 1 / 4; }.scoreboard { grid-column: 1; grid-row: 2 / 4; display: flex; flex-direction: column; }.opponents { grid-column: 2; grid-row: 2; }
    .table { grid-column: 2; grid-row: 3 / 5; }.hand-wrap { grid-column: 3; grid-row: 2 / 4; min-height: 0; overflow-y: auto; }.hand { flex-wrap: wrap; align-content: center; padding: 2px; }
    .hand .card { margin: 2px -10px 2px 0; width: 58px; }.hint-btn { grid-column: 3; grid-row: 4; }.phase-panel { left: auto; right: 12px; bottom: 50px; transform: none; width: 300px; }
    .tutorial-strip { top: calc(50px + var(--safe-t)); width: min(500px,calc(100% - 360px)); }
}
