:root {
  color-scheme: light;
  --bg: #eef1f8;
  --bg-2: #dbe3f3;
  --card: #ffffff;
  --card-2: #eef1f8;
  --text: #1e2a44;
  --muted: #6b7690;
  --accent: #33507d;
  --accent-2: #d99a44;
  --accent-3: #7fa8d9;
  --good: #2f9e6f;
  --bad: #d9534f;
  --radius: 20px;
  --shadow: 0 8px 20px rgba(30, 42, 68, 0.08);
  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fredoka", ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
}

body {
  position: relative;
}

body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.35;
  z-index: -1;
  pointer-events: none;
}
body::before {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -80px;
  background: var(--accent-3);
}
body::after {
  width: 320px;
  height: 320px;
  bottom: -100px;
  left: -100px;
  background: var(--accent-2);
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 18px 90px;
  position: relative;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 22px;
}
.app-logo { font-size: 32px; line-height: 1; }
.app-wordmark {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 70vh;
}
.boot-logo { font-size: 56px; }
.boot-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.boot-spinner {
  width: 28px;
  height: 28px;
  margin-top: 8px;
  border-radius: 50%;
  border: 3px solid var(--bg-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

h1, h2, h3 { line-height: 1.2; margin: 0 0 10px; font-weight: 800; }
h1, h2 { font-family: var(--font-display); }
h1 { font-size: 34px; text-align: center; letter-spacing: -0.01em; }
h2 { font-size: 24px; }
h3 { font-size: 14px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
p { color: var(--muted); margin: 0 0 12px; font-size: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-2 { background: var(--card-2); box-shadow: none; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }

button {
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 15px 22px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
button:active { transform: translateY(2px) scale(0.99); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
button.secondary { background: var(--card-2); color: var(--text); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05); }
button.danger { background: var(--bad); }
button:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
button.block { width: 100%; }

input[type="text"], input[type="number"] {
  font: inherit;
  font-size: 17px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid var(--bg-2);
  background: #ffffff;
  color: var(--text);
  width: 100%;
}
input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="range"] { width: 100%; accent-color: var(--accent); }

label { font-size: 14px; color: var(--muted); display: block; margin-bottom: 6px; font-weight: 600; }

.pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--card-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.pill.you { background: var(--accent); color: white; }
.pill.host { background: var(--accent-2); color: white; }
.pill.good { background: var(--good); color: white; }
.pill.bad { background: var(--bad); color: white; }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li {
  padding: 12px 4px;
  border-bottom: 2px solid var(--bg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
ul.plain li:last-child { border-bottom: none; }

.chain-slots { gap: 10px; display: flex; flex-direction: column; }
.chain-slot {
  border-bottom: none !important;
  justify-content: flex-start !important;
  flex-wrap: wrap;
  background: var(--card-2);
  border-radius: 14px;
  padding: 10px 12px !important;
}
.chain-slot input {
  flex: 1;
  min-width: 90px;
  padding: 10px 12px;
  font-size: 15px;
}
.chain-slot button {
  padding: 10px 12px;
  font-size: 14px;
  box-shadow: none;
  white-space: nowrap;
}
.chain-letter {
  flex-shrink: 0;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 17px;
  background: var(--accent);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  letter-spacing: 0.03em;
}
.chain-slot-solved { background: transparent; }
.chain-slot-locked { opacity: 0.55; }
.chain-slot-locked .chain-letter { background: var(--muted); }
.chain-slot-locked .chain-word { font-family: var(--font-body); font-weight: 600; font-size: 14px; }
.chain-word {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: 0.02em;
}

.room-code-card {
  border: 2px dashed var(--bg-2);
}
.room-code {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  padding: 10px 0;
  color: var(--accent);
}

.scoreboard-list li { padding-left: 2px; }
.rank-row { display: flex; align-items: center; }
.rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  margin-right: 8px;
  font-size: 16px;
  flex-shrink: 0;
}
.rank-medal.rank-plain {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.error-banner {
  background: var(--bad);
  color: white;
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 600;
}

.center { text-align: center; }
.muted { color: var(--muted); }
.spectrum-labels { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.big-word { font-family: var(--font-display); font-size: 28px; font-weight: 700; text-align: center; padding: 16px 0; letter-spacing: 0.02em; color: var(--accent); }
.game-list button { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.game-list small { font-weight: 500; opacity: 0.75; }
.footer-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 20px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip-row button { padding: 9px 14px; font-size: 14px; box-shadow: none; }
