:root {
  --ink: #1f2a3d;
  --cream: #f3fbff;
  --orange: #f28c38;
  --blue: #3f7fd9;
  --teal: #2fb3a8;
  --sea: #1e6fa8;
  font-family: 'Fredoka', 'Nunito', 'Avenir Next', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a5f94; color: var(--ink); }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; }
.pill {
  background: rgba(243, 251, 255, 0.9); border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: 18px;
  box-shadow: 0 6px 18px rgba(0, 30, 60, 0.25); letter-spacing: 0.3px;
}
#top { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#role-badge.hider { background: var(--orange); color: #fff; }
#role-badge.seeker { background: var(--blue); color: #fff; }
#timer { font-size: 26px; min-width: 110px; text-align: center; font-variant-numeric: tabular-nums; }
#timer.urgent { background: #e2563f; color: #fff; animation: pulse 0.8s infinite; }
#phase-label { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); font-size: 15px; padding: 6px 14px; opacity: 0.9; }
#center-msg {
  position: absolute; top: 26%; left: 50%; transform: translateX(-50%); font-size: 62px; font-weight: 700; color: #fff;
  text-shadow: 0 4px 0 rgba(0, 30, 60, 0.4), 0 10px 30px rgba(0,0,0,0.3); text-align: center; white-space: nowrap; opacity: 0; transition: opacity 0.3s;
}
#center-msg.show { opacity: 1; }
#sub-msg {
  position: absolute; top: calc(26% + 80px); left: 50%; transform: translateX(-50%); font-size: 24px; font-weight: 600; color: #fff;
  text-shadow: 0 2px 0 rgba(0,30,60,0.4); text-align: center; opacity: 0; transition: opacity 0.3s; max-width: 80vw;
}
#sub-msg.show { opacity: 1; }
#bottom { position: absolute; bottom: 20px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#health { position: relative; width: 260px; height: 22px; border-radius: 999px; background: rgba(0, 20, 40, 0.45); overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
#health-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #4be08a, #2fb3a8); transition: width 0.2s; border-radius: 999px; }
#health-bar.low { background: linear-gradient(90deg, #f06a4a, #e2563f); }
#health-text { position: absolute; inset: 0; text-align: center; font-size: 14px; font-weight: 700; color: #fff; line-height: 22px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
#stamina { width: 200px; height: 8px; border-radius: 999px; background: rgba(0, 20, 40, 0.45); overflow: hidden; margin-top: -4px; }
#stamina-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #ffd166, #f8a35d); border-radius: 999px; transition: width 0.08s linear; }
#stamina-bar.exhausted { background: #e2563f; }
#hint { font-size: 14px; font-weight: 600; opacity: 0.85; padding: 8px 16px; white-space: nowrap; }
#hint.action { background: var(--orange); color: #fff; font-size: 20px; opacity: 1; animation: pulse 0.6s infinite; }
#danger { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(242, 110, 60, 0.7) 100%); transition: opacity 0.2s; }
#hurt { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 30%, rgba(220, 40, 40, 0.85) 100%); transition: opacity 0.1s; }
#ink { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at 30% 40%, rgba(10,10,30,0.95) 0 18%, transparent 30%), radial-gradient(circle at 70% 65%, rgba(10,10,30,0.95) 0 22%, transparent 36%), radial-gradient(circle at 55% 20%, rgba(10,10,30,0.9) 0 12%, transparent 24%), radial-gradient(circle at 20% 80%, rgba(10,10,30,0.9) 0 14%, transparent 26%), rgba(10,10,30,0.55); transition: opacity 0.3s; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; }
#crosshair span { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,0.8); }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,0.8); border-radius: 2px; }
#crosshair i.t, #crosshair i.b { left: 50%; width: 3px; height: 12px; margin-left: -1.5px; }
#crosshair i.l, #crosshair i.r { top: 50%; height: 3px; width: 12px; margin-top: -1.5px; }
#crosshair i.t { top: 0; } #crosshair i.b { bottom: 0; } #crosshair i.l { left: 0; } #crosshair i.r { right: 0; }
#crosshair.hot i, #crosshair.hot span { background: var(--orange); }
#crosshair.target i, #crosshair.target span { background: #ff5a5a; }
#hitmark { position: absolute; inset: 6px; opacity: 0; background:
  linear-gradient(45deg, transparent 46%, #ffd166 46%, #ffd166 54%, transparent 54%),
  linear-gradient(-45deg, transparent 46%, #ffd166 46%, #ffd166 54%, transparent 54%); filter: drop-shadow(0 0 3px rgba(0,0,0,0.8)); }
#hitmark.show { animation: hitpop 0.3s ease-out; }
@keyframes hitpop { 0% { opacity: 1; transform: scale(1.5); } 100% { opacity: 0; transform: scale(0.9); } }
#abilities { position: absolute; right: 18px; bottom: 20px; display: flex; gap: 10px; }
.chip { position: relative; width: 78px; height: 58px; border-radius: 14px; background: rgba(243,251,255,0.9); box-shadow: 0 6px 18px rgba(0,30,60,0.25); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; font-weight: 700; }
.chip b { font-size: 18px; color: var(--sea); } .chip span { font-size: 12px; opacity: 0.8; white-space: nowrap; }
.chip em { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; background: rgba(31,124,182,0.35); font-style: normal; }
.chip.cooling { opacity: 0.75; } .chip.cooling b { color: #8a98a8; }
.chip.ready { animation: readypop 0.4s; } @keyframes readypop { 0% { transform: scale(1.15); } 100% { transform: scale(1); } }
#bottom { padding: 0 150px 0 0; }
#abilities { bottom: 20px; }
#sense { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: none; flex-direction: column; align-items: center; gap: 6px; }
#sense.show { display: flex; }
#sense-arrow { font-size: 70px; color: #fff; text-shadow: 0 3px 0 rgba(0,30,60,0.4); transform-origin: center; animation: sniff 1s infinite; }
#sense-text { font-weight: 600; color: #fff; text-shadow: 0 2px 0 rgba(0,30,60,0.4); font-size: 18px; }
#shark-warn { position: absolute; top: 130px; left: 50%; transform: translateX(-50%); background: #e2563f; color: #fff; font-size: 22px; display: none; animation: pulse 0.5s infinite; }
#shark-warn.show { display: block; }
#eaten { position: absolute; inset: 0; background: rgba(60, 0, 10, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
#eaten div { font-size: 80px; font-weight: 700; }
#eaten p { font-size: 24px; opacity: 0.85; }
@keyframes pulse { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.06); } }
#timer.urgent, #hint.action { animation-name: pulse2; }
@keyframes pulse2 { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes sniff { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

#blindfold {
  position: fixed; inset: 0; background: radial-gradient(ellipse at center, #16384f 0%, #0a1b2a 80%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--cream);
}
#blindfold .eyes { display: flex; gap: 50px; margin-bottom: 20px; }
#blindfold .eyes span { width: 90px; height: 22px; border-radius: 0 0 60px 60px; border: 6px solid var(--cream); border-top: none; display: block; }
#blind-title { font-size: 46px; font-weight: 700; }
#blind-count { font-size: 120px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
#blind-sub { font-size: 20px; opacity: 0.8; }

#lobby { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, rgba(60,160,220,0.35), rgba(10,60,110,0.55)); }
.card { background: var(--cream); border-radius: 28px; padding: 36px 40px; width: min(540px, 92vw); box-shadow: 0 20px 60px rgba(0,20,50,0.4); text-align: center; }
.logo { font-size: 72px; line-height: 1; }
h1 { margin: 10px 0 4px; font-size: 44px; color: var(--sea); letter-spacing: 1px; }
.tag { margin: 0 0 24px; opacity: 0.75; font-size: 18px; }
#join-form { display: flex; flex-direction: column; gap: 12px; align-items: center; }
#join-form .row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.or { opacity: 0.6; font-weight: 600; }
input#name { font: inherit; font-size: 18px; padding: 12px 16px; border-radius: 14px; border: 3px solid #cfe3f0; background: #fff; width: 280px; outline: none; text-align: center; }
input#name:focus { border-color: var(--sea); }
input#code { font: inherit; font-size: 20px; font-weight: 700; letter-spacing: 4px; text-transform: uppercase; text-align: center; width: 120px; padding: 10px 8px; border-radius: 14px; border: 3px solid #cfe3f0; background: #fff; outline: none; }
input#code:focus { border-color: var(--sea); }
button#join, button#host { font: inherit; font-weight: 700; font-size: 18px; padding: 12px 20px; border-radius: 14px; border: none; cursor: pointer; background: var(--sea); color: #fff; box-shadow: 0 5px 0 #144d75; transition: transform 0.05s; }
button#join:active, button#host:active { transform: translateY(3px); box-shadow: 0 2px 0 #144d75; }
button:disabled { opacity: 0.6; cursor: default; }
.error { color: #c04a3a; font-weight: 600; margin: 0; }
.room-code { display: flex; flex-direction: column; align-items: center; margin: 8px 0; }
.room-code span { font-size: 14px; opacity: 0.7; }
.room-code b { font-size: 44px; letter-spacing: 8px; color: var(--sea); }
button.mini { font: inherit; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 8px; border: none; background: #cfe3f0; cursor: pointer; }
.rules { margin-top: 26px; text-align: left; font-size: 15px; display: grid; gap: 8px; opacity: 0.85; }
.fine { font-size: 13px; opacity: 0.7; }
kbd { background: #d8e9f3; border-radius: 6px; padding: 1px 7px; font-family: inherit; font-weight: 700; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 5px solid #cfe3f0; border-top-color: var(--sea); margin: 10px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.share { font-size: 14px; opacity: 0.8; }
.share code { background: #d8e9f3; padding: 3px 8px; border-radius: 8px; font-size: 13px; word-break: break-all; }
