/* How Paint Party 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; }
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; }

/* ---- Game */
#game { max-width: none; height: 100dvh; padding: 8px; gap: 8px; }
.hud { display: flex; align-items: center; gap: 10px; color: #fff; }
.timer { font-size: 30px; font-weight: 800; min-width: 80px; text-align: center; background: rgba(0,0,0,.25); border-radius: 12px; padding: 0 10px; }
.timer.low { color: #ffd23f; animation: pulse .5s infinite; }
.scorebar { flex: 1; height: 24px; border-radius: 12px; overflow: hidden; display: flex; background: rgba(255,255,255,.15); }
.scorebar div { height: 100%; transition: width .3s; }
.my-score { font-weight: 800; font-size: 22px; min-width: 70px; text-align: right; }
#canvas { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; }
.splat-btn {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  width: 96px; height: 96px; border-radius: 50%; border: 0; font-weight: 800; font-size: 18px; color: #fff;
  background: conic-gradient(var(--accent) var(--charge, 100%), #6d5b99 0); box-shadow: 0 5px 0 rgba(0,0,0,.3);
  cursor: pointer; touch-action: none; opacity: .9;
}
.splat-btn.ready { animation: ready 1s infinite; }
@keyframes ready { 50% { transform: scale(1.06); } }
.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,.35); 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,.7); }
.banner { position: fixed; left: 50%; top: 45%; 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: fixed; inset: 0; background: rgba(20,14,40,.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.results .card { width: min(460px, 100%); text-align: center; }
.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: 18px; }
.results li .place { width: 34px; font-size: 22px; }
.results li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; 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: auto; bottom: 130px; right: 18px; }
