:root {
  --bg: #f4f1e8;
  --paper: #fffdf8;
  --ink: #25231f;
  --muted: #777067;
  --line: #d8d1c5;
  --accent: #226d5a;
  --accent2: #e2efe9;
  --danger: #b43a36;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif
}

button,
input,
select {
  font: inherit
}

button {
  cursor: pointer
}

.adsbygoogle {
  margin: 16px 0;
}

footer {
  margin: 16px 0;
  text-align: center;
}

.wrap {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 20px
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px
}

.brand img {
  border-radius: 14px
}

h1 {
  font-size: clamp(25px, 4vw, 40px);
  line-height: 1.1;
  margin: 0 0 8px
}

.title-link {
  color: inherit;
  text-decoration: none
}

.title-link:hover,
.title-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px
}

p {
  line-height: 1.7
}

.brand p {
  margin: 0;
  color: var(--muted)
}

.hud {
  display: flex;
  gap: 10px
}

.hud>div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px;
  min-width: 96px;
  text-align: center
}

.hud span {
  display: block;
  font-size: 12px;
  color: var(--muted)
}

.hud strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px
}

.game-panel {
  margin-bottom: 20px
}

.mode-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px
}

.mode,
.secondary,
.primary {
  min-height: 44px;
  border-radius: 12px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink)
}

.mode.active {
  background: var(--accent2);
  border-color: var(--accent);
  font-weight: 700
}

.mode:disabled {
  opacity: .55;
  cursor: not-allowed
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700
}

.primary:disabled {
  opacity: .5;
  cursor: not-allowed
}

.secondary {
  font-weight: 700
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none
}

.finish-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap
}

.center-box {
  text-align: center;
  padding: 36px 10px
}

.center-box h2 {
  margin-top: 0
}

.clocks {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 12px auto;
  max-width: 710px
}

.clock-box {
  text-align: center;
  font-weight: 700
}

.clock-box svg {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: auto
}

.operator {
  font-size: 54px;
  font-weight: 800
}

.question {
  text-align: center;
  font-size: 22px;
  margin: 18px 0
}

.answer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap
}

.answer label {
  display: flex;
  align-items: center;
  gap: 6px
}

select,
input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 16px
}

.result {
  text-align: center;
  font-weight: 700;
  min-height: 29px;
  margin: 16px 0 8px
}

.result.correct {
  color: var(--accent);
  animation: correct-pop .9s ease both
}

@keyframes correct-pop {
  0% {
    opacity: 0;
    transform: scale(.75)
  }

  35% {
    opacity: 1;
    transform: scale(1.2)
  }

  60% {
    transform: scale(.96)
  }

  100% {
    opacity: 1;
    transform: scale(1)
  }
}

@media(prefers-reduced-motion:reduce) {
  .result.correct {
    animation: none
  }
}

#nextBtn {
  display: block;
  margin: 0 auto
}

.finish-time {
  font-size: 20px;
  margin: 16px
}

.finish-time span {
  font-size: 44px;
  font-weight: 800;
  font-variant-numeric: tabular-nums
}

.name-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 18px 0
}

.name-row label {
  font-weight: 700
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px
}

.section-head h2 {
  margin: 0
}

.section-head span {
  font-size: 13px;
  color: var(--muted)
}

.ranking-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px
}

.ranking-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 13px;
  background: #fff;
  color: var(--ink)
}

.ranking-tab.active {
  background: var(--accent2);
  border-color: var(--accent);
  font-weight: 700
}

.ranking {
  margin: 18px 0 0;
  padding-left: 34px
}

.ranking li {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line)
}

.rules-panel {
  margin-top: 20px
}

.rules-panel h2 {
  margin-top: 0
}

.rules-panel ul {
  margin: 0;
  padding-left: 1.5em
}

.rules-panel li {
  line-height: 1.8;
  margin: 6px 0
}

.rank-row {
  display: flex;
  justify-content: space-between;
  gap: 16px
}

.rank-time {
  font-weight: 800;
  font-variant-numeric: tabular-nums
}

.rank-name {
  overflow-wrap: anywhere
}

svg .face {
  fill: #fff;
  stroke: #403d38;
  stroke-width: 4
}

svg .tick {
  stroke: #79736a;
  stroke-linecap: round
}

svg .number {
  fill: #2b2925;
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle
}

svg .hour {
  stroke: #2d2b27;
  stroke-width: 8;
  stroke-linecap: round
}

svg .minute {
  stroke: #226d5a;
  stroke-width: 5;
  stroke-linecap: round
}

svg .hub {
  fill: #2d2b27
}

@media(max-width:680px) {
  .wrap {
    width: min(100% - 18px, 980px);
    padding-top: 14px
  }

  .hero {
    display: block
  }

  .hud {
    margin-top: 14px
  }

  .hud>div {
    flex: 1
  }

  .panel {
    padding: 14px
  }

  .operator {
    font-size: 38px
  }

  .clocks {
    gap: 2px
  }
}