/* Couples Battleships */
:root {
  --bg: #060a18;
  --panel: rgba(17, 26, 54, .78);
  --panel-solid: #111a36;
  --line: rgba(130, 175, 255, .16);
  --cyan: #38e1ff;
  --pink: #ff4d7d;
  --gold: #ffc857;
  --green: #4ade80;
  --text: #eaf1ff;
  --mute: #8d9cc2;
  --display: 'Chakra Petch', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  color: var(--text); font: 16px/1.45 var(--body);
  overscroll-behavior-y: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

/* ---------- backdrop ---------- */
.ocean { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(56, 225, 255, .16), transparent 60%),
    radial-gradient(90% 60% at 100% 100%, rgba(255, 77, 125, .16), transparent 60%),
    linear-gradient(180deg, #0a1230 0%, #060a18 60%, #04060f 100%); }
.ocean i { position: absolute; left: -50%; width: 200%; height: 46%; bottom: -6%; opacity: .35;
  background: repeating-linear-gradient(100deg, transparent 0 46px, rgba(56, 225, 255, .05) 46px 48px);
  animation: drift 26s linear infinite; }
.ocean i + i { bottom: auto; top: -6%; opacity: .22; animation-duration: 38s; animation-direction: reverse; }
@keyframes drift { to { transform: translateX(96px); } }

/* ---------- layout ---------- */
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: calc(var(--safe-t) + 10px) 14px calc(var(--safe-b) + 18px); display: flex; flex-direction: column; }

.top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 8px; margin-right: auto;
  font: 700 11px/1.1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.logo { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 0 8px rgba(56, 225, 255, .45)); }
.code-chip { font: 700 17px/1 var(--display); letter-spacing: .18em; padding: 7px 12px 6px; border-radius: 12px;
  background: rgba(56, 225, 255, .1); border: 1px solid rgba(56, 225, 255, .35); color: var(--cyan); text-align: center; }
