:root {
  color-scheme: light;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: #1b342b;
  background: #f6f4eb;
  font-synthesis: none;
  --ink: #1b342b;
  --muted: #4c5f55;
  --green: #184e39;
  --line: #d9ded1;
  --paper: #fffef9;
  --blue: #2966ae;
  --amber: #d57826;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 92% 0, #e7eee0 0, transparent 43rem);
}

button { font: inherit; }

:focus-visible {
  outline: 3px solid #2863a6;
  outline-offset: 4px;
}

.layout {
  width: min(100% - 3rem, 68rem);
  margin-inline: auto;
  padding-block: clamp(1.25rem, 5vw, 3.25rem);
}

.site-header {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: clamp(1.2rem, 4vw, 2.7rem);
  color: var(--green);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.site-mark {
  display: grid;
  grid-template-columns: repeat(2, .41rem);
  gap: .17rem;
  padding: .39rem;
  border-radius: .55rem;
  background: var(--green);
}

.site-mark i { height: .41rem; border-radius: .08rem; background: #f7f6e8; }
.site-mark i:nth-child(2) { background: #f4bf69; }
.header-divider { display: inline-block; height: .78em; margin-inline: .62em; border-inline-start: 1px solid #9eab9d; }

.surface {
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  background: var(--paper);
  box-shadow: 0 18px 42px #183d2510;
}

.welcome {
  display: grid;
  grid-template-columns: 1.06fr 1fr;
  min-height: 32rem;
  overflow: hidden;
}

.welcome-content { padding: clamp(1.35rem, 5vw, 3.6rem); align-self: center; }

.welcome h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(2.65rem, 6.1vw, 4.65rem);
  line-height: 1.12;
  letter-spacing: -.045em;
}

.welcome h1 span { display: block; color: var(--green); }

.welcome-description {
  margin: 1.3rem 0 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.14rem);
  line-height: 1.75;
}

.rules {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  margin: 1.6rem 0;
  padding-block: 1rem;
  border-block: 1px solid var(--line);
}

.rules div { flex: 1 0 auto; }
.rules dt { color: var(--muted); font-size: .82rem; }
.rules dd { margin: .2rem 0 0; font-weight: 800; font-size: 1.16rem; }

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.3rem;
  min-width: 12rem;
  min-height: 3.5rem;
  padding: .7rem 1.1rem .7rem 1.35rem;
  border: 0;
  border-radius: .85rem;
  background: var(--green);
  box-shadow: 0 4px 0 #11382a;
  color: #fffef9;
  font-size: 1.12rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.primary-button:hover { background: #236146; }
.primary-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #11382a; }
.primary-button span { font-size: 1.38rem; }

.welcome-example {
  display: grid;
  place-items: center;
  padding: clamp(1.35rem, 3.4vw, 2.4rem);
  background-color: #164b38;
  background-image: radial-gradient(circle at 85% 23%, #31745780, transparent 72%),
    linear-gradient(#e6ffe914 1px, transparent 1px), linear-gradient(90deg, #e6ffe914 1px, transparent 1px);
  background-size: auto, 30px 30px, 30px 30px;
  color: #fdfaf0;
}

.example-content { width: min(100%, 25rem); }
.example-label { margin: 0 0 1rem; font-size: .88rem; letter-spacing: .12em; font-weight: 700; }
.example-tiles, .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.example-tiles { gap: clamp(.35rem, 1vw, .7rem); }

.example-tiles > span, .tile {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: clamp(.55rem, 1.45vw, 1rem);
  background: #faf7e8;
  color: var(--ink);
  font-size: clamp(1.75rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
}

.example-tiles > span { box-shadow: 0 5px 0 #102f24; }
.example-tiles > .example-blank { border: 2px dashed #efc67e; background: #102e2347; color: #ffdc9c; box-shadow: none; }
.example-clue { margin: 1.25rem 0 .8rem; color: #e1eddf; line-height: 1.5; }
.example-answer { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: .9rem; }
.example-answer strong { padding: .38rem .55rem; border-radius: .45rem; background: #f8ce83; color: #352719; font-size: 1.25rem; line-height: 1; }

.game { max-width: 53rem; margin-inline: auto; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(.85rem, 4vw, 2.25rem); padding: clamp(.9rem, 3.2vw, 1.5rem); margin-bottom: 1rem; }
.meter__header { display: flex; justify-content: space-between; align-items: baseline; gap: .2rem .5rem; flex-wrap: wrap; margin-bottom: .52rem; font-size: .9rem; font-weight: 700; }
.meter__header strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.meter--timer strong { color: #864309; }
.meter--round strong { color: #205791; }
.meter__track { height: .7rem; overflow: hidden; border-radius: 999px; }
.meter__track span { display: block; width: 100%; height: 100%; border-radius: inherit; transform-origin: left; }
.meter--timer .meter__track { background: #f4e5cf; }
.meter--timer .meter__track span { background: var(--amber); }
.meter--timer .meter__track[data-low="true"] span { background: #bb432c; }
.meter--round .meter__track { background: #e0eaf4; }
.meter--round .meter__track span { background: var(--blue); transform: scaleX(0); transition: transform 260ms ease-out; }

.question { position: relative; isolation: isolate; padding: clamp(1rem, 4vw, 2.1rem); text-align: center; }
.question__header { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-bottom: clamp(1.2rem, 4vw, 2rem); }
.question__number { padding: .34rem .65rem; border-radius: .5rem; background: #e8eee2; color: #24513d; font-weight: 800; }
.live-score { color: var(--muted); font-size: .91rem; font-weight: 700; }
.live-score strong { margin-left: .16em; color: var(--ink); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.tiles { width: min(100%, 28rem); gap: clamp(.34rem, 1.4vw, .85rem); margin: 0 auto; border-radius: .85rem; }
.tile { border: 1px solid #dde2d3; background: #f2f3e9; font-size: clamp(1.9rem, 7vw, 4.05rem); }
.tile--blank { border: 2px dashed #b07932; background: #fff4de; color: #79531e; }
.tile--revealed { border: 2px solid #4e805f; background: #dcefe0; color: #20553d; }
.question-clue { margin: 1rem auto 1.4rem; max-width: 38rem; color: var(--muted); line-height: 1.55; }
.question-clue > span:first-child { margin-inline-end: .26rem; color: var(--ink); font-weight: 800; }

.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.55rem, 1.7vw, .85rem); max-width: 35rem; margin-inline: auto; }
.choice {
  display: grid;
  place-items: center;
  min-height: 4.1rem;
  padding: .45rem .35rem;
  border: 1px solid #9caf9d;
  border-radius: .8rem;
  background: #fbfcf7;
  box-shadow: 0 3px 0 #dce4d7;
  color: var(--ink);
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.choice:disabled { cursor: default; box-shadow: none; }
@media (hover: hover) { .choice:hover:not(:disabled) { background: #e7f0e3; border-color: #4d795f; } }
.choice:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #dce4d7; }
.choice[data-mark="correct"] { color: #194e34; border: 2px solid #3c7957; background: #dcefe0; }
.choice[data-mark="incorrect"] { color: #8c321d; border: 2px solid #ba644d; background: #fce8e0; }

.feedback-space { display: grid; place-items: center; min-height: 2.7rem; margin-top: .9rem; }
.feedback { margin: 0; font-weight: 800; line-height: 1.5; }
.feedback[data-result="correct"] { color: #215a3d; }
.feedback[data-result="incorrect"], .feedback[data-result="timeout"] { color: #8c321d; }

.celebration { position: absolute; z-index: 1; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.celebration span {
  position: absolute;
  top: 32%;
  left: 50%;
  width: .56rem;
  height: .8rem;
  border-radius: .14rem;
  background: var(--spark-color);
  animation: burst 820ms ease-out both;
}

@keyframes burst {
  0% { opacity: 0; transform: scale(.25); }
  12% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) rotate(var(--spark-turn)); }
}

.results { max-width: 53rem; margin-inline: auto; padding: clamp(1rem, 4vw, 1.8rem); }
.result-card {
  display: grid;
  justify-items: center;
  padding: clamp(1.3rem, 6vw, 3.4rem) .8rem;
  border: 1px solid #dbe6d7;
  border-radius: 1rem;
  background: radial-gradient(ellipse at 50% 28%, #edf5e6, #f8f9ef 75%);
  text-align: center;
}
.result-card h1 { margin: 0 0 1.3rem; font-size: clamp(2rem, 5.3vw, 3.25rem); }
.result-score-label { margin: 0; color: var(--muted); font-weight: 700; }
.result-total { display: flex; gap: .34rem; align-items: baseline; margin: .12rem 0 .75rem; color: var(--green); font-weight: 700; }
.result-total strong { font-size: clamp(3.65rem, 11vw, 6.25rem); font-weight: 900; line-height: 1.06; }
.result-correct { margin: 0 0 1.7rem; color: var(--muted); font-weight: 700; }
.result-correct strong { color: var(--ink); }
.noscript { color: #8c321d; font-weight: 700; }

@media (max-width: 44rem) {
  .layout { width: calc(100% - 2rem); }
  .welcome { grid-template-columns: 1fr; min-height: auto; }
  .welcome h1 span { display: inline; }
  .welcome-example { place-items: start center; }
  .example-content { width: min(100%, 19rem); }
  .example-tiles > span { font-size: clamp(1.55rem, 7vw, 2.55rem); }
}

@media (max-width: 30rem) {
  .layout { width: calc(100% - 1.25rem); }
  .surface { border-radius: 1.15rem; }
  .welcome h1 { font-size: clamp(1.95rem, 9vw, 2.65rem); }
  .welcome-description { margin-top: .8rem; }
  .rules { margin-block: 1rem; padding-block: .75rem; }
  .welcome .primary-button { width: 100%; }
  .meters { margin-bottom: .7rem; }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice { min-height: 3.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .meter--round .meter__track span { transition: none; }
  .celebration { display: none; }
}
