* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #fff8ef;
  color: #1d2a7a;
}
header { text-align: center; padding: 20px 16px 6px; }
h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 4vw, 2.2rem); }
header p { margin: 0 0 12px; color: #333; line-height: 1.6; }
.toolbar { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.toolbar button, .toolbar a {
  font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: 9px 18px;
  background: #e0201b; color: #fff; cursor: pointer; text-decoration: none;
}
.toolbar a { background: #1d2a7a; }
.toolbar label { color: #333; cursor: pointer; }
button:focus-visible, a:focus-visible, .card:focus-visible { outline: 3px solid #1d2a7a; outline-offset: 3px; }

main {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  max-width: 1100px; margin: 14px auto; padding: 0 12px;
}
@media (max-width: 760px) { main { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { main { grid-template-columns: 1fr; } }

.card {
  position: relative; border-radius: 16px; cursor: pointer; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  -webkit-tap-highlight-color: transparent;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.card svg { display: block; width: 100%; height: auto; }
.title {
  position: absolute; top: 3.5%; left: 0; right: 0; text-align: center; pointer-events: none;
  font-family: "Times New Roman", "Cambria Math", serif; font-style: italic;
  font-size: clamp(1rem, 2.4vw, 1.6rem); color: #1d2a7a;
}
.title .up { font-style: normal; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; font-size: .8em; line-height: 1; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 2px; }
.hint {
  position: absolute; right: 10px; bottom: 8px; font-size: .78rem; color: #333;
  background: rgba(255,255,255,.75); padding: 2px 8px; border-radius: 999px; pointer-events: none;
  opacity: .85;
}
.card.playing .hint { opacity: 0; }
footer { text-align: center; color: #555; font-size: .85rem; padding: 6px 16px 26px; }
