/* Elyndra Pool — Copyright (c) 2026 Nahrul Kawaiiverse. All rights reserved. */
:root {
  --bg: #0b0a12; --panel: #1d1a2c; --panel2: #29243d; --line: #3a3355;
  --gold: #e8bd5c; --gold2: #b8893a; --text: #f3ede0; --muted: #a8a0b9; --good: #6fd08c; --bad: #ef6f6f;
  --safe-top: env(safe-area-inset-top, 0px); --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
body { background: radial-gradient(110% 80% at 20% 0%, #1f4a3a 0%, var(--bg) 55%) fixed; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }
#app { min-height: 100%; }
.screen { min-height: 100dvh; padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) 16px calc(16px + var(--safe-left));
  display: flex; flex-direction: column; gap: 12px; max-width: 1100px; margin: 0 auto; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Home */
.home-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; align-items: start; }
.logo { text-align: center; }
.crest { font-size: 44px; filter: drop-shadow(0 0 16px rgba(232,189,92,.5)); }
.logo h1 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 40px; letter-spacing: 2px;
  background: linear-gradient(#fff3cf, var(--gold) 55%, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo h1 span { display: block; font-size: 16px; letter-spacing: 10px; color: #bfe3cf; -webkit-text-fill-color: #bfe3cf; }
.tag { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.profile-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: linear-gradient(135deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.profile-card img { width: 52px; height: 52px; border-radius: 12px; border: 2px solid var(--gold2); object-fit: cover; }
.pc-text { flex: 1; min-width: 0; }
.pc-text b { display: block; font-size: 17px; }
.pc-text small { color: var(--gold); font-size: 12px; }
.xpbar { height: 6px; background: #0005; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold2), #ffe08a); }
.pc-coins { text-align: center; }
.pc-coins b { display: block; font-size: 20px; color: var(--gold); }
.pc-coins b::before { content: "🪙 "; font-size: 15px; }
.pc-coins small { color: var(--muted); font-size: 11px; }
.daily { margin-top: 10px; width: 100%; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 14px;
  background: linear-gradient(135deg, #2f5b3c, #1d3a27); border: 1px solid #4f8a62; font-size: 14px; }
.daily.taken { opacity: .55; }
.menu { display: flex; flex-direction: column; gap: 9px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.row button { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 11px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px; }
.row .ic { font-size: 22px; }
.big { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 14px; font-size: 16px; transition: transform .1s; }
.big:active, .row button:active { transform: scale(.98); }
.big .ic { font-size: 26px; width: 34px; text-align: center; }
.big small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.big.gold { background: linear-gradient(135deg, #f1cf78, #b8893a); color: #24180a; border: 0; box-shadow: 0 6px 18px rgba(232,189,92,.25); }
.big.gold small { color: #4a3615; }
.foot { margin-top: auto; text-align: center; color: var(--muted); font-size: 11px; opacity: .8; }
.watermark { position: fixed; right: calc(10px + var(--safe-right)); bottom: 6px; font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: rgba(255, 240, 210, 0.28); pointer-events: none; z-index: 70; font-weight: bold; }
.pl.ghost { visibility: hidden; }
#game:not(.hidden) ~ .toast { bottom: 64px; }
.rotate-overlay { display: none; position: fixed; inset: 0; z-index: 90; background: rgba(8, 7, 14, 0.96); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; }
.rotate-overlay .rot-ic { font-size: 56px; animation: rot 1.8s ease-in-out infinite; }
.rotate-overlay small { color: var(--muted); }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 760px) { #game:not(.hidden) ~ .rotate-overlay { display: flex; } }
#game:not(.hidden) ~ .watermark { display: none; } /* the table rail carries the studio mark */

/* Lists */
.bar { display: flex; align-items: center; gap: 8px; }
.bar h2 { margin: 0; font-size: 20px; flex: 1; }
.back { font-size: 30px; width: 40px; height: 40px; line-height: 36px; border-radius: 12px; background: var(--panel); }
.coins-pill { background: var(--panel); border-radius: 999px; padding: 6px 12px; color: var(--gold); font-weight: bold; }
.coins-pill::before { content: "🪙 "; }
.seg { display: flex; background: #0006; border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 9px; font-size: 14px; color: var(--muted); min-width: 70px; }
.seg button.on { background: var(--panel2); color: var(--gold); font-weight: bold; box-shadow: inset 0 0 0 1px var(--gold2); }
.venue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.venue { border-radius: 16px; padding: 12px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.venue::before { content: ""; position: absolute; inset: 0; background: var(--felt, #1f6f4a); opacity: .18; }
.venue > * { position: relative; }
.venue h3 { margin: 0; font-size: 16px; }
.venue small { color: var(--gold); font-size: 12px; }
.venue.locked { opacity: .45; }
.opps { display: flex; gap: 8px; }
.opp { flex: 1; display: flex; align-items: center; gap: 8px; background: #0005; border-radius: 12px; padding: 6px 8px; text-align: left; border: 1px solid transparent; }
.opp:hover, .opp:active { border-color: var(--gold2); }
.opp img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.opp b { display: block; font-size: 14px; }
.opp span { font-size: 11px; color: var(--muted); }
.opp .done { color: var(--good); }
.setup { display: flex; flex-direction: column; gap: 8px; background: var(--panel); border-radius: 16px; padding: 14px; border: 1px solid var(--line); max-width: 560px; }
.setup label { font-size: 12px; color: var(--muted); }
.setup input, .settings input { background: #0006; border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--text); width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.tile { background: var(--panel); border-radius: 12px; padding: 12px 6px; text-align: center; border: 1px solid var(--line); }
.tile b { display: block; font-size: 18px; }
.tile small { color: var(--muted); font-size: 11px; }
.tile.done { border-color: var(--good); }
.tile.done b::after { content: " ✓"; color: var(--good); }
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.item { background: var(--panel); border-radius: 14px; padding: 12px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.item.on { border-color: var(--gold); }
.item h4 { margin: 0; font-size: 15px; }
.swatch { height: 46px; border-radius: 10px; }
.cuepic { height: 14px; border-radius: 7px; margin: 14px 0; }
.statbar { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.statbar i { display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--gold2), #ffe08a); }
.item button { background: var(--panel2); border-radius: 10px; padding: 9px; font-weight: bold; border: 1px solid var(--line); }
.item button.gold { background: linear-gradient(135deg, #f1cf78, #b8893a); color: #24180a; border: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.stat { background: var(--panel); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--gold); }
.stat small { color: var(--muted); font-size: 11px; }
.section-title { margin: 14px 0 6px; font-size: 14px; color: var(--gold); letter-spacing: 1px; text-transform: uppercase; }
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ach div { background: var(--panel); border-radius: 12px; padding: 9px 10px; display: flex; gap: 9px; align-items: center; opacity: .4; }
.ach div.got { opacity: 1; border: 1px solid var(--gold2); }
.ach .ai { font-size: 22px; }
.ach b { font-size: 13px; display: block; }
.ach small { font-size: 11px; color: var(--muted); }
.settings { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.opt { background: var(--panel); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.opt > span { font-size: 13px; color: var(--muted); }
.danger { background: #3b1c22; color: #ffb3b8; border-radius: 12px; padding: 12px; }
.bracket { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: center; }
.bracket .col { display: flex; flex-direction: column; gap: 6px; }
.match { background: var(--panel); border-radius: 10px; padding: 6px 8px; font-size: 12px; border: 1px solid var(--line); }
.match div { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.match img { width: 20px; height: 20px; border-radius: 5px; }
.match .w { color: var(--gold); font-weight: bold; }
.match .me { color: #bfe3cf; }
.match .out { opacity: .4; text-decoration: line-through; }

/* Game */
#game { padding: 0; max-width: none; position: fixed; inset: 0; min-height: 0; gap: 0; touch-action: none; overflow: hidden;
  background: radial-gradient(120% 120% at 50% 40%, #241d33, #08070c 70%); }
canvas#table { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; top: calc(4px + var(--safe-top)); left: calc(8px + var(--safe-left)); right: calc(8px + var(--safe-right)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; z-index: 5; }
.hud .pl { display: flex; align-items: center; gap: 8px; background: rgba(15, 12, 24, 0.82); border-radius: 14px; padding: 5px 10px; border: 1px solid transparent; min-width: 0; max-width: 40%; }
.hud .pl.turn { border-color: var(--gold); box-shadow: 0 0 14px rgba(232, 189, 92, 0.35); }
.hud .pl img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.hud .pl b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud .pl.right { text-align: right; }
.grp { display: flex; gap: 2px; font-size: 11px; color: var(--muted); }
.pl.right .grp { justify-content: flex-end; }
.grp i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: inset -2px -2px 3px rgba(0,0,0,.35); }
.grp i.stripe { background-image: linear-gradient(transparent 28%, var(--c) 28%, var(--c) 72%, transparent 72%) !important; background-color: #f4f1e8 !important; }
.grp i.gone { opacity: .2; }
.mid { display: flex; flex-direction: row; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }
#gMenu { background: rgba(15, 12, 24, 0.82); border-radius: 10px; width: 38px; height: 32px; font-size: 18px; }
#gStatus { font-size: 12px; color: #f3ede0; background: rgba(15, 12, 24, 0.7); padding: 3px 10px; border-radius: 999px; text-align: center; max-width: 42vw; }
#gTimer { font-size: 12px; color: var(--gold); }
.power { position: absolute; left: calc(10px + var(--safe-left)); top: 50%; transform: translateY(-45%); width: 46px; height: min(60vh, 300px); z-index: 6;
  display: flex; flex-direction: column; align-items: center; gap: 4px; touch-action: none; }
.power .track { flex: 1; width: 22px; border-radius: 12px; background: rgba(15, 12, 24, 0.85); border: 1px solid var(--gold2); overflow: hidden; position: relative; }
.power .track i { position: absolute; left: 0; right: 0; top: 0; height: 0; background: linear-gradient(#ffe08a, #e8bd5c 40%, #ef6f3f); }
.power span { color: var(--gold); font-size: 12px; }
.power.off { opacity: .35; pointer-events: none; }
.side { position: absolute; right: calc(10px + var(--safe-right)); top: 50%; transform: translateY(-45%); display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 6; }
.spinbtn { width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #d9d4c6 70%, #a9a394); position: relative; border: 2px solid var(--gold2); }
.spinbtn i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #d8322a; left: calc(50% - 5px); top: calc(50% - 5px); }
.fine { width: 34px; height: min(42vh, 210px); border-radius: 10px; background: rgba(15, 12, 24, 0.85); border: 1px solid var(--line); overflow: hidden; touch-action: none; }
#fineStripes { width: 100%; height: 300%; margin-top: -100%; background: repeating-linear-gradient(#5a5070 0 2px, transparent 2px 12px); }
.small { width: 40px; height: 40px; border-radius: 12px; background: rgba(15, 12, 24, 0.85); font-size: 20px; border: 1px solid var(--line); }
.banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); background: rgba(15, 12, 24, 0.9); border: 1px solid var(--gold2); color: var(--gold);
  padding: 10px 20px; border-radius: 14px; font-weight: bold; font-size: 17px; z-index: 8; pointer-events: none; text-align: center; animation: pop .25s ease; }
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.speech { position: absolute; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(560px, 80vw); background: #f4ecd9; color: #2a1d10;
  border-radius: 12px; padding: 8px 12px; font-size: 13px; z-index: 8; pointer-events: none; box-shadow: 0 6px 18px #0008; }

/* Modal, toast */
.modal { position: fixed; inset: 0; background: rgba(5, 3, 10, .72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.card { background: linear-gradient(160deg, var(--panel2), var(--panel)); border: 1px solid var(--gold2); border-radius: 18px; padding: 16px 18px; width: min(440px, 100%); max-height: 92dvh; overflow-y: auto; text-align: center; box-shadow: 0 20px 50px #000a; animation: fade .2s; }
.card h3 { margin: 4px 0 6px; font-size: 22px; color: var(--gold); font-family: Georgia, serif; }
.card p { margin: 6px 0; font-size: 14px; }
.card .sub { color: var(--muted); font-size: 13px; }
.card .btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.card .btns button { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 11px; font-weight: bold; }
.card .btns button.gold { background: linear-gradient(135deg, #f1cf78, #b8893a); color: #24180a; border: 0; }
.card img.face { width: 76px; height: 76px; border-radius: 16px; border: 2px solid var(--gold2); }
.reward { display: flex; justify-content: center; gap: 14px; margin: 10px 0; }
.reward div { background: #0003; border-radius: 10px; padding: 8px 12px; }
.reward b { display: block; font-size: 18px; color: var(--gold); }
.reward small { color: var(--muted); font-size: 11px; }
.newach { background: #0003; border-radius: 10px; padding: 6px 10px; margin: 4px 0; font-size: 13px; }
.spinpad { width: 200px; height: 200px; margin: 6px auto; border-radius: 50%; background: radial-gradient(circle at 38% 35%, #fff, #e3ddcd 60%, #a9a394); position: relative; touch-action: none; border: 3px solid var(--gold2); }
.spinpad i { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #d8322a; border: 2px solid #fff; transform: translate(-50%, -50%); }
.spinpad::after { content: ""; position: absolute; inset: 50% 0 auto 0; border-top: 1px dashed #0003; }
.spinpad::before { content: ""; position: absolute; inset: 0 auto 0 50%; border-left: 1px dashed #0003; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--gold2); padding: 10px 16px; border-radius: 12px; z-index: 60; font-size: 14px; max-width: 90vw; text-align: center; }
.rotate-hint { color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 760px) {
  .home-grid { grid-template-columns: 1fr; }
  .bracket { grid-template-columns: 1fr; }
}
@media (max-height: 460px) {
  .card { padding: 12px 16px; }
  .card h3 { font-size: 19px; margin: 2px 0 4px; }
  .card img.face { width: 50px; height: 50px; }
  .card p { margin: 3px 0; font-size: 13px; }
  .card .btns { flex-direction: row; }
  .card .btns button { flex: 1; padding: 9px; }
  .reward { margin: 6px 0; }
  .reward div { padding: 5px 10px; }
  .newach { padding: 4px 8px; margin-top: 4px; font-size: 12px; }
  .bracket .col { gap: 4px; }
  .match { padding: 3px 8px; font-size: 11px; }
  .match div { padding: 1px 0; }
  .match img { width: 16px; height: 16px; }
  .logo h1 { font-size: 30px; }
  .crest { font-size: 30px; }
  .tag { margin-bottom: 6px; }
  .big { padding: 9px 12px; font-size: 15px; }
  .big .ic { font-size: 22px; }
  .row button { padding: 7px 4px; }
}

/* Watch-to-claim reward (web version, games/shared/reward.js) */
.reward-btn { width: 100%; margin-top: 9px; border: 0; border-radius: 14px; padding: 12px; font-weight: 800; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #ff8fc8, #7b5cff); box-shadow: 0 6px 18px rgba(255, 143, 200, .3); }
