[hidden] {
  display: none !important;
}

main {
  width: min(96vw, 920px);
  margin: 1.1rem auto 2rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

h1 { margin: 0; font-size: clamp(1.35rem, 1rem + 1.2vw, 2rem); }
.subtitle { margin: 0.35rem 0 0; color: var(--muted); font-weight: 700; }

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.55rem 0.45rem;
  text-align: center;
  background: linear-gradient(180deg, #fffefb 0%, #f9f5ed 100%);
}

.stat .k { color: var(--muted); font-size: 0.72rem; display: block; letter-spacing: 0.03em; }
.stat .v { font-weight: 800; font-size: 1.08rem; }

.strikes {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: 0.25rem;
}

.strike-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid #c8ba9f;
  color: #7f7464;
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3ece0;
}

.strike-dot.is-on {
  border-color: #8f2d2d;
  background: #c84f4f;
  color: #fff5f5;
}

.progress-track {
  margin-top: 0.5rem;
  height: 0.8rem;
  border-radius: 999px;
  background: #efe7d8;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f674a 0%, #d7a949 100%);
  transition: width 140ms ease;
}

.play-area {
  position: relative;
  text-align: center;
  transition: background-color 160ms ease;
  overflow: hidden;
}

#book-name {
  margin: 0.35rem 0 0;
  font-size: clamp(1.55rem, 1.2rem + 2vw, 2.7rem);
  line-height: 1.1;
}

.choice-grid {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.choice-btn {
  border: 1px solid #c3b59c;
  border-radius: 11px;
  padding: 0.8rem;
  min-height: 3rem;
  font: inherit;
  font-weight: 800;
  font-size: 1.2rem;
  background: linear-gradient(180deg, #fff7e9 0%, #f3e8d6 100%);
  color: #47351f;
  box-shadow: 0 0.2rem 0.45rem rgba(53, 37, 20, 0.08);
}

.feedback {
  min-height: 1.35rem;
  margin: 0.75rem 0 0;
  font-weight: 700;
}

.feedback.good { color: var(--accent); }
.feedback.bad { color: #b13f3f; }

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.actions button {
  white-space: nowrap;
  border: 1px solid #ccbca2;
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  min-height: 2.85rem;
  font: inherit;
  font-weight: 700;
  background: linear-gradient(180deg, #fff7ea 0%, #f1e6d2 100%);
  color: #47351f;
  box-shadow: 0 0.2rem 0.45rem rgba(53, 37, 20, 0.08);
}

.actions .start-action {
  margin-left: 0;
  order: -1;
}

button:disabled { opacity: 0.55; cursor: not-allowed; }

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(26, 21, 14, 0.68);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.settings-card {
  width: min(92vw, 520px);
  max-height: min(86vh, 700px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  box-shadow: var(--shadow-deep);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popup-close {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f0e4;
  color: #47351f;
  font: inherit;
  font-weight: 800;
  width: 1.9rem;
  height: 1.9rem;
}

.settings-grid {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.6rem;
}

.setting { display: grid; gap: 0.35rem; font-weight: 700; color: #4f4538; }
.setting input[type="range"], .setting select { width: 100%; }
.setting-help { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

#daily-status,
#daily-score,
#daily-best,
#daily-streak {
  margin: 0 0 0.35rem;
}

.missed-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.missed-list li {
  margin-bottom: 0.25rem;
}

.summary-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(26, 21, 14, 0.62);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.summary-card {
  width: min(92vw, 460px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow-deep);
}

.summary-card h2 { margin: 0 0 0.45rem; }
.summary-card ul { margin: 0 0 0.8rem; padding-left: 1.1rem; }

.summary-actions { display: flex; gap: 0.5rem; }
.summary-actions button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-weight: 700;
  background: #f6f0e4;
  color: #47351f;
}

.miss-x {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(5rem, 22vw, 10rem);
  font-weight: 900;
  color: rgba(196, 37, 37, 0.96);
  text-shadow: 0 0 1.5rem rgba(128, 14, 14, 0.45);
  opacity: 0;
  pointer-events: none;
}

.miss-x.show { animation: miss-x-burst 420ms ease-out; }

.play-area.flash-good { animation: flash-good 240ms ease; }
.play-area.flash-bad { animation: flash-bad 240ms ease; }

@keyframes flash-good {
  0% { background-color: rgba(64, 158, 97, 0.22); }
  100% { background-color: transparent; }
}

@keyframes flash-bad {
  0% { background-color: rgba(191, 72, 72, 0.2); }
  100% { background-color: transparent; }
}

@keyframes miss-x-burst {
  0% { opacity: 0; transform: scale(0.65); }
  22% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(1); }
}

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: 1fr 1fr 1fr; }
}
