:root {
  --blue: #1a8cff;
  --blue-dark: #0a6fd6;
  --green: #28a745;
  --red: #dc3545;
  --bubble: #f6ead8;
  --text: #333;
  --muted: #888;
  --border: #e3e3e3;
  --gold: #f2c94c;
  --silver: #c9ced6;
  --bronze: #d9a066;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: #fff;
}

[hidden] { display: none !important; }

/* Header: ninja + speech bubble */
.hero {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #f1f1f1;
}
.ninja { width: 90px; height: auto; flex-shrink: 0; }
.bubble {
  position: relative;
  flex: 1;
  background: var(--bubble);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 14px;
  text-align: center;
}
.bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-right: 12px solid var(--bubble);
  border-left: 0;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

h2 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); text-align: center; }
.error { color: var(--red); text-align: center; }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 16px auto 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-small { width: auto; margin: 0; padding: 8px 14px; }
.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #5a6268; }

.link { color: var(--blue); text-decoration: none; font-size: 13px; }

/* Forms */
.panel { display: flex; flex-direction: column; }
.field { border: 0; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.field > span, .field legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type="text"], input:not([type]), input[type="number"] {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; }
.inline { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 4px 0 0 26px; }
.inline input { width: 70px; }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label {
  flex: 1;
  min-width: 56px;
  text-align: center;
  padding: 8px 0;
  border: 1px solid var(--blue);
  border-radius: 4px;
  color: var(--blue);
  cursor: pointer;
}
.segmented input { display: none; }
.segmented label:has(input:checked) { background: var(--blue); color: #fff; }

/* Lobby */
.share { display: flex; gap: 8px; }
.share input { flex: 1; min-width: 0; }
.summary { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.players { list-style: none; padding: 0; margin: 0; }
.players li { padding: 8px 10px; border-bottom: 1px solid #f1f1f1; display: flex; justify-content: space-between; }
.tag { font-size: 11px; color: #fff; background: var(--blue); border-radius: 3px; padding: 1px 6px; margin-left: 6px; }
.tag.you { background: #6c757d; }

/* Countdown */
.countdown { text-align: center; padding: 60px 0; }
#countdown-number { font-size: 72px; font-weight: 700; color: var(--blue); }

/* Quiz (as in the reference screenshot) */
.quiz { text-align: center; }
.quiz-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.timer { height: 4px; background: #eee; border-radius: 2px; margin: 8px 0 0; overflow: hidden; }
#timer-bar { height: 100%; width: 100%; background: var(--blue); }
#timer-bar.low { background: var(--red); }
.word { font-size: 28px; font-weight: 700; margin-top: 18px; }
.reading { font-size: 18px; margin-top: 4px; min-height: 1.4em; }
.choices { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.choices .btn { margin: 0; max-width: 260px; }
.choices .btn.correct { background: var(--green); }
.choices .btn.wrong { background: var(--red); }
.choices .btn.picked { background: var(--blue-dark); }
.choices .btn:disabled { opacity: 1; }

/* Waiting */
.progress-list { list-style: none; padding: 0; margin: 0; }
.progress-list li { margin: 10px 0; font-size: 14px; }
.progress-list .row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bar { height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--blue); transition: width 0.3s; }
.bar.done > div { background: var(--green); }
.offline { color: var(--muted); }

/* Podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 12px 0 20px; }
.step { width: 120px; text-align: center; }
.step .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .points { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.step .block { border-radius: 4px 4px 0 0; font-size: 28px; font-weight: 700; color: #fff; display: flex; align-items: flex-start; justify-content: center; padding-top: 8px; }
.step.first .block { height: 120px; background: var(--gold); }
.step.second .block { height: 90px; background: var(--silver); }
.step.third .block { height: 65px; background: var(--bronze); }
.ranking { width: 100%; border-collapse: collapse; font-size: 14px; }
.ranking th, .ranking td { padding: 6px 8px; border-bottom: 1px solid #f1f1f1; text-align: left; }
.ranking tr.me td { font-weight: 700; }
.actions { text-align: center; }
.actions .link { display: inline-block; margin-top: 16px; }