.code-chip small { display: block; font: 500 8px/1 var(--body); letter-spacing: .08em; color: var(--mute); margin-top: 4px; text-transform: uppercase; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 18px; flex: none; }
.icon-btn:active { transform: scale(.94); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.field-label { display: block; font: 600 11px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); margin-bottom: 8px; }
.input { width: 100%; font: 16px/1.35 var(--body); color: var(--text); background: rgba(4, 8, 22, .6);
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; outline: none; resize: none; -webkit-appearance: none; appearance: none; }
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56, 225, 255, .18); }
.input::placeholder { color: #56648a; }

.btn { display: block; width: 100%; padding: 16px 18px; border-radius: 16px; text-align: center;
  font: 700 16px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; transition: transform .12s, opacity .2s, filter .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; filter: grayscale(.5); }
.btn.primary { background: linear-gradient(135deg, #ff6b9a, #ff2d6f); color: #fff;
  box-shadow: 0 10px 28px -8px rgba(255, 45, 111, .7), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.ghost { background: var(--panel); border: 1px solid var(--line); color: var(--text); letter-spacing: .06em; font-size: 14px; }
.btn.danger { background: rgba(255, 77, 125, .1); border: 1px solid rgba(255, 77, 125, .4); color: #ff8fae; font-size: 14px; }
.btn.loading { opacity: .6; pointer-events: none; }
.link { display: block; margin: 14px auto 0; padding: 10px; color: var(--mute); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.row { display: flex; gap: 10px; margin: 12px 0; }
.row .btn { flex: 1; }
.lead { color: #b9c6e6; font-size: 15px; margin-bottom: 14px; }
.lead b { color: var(--text); }
.fine { color: var(--mute); font-size: 13px; margin-top: 14px; }
.hint { color: var(--mute); font-size: 13px; margin: 10px 0 8px; }
.chip { font-size: 13px; padding: 7px 11px; border-radius: 999px; background: rgba(255, 200, 87, .12); border: 1px solid rgba(255, 200, 87, .4); color: var(--gold); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #55607f; margin: 0 6px; vertical-align: middle; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }

.seg { display: flex; padding: 4px; gap: 4px; border-radius: 14px; background: rgba(4, 8, 22, .6); border: 1px solid var(--line); margin: 14px 0; }
.seg button { flex: 1; padding: 11px 6px; border-radius: 10px; font: 600 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.seg button.on { background: linear-gradient(135deg, rgba(56, 225, 255, .25), rgba(56, 225, 255, .1)); color: var(--text); box-shadow: inset 0 0 0 1px rgba(56, 225, 255, .45); }
.seg.small { margin: 10px 0 8px; }
.seg.small button { padding: 9px 4px; font-size: 12px; }

/* ---------- home ---------- */
.home { margin: auto 0; padding: 10px 0; }
.hero { text-align: center; margin-bottom: 20px; }
.hero-logo .logo { width: 92px; height: 92px; animation: pulse 3.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); filter: drop-shadow(0 0 18px rgba(255, 77, 125, .7)); } }
.hero h1 { font: 700 40px/.95 var(--display); letter-spacing: .04em; text-transform: uppercase; margin: 10px 0 12px; }
.hero h1 span { background: linear-gradient(90deg, var(--cyan), #9f8bff 50%, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: #b9c6e6; max-width: 320px; margin: 0 auto; font-size: 15px; }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 12px; }
.avatar { aspect-ratio: 1; border-radius: 12px; font-size: 22px; background: rgba(4, 8, 22, .5); border: 1px solid transparent; }
.avatar.on { border-color: var(--pink); background: rgba(255, 77, 125, .18); box-shadow: 0 0 14px rgba(255, 77, 125, .45); transform: scale(1.06); }
.modes { display: grid; gap: 10px; margin-bottom: 14px; }
.mode { text-align: left; padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.mode strong { font: 700 16px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.mode span { grid-column: 1; color: var(--mute); font-size: 13px; }
.mode em { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: normal 600 12px var(--display); color: var(--cyan); }
.mode.on { border-color: var(--cyan); background: linear-gradient(135deg, rgba(56, 225, 255, .16), rgba(17, 26, 54, .8)); box-shadow: 0 0 22px -6px rgba(56, 225, 255, .6); }
.code-input { text-align: center; font: 700 28px/1 var(--display); letter-spacing: .4em; text-indent: .4em; text-transform: uppercase; }
.home .card + .btn { margin-top: 14px; }
.install { margin-top: 12px; padding: 12px 14px; border-radius: 14px; font-size: 13px; color: #b9c6e6; background: rgba(255, 200, 87, .08); border: 1px dashed rgba(255, 200, 87, .4); }

/* ---------- lobby / waiting ---------- */
.center-stage { margin: auto 0; text-align: center; padding: 10px 6px 40px; }
.center-stage h2 { font: 700 24px/1.1 var(--display); letter-spacing: .06em; text-transform: uppercase; margin: 22px 0 10px; }
.radar { position: relative; width: 150px; height: 150px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 225, 255, .16), transparent 70%); border: 1px solid rgba(56, 225, 255, .35); display: grid; place-items: center; }
.radar span { font-size: 46px; position: relative; }
.radar i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(56, 225, 255, .5); animation: ping 2.7s ease-out infinite; }
.radar i:nth-child(2) { animation-delay: .9s; }
.radar i:nth-child(3) { animation-delay: 1.8s; }
@keyframes ping { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.big-code { display: flex; justify-content: center; gap: 8px; margin: 18px 0 22px; }
.big-code span { width: 52px; height: 66px; display: grid; place-items: center; border-radius: 14px; font: 700 34px/1 var(--display);
  background: var(--panel); border: 1px solid rgba(56, 225, 255, .4); color: var(--cyan); text-shadow: 0 0 14px rgba(56, 225, 255, .7); }

/* ---------- setup ---------- */
.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.stepper i { flex: 1; height: 1px; background: var(--line); }
.stepper button { display: flex; align-items: center; gap: 7px; font: 600 12px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.stepper b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .08); }
.stepper .on { color: var(--text); }
.stepper .on b { background: var(--pink); box-shadow: 0 0 12px rgba(255, 77, 125, .7); }
.qcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.qhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
  font: 600 12px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.ans { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.radio { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 2px solid #4a587f; position: relative; }
.ans.on .radio { border-color: var(--green); background: rgba(74, 222, 128, .15); }
.ans.on .radio::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--green); font-weight: 700; }
.ans.on .input { border-color: rgba(74, 222, 128, .6); }
.dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0 2px; flex-wrap: wrap; }
.dots button { width: 32px; height: 32px; border-radius: 50%; font: 600 13px var(--display); background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--mute); }
.dots .ok { background: rgba(74, 222, 128, .16); border-color: rgba(74, 222, 128, .6); color: var(--green); }
.dots .cur { box-shadow: 0 0 0 2px var(--cyan); color: var(--text); }
.tray { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tray-ship { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 12px; font-size: 13px; background: var(--panel); border: 1px solid var(--line); color: var(--mute); }
.tray-ship.on { border-color: var(--gold); color: var(--text); box-shadow: 0 0 14px -4px var(--gold); }
.tray-ship .pips { display: flex; gap: 2px; }
.tray-ship .pips i { width: 7px; height: 12px; border-radius: 2px; background: #8ea2cf; }
.partner-status { text-align: center; color: var(--mute); font-size: 13px; margin-top: 16px; }
.partner-status b { color: var(--green); }

/* ---------- boards ---------- */
.board { display: grid; grid-template-columns: 16px 1fr; grid-template-rows: 16px 1fr; width: min(100%, calc(100dvh - 380px)); min-width: 270px; margin: 0 auto; }
.setup .board { width: min(100%, calc(100dvh - 400px)); }
.cols, .rows { display: flex; font: 600 9px/1 var(--display); color: #6b7ba6; }
.cols { grid-column: 2; }
.rows { grid-row: 2; flex-direction: column; }
.cols span, .rows span { flex: 1; display: grid; place-items: center; }
.sea { grid-column: 2; grid-row: 2; position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #12306a, #0a1840 60%, #07102c);
  border: 1px solid rgba(56, 225, 255, .35); box-shadow: 0 0 34px -10px rgba(56, 225, 255, .55), inset 0 0 40px rgba(0, 0, 0, .45); transition: border-color .3s, box-shadow .3s; }
.board[data-kind="mine"] .sea { border-color: rgba(255, 77, 125, .4); box-shadow: 0 0 34px -10px rgba(255, 77, 125, .5), inset 0 0 40px rgba(0, 0, 0, .45); }
.board.live .sea { border-color: var(--cyan); }
.sweep { position: absolute; inset: -22%; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 300deg, rgba(56, 225, 255, .28) 360deg); animation: spin 4.500s linear infinite; }
.board[data-kind="enemy"] .sweep { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
#grid-slot, .grid { position: absolute; inset: 0; }
.grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); }
.cell { position: relative; box-shadow: inset -1px -1px 0 rgba(130, 175, 255, .13); display: grid; place-items: center; }
.board.live .cell:not(.miss):not(.hit):active { background: rgba(56, 225, 255, .25); }
.cell i { display: block; position: relative; z-index: 2; }
.cell.miss i { width: 26%; height: 26%; border-radius: 50%; background: rgba(210, 228, 255, .75); box-shadow: 0 0 0 3px rgba(210, 228, 255, .16); }
.cell.hit { background: rgba(255, 77, 60, .2); }
.cell.hit i { width: 58%; height: 58%; border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, #fff3b0 0 18%, #ffb020 38%, #ff4d2e 62%, rgba(255, 45, 111, 0) 72%);
  animation: ember 1.100s ease-in-out infinite alternate; }
@keyframes ember { to { transform: scale(1.18); filter: brightness(1.25); } }
.cell.deflect { background: rgba(56, 225, 255, .1); }
.cell.deflect i { width: 62%; height: 66%; background: var(--cyan); opacity: .9;
  clip-path: polygon(50% 0, 100% 18%, 100% 55%, 50% 100%, 0 55%, 0 18%); animation: glint 1.600s ease-in-out infinite; }
.cell.deflect i::after { content: ''; position: absolute; inset: 14%; background: #0a1840; clip-path: inherit; }
@keyframes glint { 50% { opacity: .45; } }
.cell.target { background: rgba(255, 77, 125, .22); box-shadow: inset 0 0 0 2px var(--pink); z-index: 3; animation: lockon .7s ease-in-out infinite alternate; }
.cell.target::before, .cell.target::after { content: ''; position: absolute; background: var(--pink); }
.cell.target::before { width: 2px; height: 160%; }
.cell.target::after { height: 2px; width: 160%; }
@keyframes lockon { to { box-shadow: inset 0 0 0 2px var(--pink), 0 0 16px var(--pink); } }

.ship { position: absolute; pointer-events: none; z-index: 1; }
.ship b { position: absolute; inset: 4px; border-radius: 999px;
  background: linear-gradient(180deg, #c3d0ee, #7d8fb8 45%, #46557e); box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .5); }
.ship.h b { border-radius: 14% 46% 46% 14% / 42% 50% 50% 42%; }
.ship.v b { background: linear-gradient(90deg, #c3d0ee, #7d8fb8 45%, #46557e); border-radius: 50% 50% 42% 42% / 46% 46% 14% 14%; }
.ship b::after { content: ''; position: absolute; inset: 30%; border-radius: 999px; background: rgba(12, 22, 52, .45); }
.ship.shielded b { box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .35), 0 0 0 2px rgba(56, 225, 255, .8), 0 0 14px 2px rgba(56, 225, 255, .55); animation: shieldhum 2.200s ease-in-out infinite; }
@keyframes shieldhum { 50% { box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .35), 0 0 0 2px rgba(56, 225, 255, .45), 0 0 6px 1px rgba(56, 225, 255, .3); } }
.ship.sel b { box-shadow: 0 0 0 2px var(--gold), 0 0 16px 2px rgba(255, 200, 87, .7); animation: none; }
.ship.sunk b { background: linear-gradient(180deg, #6b2438, #35101d); box-shadow: 0 0 0 1px rgba(255, 77, 125, .6); animation: none; }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.boom { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); }
.boom i { position: absolute; inset: 0; border-radius: 50%; opacity: 0; }
.boom.splash i { border: 2px solid rgba(220, 238, 255, .9); animation: ring .9s ease-out forwards; }
.boom.splash i:nth-child(2) { animation-delay: .15s; }
.boom.splash i:nth-child(3) { animation-delay: .3s; }
.boom.blast i:nth-child(1) { background: radial-gradient(circle, #fff 0 20%, #ffd34d 40%, #ff5a2e 65%, transparent 72%); animation: burst .7s ease-out forwards; }
.boom.blast i:nth-child(2) { border: 3px solid #ff8a3d; animation: ring .8s ease-out .05s forwards; }
.boom.blast i:nth-child(3) { border: 2px solid var(--pink); animation: ring 1.100s ease-out .15s forwards; }
.boom.ward i { border: 3px solid var(--cyan); box-shadow: 0 0 18px var(--cyan), inset 0 0 12px rgba(56, 225, 255, .6); animation: ring 1s ease-out forwards; }
.boom.ward i:nth-child(2) { animation-delay: .18s; }
.boom.ward i:nth-child(3) { animation-delay: .36s; }
@keyframes ring { from { transform: scale(.3); opacity: 1; } to { transform: scale(3.200); opacity: 0; } }
@keyframes burst { 0% { transform: scale(.2); opacity: 1; } 60% { transform: scale(2.600); opacity: 1; } 100% { transform: scale(3.400); opacity: 0; } }
.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, -2px); } 80% { transform: translate(3px, 2px); } }

/* ---------- battle ---------- */
.hud { display: flex; align-items: stretch; gap: 6px; }
.pcard { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); transition: border-color .3s, box-shadow .3s; }
.pcard > div { flex: 1; min-width: 0; }
.pcard.right { text-align: right; }
.pcard.active { border-color: var(--pink); box-shadow: 0 0 20px -6px var(--pink); }
.pcard strong { display: block; font: 700 13px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av { font-size: 26px; line-height: 1; }
.hud .pips { display: flex; gap: 3px; margin-top: 6px; }
.pip { height: 6px; border-radius: 3px; background: var(--cyan); box-shadow: 0 0 6px rgba(56, 225, 255, .6); }
.pip.sunk { background: #4b2033; box-shadow: none; }
.vs { display: grid; place-content: center; text-align: center; font: 700 11px/1 var(--display); color: var(--mute); letter-spacing: .1em; }
.vs small { display: block; margin-top: 4px; font-size: 13px; color: var(--gold); letter-spacing: 0; }
.status { text-align: center; font-size: 14px; color: var(--mute); margin-bottom: 8px; min-height: 21px; }
.status b { color: var(--text); }
.status.mine { color: var(--cyan); }
.btn.fire { margin-top: 12px; background: linear-gradient(135deg, #ff6b9a, #ff2d6f); color: #fff; font-size: 18px; padding: 17px;
  box-shadow: 0 10px 30px -8px rgba(255, 45, 111, .8), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.fire:disabled { background: var(--panel); box-shadow: none; border: 1px solid var(--line); color: var(--mute); opacity: 1; filter: none; font-size: 14px; }
.reactions { display: flex; justify-content: space-between; margin-top: 12px; padding-right: 64px; }
.reactions button { font-size: 24px; width: 38px; height: 38px; border-radius: 50%; transition: transform .15s; }
.reactions button:active { transform: scale(1.4) translateY(-6px); }
.defend-card { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 12px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(56, 225, 255, .16), rgba(17, 26, 54, .85)); border: 1px solid rgba(56, 225, 255, .5); }
.defend-card small { color: var(--cyan); font: 600 10px/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase; }
.defend-card p { font-weight: 600; margin: 4px 0 6px; font-size: 15px; }
.defend-answers { display: flex; flex-wrap: wrap; gap: 5px; }
.defend-answers span { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: var(--mute); }
.defend-answers .right { background: rgba(74, 222, 128, .16); color: var(--green); }

.timer { --p: 1; width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; flex: none; margin: 0 auto;
  background: radial-gradient(circle, var(--panel-solid) 0 58%, transparent 60%), conic-gradient(var(--cyan) calc(var(--p) * 360deg), rgba(255, 255, 255, .1) 0); }
.timer .num { font: 700 24px/1 var(--display); }
.timer.low { background: radial-gradient(circle, var(--panel-solid) 0 58%, transparent 60%), conic-gradient(var(--pink) calc(var(--p) * 360deg), rgba(255, 255, 255, .1) 0); }
.timer.low .num { color: var(--pink); }
.timer.small { width: 50px; height: 50px; margin: 0; }
.timer.small .num { font-size: 17px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 6, 16, .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade .2s; }
.sheet { width: 100%; max-width: 480px; max-height: 94dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 22px 18px calc(var(--safe-b) + 22px); border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #16224a, #0b1230); border: 1px solid rgba(56, 225, 255, .3); border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(56, 225, 255, .18); animation: rise .32s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(60%); opacity: 0; } }
.sheet h2 { font: 700 20px/1.15 var(--display); letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.qmodal { text-align: center; }
.emblem svg { width: 62px; height: 70px; filter: drop-shadow(0 0 16px rgba(56, 225, 255, .8)); animation: pulse 1.800s ease-in-out infinite; }
.qmodal h2 { color: var(--cyan); margin-top: 4px; }
.by { color: var(--mute); font-size: 13px; margin: 4px 0 12px; }
.qtext { font-size: 20px; font-weight: 700; line-height: 1.3; margin: 14px 0 16px; }
.answers { display: grid; gap: 10px; }
.answers button { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border-radius: 16px; font-size: 16px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); transition: transform .12s, border-color .2s, background .2s; }
.answers button:active { transform: scale(.98); }
.answers em { font: normal 700 14px/1 var(--display); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(56, 225, 255, .16); color: var(--cyan); }
.answers .chosen { border-color: var(--gold); background: rgba(255, 200, 87, .14); }
.answers button:disabled:not(.chosen) { opacity: .45; }
.how ol { padding-left: 20px; margin: 16px 0; color: #c5d1ee; font-size: 15px; }
.how li { margin-bottom: 9px; }
.how b { color: var(--text); }
.menu { display: grid; gap: 10px; }
.menu h2 { margin-bottom: 6px; }

/* ---------- announcements, toasts, floaters ---------- */
.announce { position: fixed; inset: 0; z-index: 30; pointer-events: none; display: grid; place-items: center; padding: 20px; }
.ann { text-align: center; animation: ann 1.600s cubic-bezier(.2, .9, .3, 1) forwards; }
.ann h2 { font: 700 44px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #fff; }
.ann p { margin-top: 8px; font-size: 16px; font-weight: 600; color: #fff; text-shadow: 0 2px 10px #000; }
.ann.pink h2 { text-shadow: 0 0 24px var(--pink), 0 0 60px var(--pink), 0 3px 0 #a3153f; }
.ann.cyan h2 { text-shadow: 0 0 24px var(--cyan), 0 0 60px var(--cyan), 0 3px 0 #0b6a80; }
@keyframes ann { 0% { transform: scale(.4); opacity: 0; } 14% { transform: scale(1.08); opacity: 1; } 22%, 78% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.toasts { position: fixed; top: calc(var(--safe-t) + 10px); left: 0; right: 0; z-index: 60; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 100%; padding: 11px 16px; border-radius: 14px; font-size: 14px; background: #1b2856; border: 1px solid rgba(56, 225, 255, .4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: drop .3s cubic-bezier(.2, .9, .3, 1.2); transition: opacity .3s, transform .3s;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes drop { from { transform: translateY(-30px); opacity: 0; } }
.floaters { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.floater { position: absolute; bottom: 12%; font-size: 54px; animation: floatup 2.600s ease-out forwards; }
.floater.rain { font-size: 30px; bottom: auto; top: -40px; animation: rain 2.800s ease-in forwards; }
@keyframes floatup { 0% { transform: translate(0, 0) scale(.3); opacity: 0; } 15% { transform: translate(0, -40px) scale(1.2); opacity: 1; } 100% { transform: translate(var(--drift), -62vh) scale(1); opacity: 0; } }
@keyframes rain { to { transform: translate(var(--drift), 105vh) rotate(260deg); opacity: .6; } }

/* ---------- game over ---------- */
.result { text-align: center; padding: 8px 0 18px; }
.trophy { font-size: 74px; line-height: 1; animation: pulse 2.400s ease-in-out infinite; }
.result h1 { font: 700 46px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; margin: 8px 0; }
.won .result h1 { color: var(--gold); text-shadow: 0 0 30px rgba(255, 200, 87, .7); }
.lost .result h1 { color: #9fb2e0; }
.result p { color: #b9c6e6; }
.series { display: inline-flex; gap: 12px; align-items: center; margin-top: 14px; padding: 8px 18px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font: 700 20px/1 var(--display); }
.series i { color: var(--mute); font-style: normal; }
.stats { width: 100%; border-collapse: collapse; margin: 18px 0 6px; background: var(--panel); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.stats th { font: 600 11px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); padding: 12px 8px; }
.stats td { padding: 10px 8px; border-top: 1px solid var(--line); text-align: center; font-weight: 600; }
.stats td:first-child { text-align: left; padding-left: 14px; color: #b9c6e6; font-weight: 400; }
.over h3 { font: 700 15px/1.2 var(--display); letter-spacing: .08em; text-transform: uppercase; margin: 22px 0 10px; }
.over h3 small { display: block; font: 400 12px var(--body); letter-spacing: 0; text-transform: none; color: var(--mute); margin-top: 3px; }
.recap-q { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.recap-q p { font-weight: 600; }
.recap-a { color: var(--green); font-size: 14px; margin: 4px 0 6px; }
.tag { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; margin: 2px 4px 0 0; background: rgba(255, 255, 255, .07); color: var(--mute); }
.tag.good { background: rgba(74, 222, 128, .16); color: var(--green); }
.tag.bad { background: rgba(255, 77, 125, .16); color: #ff8fae; }

/* ---------- chat ---------- */
.fab { position: fixed; right: 14px; bottom: calc(var(--safe-b) + 16px); z-index: 20; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #04101c;
  background: linear-gradient(135deg, #7cf0ff, #38b6ff); box-shadow: 0 10px 26px -6px rgba(56, 182, 255, .8); }
.fab:active { transform: scale(.93); }
.fab b { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center;
  background: var(--pink); color: #fff; font: 700 12px/1 var(--body); border: 2px solid var(--bg); animation: pulse 1.200s ease-in-out infinite; }
.chat { position: fixed; left: 0; right: 0; top: 0; height: 100dvh; z-index: 50; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0d1638, #060a18); animation: rise .28s cubic-bezier(.2, .9, .3, 1); }
.chat header { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 10px) 14px 10px; border-bottom: 1px solid var(--line); }
.chat-who { display: flex; align-items: center; gap: 10px; }
.chat-who > span { font-size: 30px; }
.chat-who strong { display: block; font: 700 15px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.chat-who small { color: var(--mute); font-size: 12px; }
.chat-who small.on { color: var(--green); }
.chat-log { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.chat-empty { margin: auto; color: var(--mute); text-align: center; }
.msg { max-width: 80%; }
.msg p { padding: 9px 13px; border-radius: 18px; word-wrap: break-word; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.msg.mine { align-self: flex-end; }
.msg.mine p { background: linear-gradient(135deg, #ff6b9a, #ff2d6f); border-bottom-right-radius: 6px; }
.msg.theirs { align-self: flex-start; }
.msg.theirs p { background: #1b2856; border-bottom-left-radius: 6px; }
.msg.big p { background: none; padding: 0 4px; font-size: 44px; line-height: 1.15; }
.emoji-panel { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px 10px; max-height: 190px; overflow-y: auto; border-top: 1px solid var(--line); background: rgba(4, 8, 22, .6); }
.emoji-panel button { font-size: 26px; padding: 5px 0; border-radius: 8px; }
.emoji-panel button:active { background: rgba(255, 255, 255, .12); }
.chat-form { display: flex; gap: 8px; align-items: center; padding: 10px 12px calc(var(--safe-b) + 10px); border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; font: 16px var(--body); color: var(--text); background: rgba(255, 255, 255, .07); border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; outline: none; }
.send { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #ff6b9a, #ff2d6f); color: #fff; }
body.chatting { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .ocean i, .sweep, .radar i, .hero-logo .logo { animation: none; }
}
