/* How Paint Party 3D looks. Colours are in the :root list at the top. */
:root {
  --bg: #2a1f4a;
  --bg2: #3a2b66;
  --card: #fffaf0;
  --ink: #2a1f4a;
  --muted: #7a6f96;
  --accent: #ff4d5e;
  --accent2: #3d8bff;
  --good: #3ddc84;
  --radius: 18px;
  font-family: "Baloo 2", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(circle at 20% 10%, #4b3784 0, transparent 40%), radial-gradient(circle at 85% 90%, #5b2a63 0, transparent 40%), var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
button, input, select { font: inherit; }

.screen { max-width: 920px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ---- Title */
.title { text-align: center; color: #fff; padding-top: 8px; }
.title h1 { font-size: clamp(42px, 11vw, 84px); margin: 0; line-height: 1; letter-spacing: 2px; font-weight: 800; text-shadow: 0 5px 0 rgba(0,0,0,.25); }
.title h1 span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.title h1 span:nth-child(odd) { animation-delay: -1.2s; }
.title p { margin: 4px 0 0; font-size: 18px; opacity: .85; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
.c1 { color: #ff4d5e; } .c2 { color: #3d8bff; } .c3 { color: #ffd23f; } .c4 { color: #3ddc84; }
.c5 { color: #a66bff; } .c6 { color: #ff9535; } .c7 { color: #ff6ec7; } .c8 { color: #2fd9e8; }

/* ---- Cards and buttons */
.card { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.card h2 { margin: 0 0 10px; font-size: 22px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 700px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.hint { font-size: 14px; color: var(--muted); margin: 10px 0 0; }

.btn {
  border: 0; border-radius: 14px; padding: 10px 18px; cursor: pointer; font-weight: 700; font-size: 18px;
  background: var(--accent); color: #fff; box-shadow: 0 4px 0 #c62839; transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c62839; }
.btn.alt { background: var(--accent2); box-shadow: 0 4px 0 #1f5fc4; }
.btn.ghost { background: #ece5f7; color: var(--ink); box-shadow: 0 4px 0 #cfc4e3; }
.btn.big { font-size: 22px; padding: 12px 22px; }
.btn.small { font-size: 16px; padding: 6px 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: #ece5f7; border-radius: 12px; font-size: 22px; padding: 4px 10px; cursor: pointer; }

.name-card { display: flex; align-items: center; gap: 10px; justify-content: center; font-size: 20px; flex-wrap: wrap; }
.name-card strong { font-size: 24px; }

.join-row { display: flex; gap: 10px; }
.join-row input {
  flex: 1; min-width: 0; font-size: 28px; font-weight: 800; letter-spacing: 8px; text-transform: uppercase; text-align: center;
  border: 3px solid #d9cfee; border-radius: 14px; padding: 4px 10px; background: #fff; color: var(--ink);
}
.join-row input:focus { outline: none; border-color: var(--accent2); }
.rooms-title { margin-top: 16px !important; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.room-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.room-list li.room { display: flex; align-items: center; gap: 10px; background: #f3edfb; border-radius: 12px; padding: 8px 10px; }
.room-list .code { font-weight: 800; letter-spacing: 2px; font-size: 18px; }
.room-list .info { flex: 1; font-size: 14px; color: var(--muted); line-height: 1.2; }

.how summary { font-weight: 700; font-size: 20px; cursor: pointer; }
.how li { margin: 6px 0; }
footer { text-align: center; padding-bottom: 12px; color: #d9cfee; }
footer a { color: #d9cfee; }

/* ---- Lobby */
.code-card { text-align: center; }
.room-code { font-size: clamp(56px, 16vw, 96px); font-weight: 800; letter-spacing: 12px; line-height: 1.1; color: var(--accent); }
.code-card .row { justify-content: center; }
.pill { background: #ece5f7; border-radius: 999px; padding: 3px 12px; font-weight: 700; }
.players { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.players li { display: flex; align-items: center; gap: 8px; background: #f3edfb; border-radius: 12px; padding: 6px 10px; font-weight: 700; }
.players .blob { width: 26px; height: 26px; border-radius: 50%; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.players .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .x { border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--muted); }
.settings { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.settings h2 { width: 100%; }
.settings label { display: flex; gap: 6px; align-items: center; font-weight: 700; }
.settings select { border: 2px solid #d9cfee; border-radius: 10px; padding: 4px 8px; background: #fff; }
body:not(.is-host) .host-only { display: none !important; }
body.is-host .guest-only { display: none !important; }
#waiting { color: #d9cfee; }

/* ---- Lobby teams */
.three { color: #fff; background: linear-gradient(135deg, #ff8a1f, #ff4fb4 50%, #2f7bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.teams { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 640px) { .teams { grid-template-columns: minmax(0, 1fr); } }
.team { border-top: 8px solid var(--team, #ccc); }
.team .players { grid-template-columns: minmax(0, 1fr); margin: 0; }

/* ---- Game: the 3D view fills the screen and the HUD sits on top of it. */
#game { position: fixed; inset: 0; overflow: hidden; background: #1a1430; user-select: none; -webkit-user-select: none; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.touch-zone { position: absolute; inset: 0; display: none; touch-action: none; }
body.touch .touch-zone { display: block; }
.hud-top { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; pointer-events: none; width: min(560px, calc(100% - 140px)); }
.hud-mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.timer { font-size: 30px; font-weight: 800; color: #fff; background: rgba(20,14,40,.55); border-radius: 12px; padding: 0 14px; line-height: 1.3; }
.timer.low { color: #ffd23f; animation: pulse .5s infinite; }
.scorebar { width: 100%; height: 14px; border-radius: 8px; overflow: hidden; display: flex; background: rgba(255,255,255,.35); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.scorebar div { height: 100%; transition: width .3s; }
#bar-1 { margin-left: auto; }
.score { font-weight: 800; font-size: 24px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.minimap { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 168px; height: 112px; border-radius: 10px; border: 3px solid rgba(255,255,255,.8); background: #ece6f5; box-shadow: 0 4px 0 rgba(0,0,0,.25); pointer-events: none; }
@media (max-width: 640px) { .minimap { width: 108px; height: 72px; } .hud-top { width: calc(100% - 140px); left: 8px; transform: none; } .score { font-size: 18px; } .timer { font-size: 22px; } }
.crosshair { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid rgba(255,255,255,.9); box-shadow: 0 0 0 2px rgba(0,0,0,.35); pointer-events: none; }
.crosshair::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #fff; }
.crosshair.hit { border-color: #ffd23f; transform: scale(1.25); transition: transform .05s; }
.hurt { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px 40px var(--hurt-color, #f00); opacity: 0; transition: opacity .2s; }
.ink-meter { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; pointer-events: none; }
.ink-label { font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.ink-track { width: 160px; height: 18px; border-radius: 10px; background: rgba(20,14,40,.55); border: 2px solid rgba(255,255,255,.7); overflow: hidden; }
.ink-fill { height: 100%; width: 100%; background: var(--ink, #ff8a1f); transition: width .08s; }
.ink-fill.low { animation: pulse .4s infinite; }
.bomb-ready { font-size: 24px; filter: grayscale(1); opacity: .4; }
.bomb-ready.on { filter: none; opacity: 1; }
body.touch .ink-meter { left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); }
body.touch .ink-track { width: 110px; }
.feed { position: absolute; left: max(10px, env(safe-area-inset-left)); top: 110px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.feed div { background: rgba(20,14,40,.6); color: #fff; font-weight: 700; padding: 2px 10px; border-radius: 10px; font-size: 15px; animation: fade 4s forwards; }
@keyframes fade { 80% { opacity: 1; } 100% { opacity: 0; } }
.click-to-aim { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20,14,40,.35); cursor: pointer; }
.click-to-aim .card { font-size: 24px; font-weight: 800; text-align: center; }
.splatted { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); text-align: center; color: #fff; font-weight: 800; font-size: clamp(40px, 10vw, 80px); text-shadow: 0 5px 0 rgba(0,0,0,.4); pointer-events: none; line-height: 1.1; }
.splatted .by { font-size: 24px; } .splatted .respawn { font-size: 28px; }
.stick { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255,255,255,.15); border: 3px solid rgba(255,255,255,.4); pointer-events: none; }
.stick .knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(255,255,255,.75); }
.touch-buttons { display: none; }
body.touch .touch-buttons { display: block; }
.tbtn { position: absolute; border: 0; border-radius: 50%; color: #fff; font-weight: 800; font-family: inherit; touch-action: none; box-shadow: 0 5px 0 rgba(0,0,0,.3); opacity: .9; }
.tbtn.fire { right: max(18px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); width: 104px; height: 104px; font-size: 20px; background: var(--ink, #ff8a1f); }
.tbtn.jump { right: max(132px, calc(env(safe-area-inset-right) + 114px)); bottom: max(26px, env(safe-area-inset-bottom)); width: 70px; height: 70px; font-size: 16px; background: #6d5b99; }
.tbtn.bomb { right: max(40px, env(safe-area-inset-right)); bottom: max(140px, calc(env(safe-area-inset-bottom) + 122px)); width: 64px; height: 64px; font-size: 28px; background: #6d5b99; }
.tbtn.bomb.on { background: var(--ink, #ff8a1f); }
.emote-bar { position: absolute; left: max(10px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); display: flex; gap: 6px; align-items: flex-start; }
.emote-toggle { border: 0; background: rgba(255,255,255,.2); border-radius: 12px; font-size: 22px; padding: 2px 8px; cursor: pointer; }
.emotes { display: flex; flex-wrap: wrap; gap: 4px; max-width: 280px; }
.emotes button { border: 0; background: var(--card); border-radius: 10px; font: inherit; font-weight: 700; padding: 2px 8px; cursor: pointer; }
body.touch .emote-bar { top: auto; bottom: max(150px, calc(env(safe-area-inset-bottom) + 140px)); }
@media (max-width: 640px) { body:not(.touch) .emote-bar { top: 90px; } }
.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: clamp(48px, 14vw, 110px); font-weight: 800; color: #fff; text-shadow: 0 6px 0 rgba(0,0,0,.35); pointer-events: none; animation: pop .9s ease-out forwards; white-space: nowrap; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.results { position: absolute; inset: 0; background: rgba(20,14,40,.55); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.results .card { width: min(480px, 100%); text-align: center; max-height: 100%; overflow-y: auto; }
.results-teams { display: flex; height: 44px; border-radius: 14px; overflow: hidden; margin-bottom: 12px; font-weight: 800; font-size: 22px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.results-teams div { display: flex; align-items: center; justify-content: center; min-width: 70px; }
.results ol { text-align: left; padding: 0; list-style: none; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.results li { display: flex; align-items: center; gap: 10px; background: #f3edfb; border-radius: 12px; padding: 6px 12px; font-weight: 700; font-size: 17px; border-left: 8px solid var(--team, #ccc); }
.results li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results li .stat { color: var(--muted); font-size: 15px; white-space: nowrap; }
.results li.me { outline: 3px solid var(--accent2); }

/* ---- Bits */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.4); max-width: calc(100% - 32px); text-align: center; z-index: 10; }
.mute { position: fixed; top: 10px; right: 10px; border: 0; background: rgba(255,255,255,.15); border-radius: 12px; font-size: 20px; padding: 4px 8px; cursor: pointer; z-index: 5; }
#game:not(.hidden) ~ .mute { top: 64px; right: auto; left: 10px; }

/* ---- Coins, the shop button, abilities and power-ups (bottom left, above the ink) */
.hud-left { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(46px, calc(env(safe-area-inset-bottom) + 40px)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hud-row { display: flex; gap: 8px; align-items: center; }
.coins { font-weight: 800; font-size: 20px; color: #ffe14a; background: rgba(20,14,40,.6); border-radius: 12px; padding: 1px 12px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.hud-btn { position: relative; border: 3px solid rgba(255,255,255,.8); border-radius: 14px; width: 52px; height: 48px; font-size: 24px; background: rgba(20,14,40,.6); color: #fff; cursor: pointer; font-family: inherit; padding: 0; touch-action: none; }
.hud-btn .key { position: absolute; right: 3px; bottom: 0; font-size: 11px; font-weight: 800; opacity: .8; }
body.touch .hud-btn .key { display: none; }
.shop-btn.open { border-color: #ffe14a; box-shadow: 0 0 12px #ffe14a; animation: pulse 1s infinite; }
.ability-btn.ready { border-color: var(--ink, #ff8a1f); box-shadow: 0 0 10px var(--ink, #ff8a1f); }
.ability-btn .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: rgba(20,14,40,.7); font-size: 18px; font-weight: 800; }
.ability-btn .cd:empty { display: none; }
.buffs { display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.buff { font-weight: 800; color: #2a1f4a; border-radius: 12px; padding: 0 10px; font-size: 16px; box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.buff.ending { animation: pulse .4s infinite; }
body.touch .hud-left { left: max(10px, env(safe-area-inset-left)); bottom: auto; top: max(106px, calc(env(safe-area-inset-top) + 100px)); }
@media (max-width: 640px) { body:not(.touch) .hud-left { bottom: 44px; } }
.feed { top: 150px; }
body.touch .feed { top: max(70px, calc(env(safe-area-inset-top) + 64px)); left: 50%; transform: translateX(-50%); align-items: center; }

.shop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(20,14,40,.5); padding: 12px; }
.shop .card { width: min(640px, 100%); max-height: 100%; overflow-y: auto; }
.shop-head { display: flex; align-items: center; gap: 12px; }
.shop-head h2 { margin: 0; flex: 1; }
.shop h3 { margin: 12px 0 6px; }
.shop-note { margin: 4px 0; font-size: 14px; }
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.item { border: 3px solid #e3dbf3; border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; background: #fbf9ff; }
.item.on { border-color: var(--ink, #ff8a1f); background: #fff7ee; }
.item .top { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; }
.item .icon { font-size: 24px; }
.item .about { font-size: 13px; color: #6d6488; flex: 1; }
.item .stats { font-size: 12px; color: #8a80a6; }
.item button { margin-top: 4px; }
