:root {
  --bg: #111111;
  --bg-soft: #181818;
  --text: #c9c9c9;
  --muted: #7a7a7a;
  --line: #2c2c2c;
  --accent: #6e7a6c;
  --warn: #9a8f7a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body {
  font-family: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen {
  display: none;
  width: min(36rem, 100%);
  text-align: center;
}

.screen.is-active {
  display: block;
}

.kicker {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
}

.title {
  margin: 0 0 16px;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #d8d8d8;
}

.lead,
.hint,
.best,
.reason,
.complete {
  margin: 0;
  color: var(--muted);
}

.lead {
  margin-bottom: 32px;
}

.best {
  margin-top: 28px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

.countdown {
  margin: 8px 0 16px;
  font-size: clamp(4rem, 16vw, 6rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--accent);
  line-height: 1;
}

.timer {
  margin: 8px 0 18px;
  font-size: clamp(2rem, 8vw, 3.6rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color: #e4e4e4;
  line-height: 1.15;
}

.rank {
  margin: 0 0 12px;
  color: var(--accent);
  letter-spacing: 0.12em;
}

.hint {
  font-size: 0.85rem;
}

.reason {
  margin-top: 8px;
}

.complete {
  margin-top: 16px;
  color: var(--warn);
}

.record-flag {
  color: var(--warn);
  letter-spacing: 0.22em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10.5rem;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
  border-color: #4a4a4a;
  outline: none;
}

.btn-primary {
  border-color: #3d463c;
  color: #d5ddd3;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  border-color: var(--accent);
}

body.is-measuring {
  user-select: none;
  touch-action: none;
}

@media (max-width: 480px) {
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
    min-width: 0;
  }
}
