/* 都道府県HiGH&LOW style.css — 構造とクラス名は docs/design.md */

:root {
  --c-ink: #3b2f2f;
  --c-ink-sub: #7a6a5e;
  --c-paper: #fffdf7;
  --c-bg: #fff6e4;
  --c-line: #eadcc0;
  --c-shu: #e8513b;
  --c-shu-deep: #b83a28;
  --c-ai: #2f4b7c;
  --c-ai-deep: #1e3256;
  --c-gold: #ffc83d;
  --c-gold-deep: #d99a00;
  --c-matcha: #7bc96f;
  --c-matcha-deep: #4fa443;
  --c-sky: #d9eefb;

  --c-a: var(--c-ai);
  --c-a-soft: #dfe6f2;
  --c-b: var(--c-shu);
  --c-b-soft: #fbdcd6;
  --c-high: var(--c-shu);
  --c-high-deep: var(--c-shu-deep);
  --c-low: var(--c-ai);
  --c-low-deep: var(--c-ai-deep);

  --font-base: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic",
    "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-num: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "SF Pro Rounded",
    ui-rounded, system-ui, sans-serif;

  --radius-s: 10px;
  --radius-m: 18px;
  --radius-l: 28px;
  --border: 3px solid var(--c-ink);
  --shadow-hard: 0 5px 0 var(--c-ink);
  --btn-depth: 6px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --dur-fast: 0.15s;
  --dur-mid: 0.35s;
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font-base);
  color: var(--c-ink);
  background-color: var(--c-bg);
  background-image:
    radial-gradient(rgba(184, 155, 106, 0.22) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
  line-height: 1.5;
}

button { font: inherit; color: inherit; }

.app {
  position: relative;
  max-width: 520px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
}

.num {
  font-family: var(--font-num);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 画面切替 ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(14px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s linear var(--dur-mid);
  overflow-y: auto;
}

.screen.is-active {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s;
}

/* ---------- ボタン ---------- */

.btn {
  --btn-bg: var(--c-shu);
  --btn-edge: var(--c-shu-deep);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 12px 28px;
  border: var(--border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter var(--dur-fast);
}

.btn::after {
  content: "";
  position: absolute;
  top: 5px; left: 18%; right: 18%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.btn:active, .btn.is-pressed {
  transform: translateY(var(--btn-depth));
  box-shadow: 0 0 0 var(--btn-edge), 0 0 0 3px var(--c-ink);
}

.btn:focus-visible, .link-btn:focus-visible {
  outline: 4px solid var(--c-gold);
  outline-offset: 4px;
}

.btn:disabled {
  filter: grayscale(0.7) opacity(0.6);
  cursor: not-allowed;
  transform: translateY(var(--btn-depth));
  box-shadow: 0 0 0 var(--btn-edge), 0 0 0 3px var(--c-ink);
}

.btn--block { display: flex; width: 100%; }
.btn--secondary { --btn-bg: var(--c-ai); --btn-edge: var(--c-ai-deep); }
.btn--gold { --btn-bg: var(--c-gold); --btn-edge: var(--c-gold-deep); --btn-fg: var(--c-ink); }
.btn--green { --btn-bg: var(--c-matcha); --btn-edge: var(--c-matcha-deep); }
.btn--ghost { --btn-bg: var(--c-paper); --btn-edge: var(--c-line); --btn-fg: var(--c-ink); }
.btn--small { min-height: 42px; padding: 6px 18px; font-size: 15px; --btn-depth: 4px; }
.btn--small::after { top: 4px; height: 4px; }

.link-btn {
  border: 0; background: none; padding: 4px 2px;
  color: var(--c-ink-sub); font-size: 13px; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ---------- ロゴ ---------- */

.logo {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.logo__sub {
  display: inline-block;
  padding: 4px 14px;
  border: var(--border);
  border-radius: 999px;
  background: var(--c-paper);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3em;
  box-shadow: 0 3px 0 var(--c-ink);
}

.logo__main {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-top: 14px;
}

.logo__word {
  display: inline-block;
  padding: 10px 12px 8px;
  border: var(--border);
  border-radius: 16px;
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 40px;
  letter-spacing: 0.02em;
  color: #fff;
  box-shadow: 0 5px 0 var(--c-ink);
  text-shadow: 0 3px 0 rgba(59, 47, 47, 0.35);
}

.logo__word--high {
  background: var(--c-high);
  transform: translateY(-14px) rotate(-4deg);
  animation: logo-high 2.4s ease-in-out infinite;
}

.logo__word--low {
  background: var(--c-low);
  transform: translateY(10px) rotate(3deg);
  animation: logo-low 2.4s ease-in-out infinite;
}

.logo__amp {
  align-self: center;
  font-family: var(--font-num);
  font-size: 34px;
  font-weight: 900;
  color: var(--c-gold);
  -webkit-text-stroke: 2px var(--c-ink);
  paint-order: stroke;
}

@keyframes logo-high {
  0%, 100% { transform: translateY(-14px) rotate(-4deg); }
  50% { transform: translateY(-4px) rotate(-2deg); }
}

@keyframes logo-low {
  0%, 100% { transform: translateY(10px) rotate(3deg); }
  50% { transform: translateY(0) rotate(1deg); }
}

/* ---------- タイトル ---------- */

.screen--title {
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.title__mascot { width: 120px; height: 120px; }

.title__lead { margin: 0; font-size: 16px; font-weight: 700; }
.title__lead strong { color: var(--c-shu); }

.title__actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(100%, 300px);
}

.title__best {
  margin: 0;
  padding: 6px 16px;
  border: 2px dashed var(--c-line);
  border-radius: 999px;
  background: var(--c-paper);
  font-size: 14px;
  font-weight: 700;
}

.title__best .num { font-size: 20px; color: var(--c-shu); }

/* ---------- 共通パネル ---------- */

.panel {
  border: var(--border);
  border-radius: var(--radius-l);
  background: var(--c-paper);
  box-shadow: var(--shadow-hard);
  padding: 20px 18px;
}

.panel__title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

/* ---------- ルール ---------- */

.screen--rules { justify-content: center; }

.rules__steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }

.rules__step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
}

.rules__no {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: var(--border); border-radius: 50%;
  background: var(--c-gold);
  font-family: var(--font-num); font-weight: 900;
}

.rules__step em { white-space: nowrap; font-style: normal; padding: 0 4px; border-radius: 6px; color: #fff; }
.rules__step em.is-high { background: var(--c-high); }
.rules__step em.is-low { background: var(--c-low); }

/* ---------- プレイ ---------- */

.screen--play { gap: 10px; padding-top: calc(10px + var(--safe-top)); }

.play-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 4px 6px;
  border: var(--border);
  border-radius: 999px;
  background: var(--c-paper);
  box-shadow: 0 3px 0 var(--c-ink);
}

.streak__flame { width: 34px; height: 34px; }
.streak__label { font-size: 12px; font-weight: 800; color: var(--c-ink-sub); }
.streak__value { font-size: 26px; line-height: 1; }
.streak__unit { font-size: 13px; font-weight: 800; }
.streak.is-bump .streak__value { animation: bump 0.45s var(--ease-pop); }
.streak.is-hot { background: #fff4cc; }

.play-head__best { font-size: 12px; font-weight: 700; color: var(--c-ink-sub); text-align: right; }
.play-head__best .num { font-size: 16px; color: var(--c-ink); }

.theme {
  position: relative;
  padding: 10px 14px 8px;
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--c-paper);
  box-shadow: 0 4px 0 var(--c-ink);
  text-align: center;
}

.theme__name {
  margin: 0;
  font-size: clamp(17px, 5.4vw, 22px);
  font-weight: 900;
  line-height: 1.25;
}

.theme__unit { font-size: 13px; font-weight: 700; color: var(--c-ink-sub); margin-left: 4px; }

.theme__src {
  margin: 2px 0 0;
  font-size: 10px;
  line-height: 1.4;
  color: var(--c-ink-sub);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theme.is-swap { animation: theme-in 0.4s var(--ease-pop); }

@keyframes theme-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.duel {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}

.card {
  --card-c: var(--c-a);
  --card-soft: var(--c-a-soft);
  --shape-size: clamp(64px, 14dvh, 120px);
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas: "shape name" "shape value";
  column-gap: 10px;
  align-items: center;
  padding: 10px 14px 12px 12px;
  border: var(--border);
  border-radius: var(--radius-l);
  background: var(--c-paper);
  box-shadow: 0 5px 0 var(--c-ink);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  background: var(--card-soft);
  border-right: 2px dashed rgba(59, 47, 47, 0.18);
  pointer-events: none;
}

.card--b { --card-c: var(--c-b); --card-soft: var(--c-b-soft); }

.card__tag {
  position: absolute;
  left: 8px; top: 8px;
  z-index: 1;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: var(--border); border-radius: 10px;
  background: var(--card-c);
  color: #fff;
  font-family: var(--font-num); font-size: 20px; font-weight: 900;
  transform: rotate(-6deg);
}

.card__shape {
  grid-area: shape;
  position: relative;
  width: var(--shape-size);
  height: var(--shape-size);
  align-self: center;
}

.card__name {
  grid-area: name;
  position: relative;
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.1;
  text-align: right;
  align-self: center;
}

.card__kana { display: block; font-size: 11px; font-weight: 700; color: var(--c-ink-sub); letter-spacing: 0.1em; }

.card__value {
  grid-area: value;
  position: relative;
  margin: 0;
  text-align: right;
  white-space: nowrap;
  line-height: 1;
}

.card__value .num { font-size: 40px; color: var(--card-c); }
.card__value .unit { font-size: 15px; font-weight: 800; margin-left: 3px; }

.card__value.is-hidden .num {
  display: inline-grid; place-items: center;
  min-width: 2.2em; height: 1.25em;
  padding: 0 0.2em;
  border: var(--border); border-radius: 14px;
  background: repeating-linear-gradient(-45deg, var(--c-b-soft) 0 8px, #fff 8px 16px);
  color: var(--c-b);
  font-size: 36px;
  animation: hidden-wiggle 1.6s ease-in-out infinite;
}

.card__value.is-hidden .unit { visibility: hidden; }

@keyframes hidden-wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.card__value.is-counting .num { animation: none; }
.card.is-win { background: #fff4cc; }
.card.is-win::after {
  content: "たかい！";
  position: absolute; left: 52px; top: 12px;
  padding: 2px 10px;
  border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-gold);
  font-size: 12px; font-weight: 900;
}
.card.is-win.is-lower::after { content: "ひくい！"; }

.vs {
  position: absolute;
  left: 50%; top: 50%;
  z-index: 2;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  margin: -26px 0 0 -26px;
  border: var(--border); border-radius: 50%;
  background: var(--c-gold);
  font-family: var(--font-num); font-size: 16px; font-weight: 900;
  box-shadow: 0 3px 0 var(--c-ink);
}

.minimap {
  display: block;
  width: 66px;
  margin: -6px 0 -8px;
  pointer-events: none;
}

.ask {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

.ask b { color: var(--c-b); }

.hl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-bottom: 6px;
}

.btn-hl {
  --btn-depth: 8px;
  flex-direction: column;
  gap: 0;
  min-height: 84px;
  padding: 8px 10px;
  border-radius: var(--radius-l);
  font-size: 26px;
  line-height: 1.1;
}

.btn-hl__mark { font-size: 22px; line-height: 1; }
.btn-hl__sub { font-size: 11px; font-weight: 700; opacity: 0.9; letter-spacing: 0; }
.btn-hl--high { --btn-bg: var(--c-high); --btn-edge: var(--c-high-deep); }
.btn-hl--low { --btn-bg: var(--c-low); --btn-edge: var(--c-low-deep); }
.btn-hl--low .btn-hl__mark { order: -1; }
.btn-hl.is-chosen { outline: 4px solid var(--c-gold); outline-offset: 3px; }

.screen--play.is-judging .hl .btn:not(.is-chosen) { filter: grayscale(0.7) opacity(0.5); }

/* ---------- 答え合わせ ---------- */

.judge {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center start;
  padding-left: 6%;
  pointer-events: none;
}

.stamp {
  width: 132px; height: 132px;
  opacity: 0;
}

.judge.is-ok .stamp, .judge.is-ng .stamp {
  animation: stamp-in 0.42s var(--ease-pop) forwards;
}

@keyframes stamp-in {
  0% { opacity: 0; transform: scale(2.2) rotate(-14deg); }
  60% { opacity: 1; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

.screen--play.is-ok .duel { animation: ok-pop 0.4s var(--ease-pop); }
.screen--play.is-ng .duel { animation: ng-shake 0.45s ease; }

@keyframes ok-pop {
  50% { transform: scale(1.02); }
}

@keyframes ng-shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.trivia {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border: var(--border);
  border-radius: var(--radius-m);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-pop);
}

.trivia.is-show { opacity: 1; transform: none; }
.trivia__mascot { flex: none; width: 44px; height: 44px; }
.trivia__head { display: block; font-size: 11px; color: var(--c-shu); font-weight: 900; }

.next-row { display: none; }
.screen--play.is-judged .hl,
.screen--play.is-judged .ask { display: none; }
.screen--play.is-judged .next-row { display: block; padding-bottom: 6px; }

.burst {
  position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden;
}

.burst__piece {
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 14px;
  border: 2px solid var(--c-ink);
  border-radius: 3px;
  background: var(--c, var(--c-gold));
  animation: burst var(--dur, 0.8s) ease-out forwards;
}

@keyframes burst {
  from { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ---------- 結果 ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 14px calc(16px + var(--safe-bottom));
  background: rgba(59, 47, 47, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-mid) ease, visibility 0s linear var(--dur-mid);
  overflow-y: auto;
}

.overlay.is-open { opacity: 1; visibility: visible; transition: opacity var(--dur-mid) ease, visibility 0s; }

.result {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
}

.overlay.is-open .result { animation: result-in 0.45s var(--ease-pop); }

@keyframes result-in {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.result__label { margin: 0; font-size: 14px; font-weight: 800; color: var(--c-ink-sub); }

.result__streak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 4px;
}

.result__flame { width: 56px; height: 56px; }
.result__streak .num { font-size: 64px; line-height: 1; color: var(--c-shu); }
.result__streak-unit { font-size: 20px; font-weight: 900; align-self: flex-end; padding-bottom: 8px; }

.result__best { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.result__best .num { font-size: 18px; }

.result__record {
  display: none;
  margin: 0 auto 10px;
  padding: 3px 14px;
  width: fit-content;
  border: 2px solid var(--c-ink); border-radius: 999px;
  background: var(--c-gold);
  font-size: 13px; font-weight: 900;
  transform: rotate(-3deg);
}

.result.is-new-record .result__record { display: block; animation: bump 0.6s var(--ease-pop) 0.3s both; }

.miss {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 2px dashed var(--c-line);
  border-radius: var(--radius-m);
  background: #fff;
  text-align: left;
}

.miss__theme { margin: 0 0 6px; font-size: 13px; font-weight: 900; }
.miss__theme small { font-weight: 700; color: var(--c-ink-sub); }

.miss__row {
  display: grid;
  grid-template-columns: 26px 38px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 15px;
  font-weight: 800;
}

.miss__row + .miss__row { border-top: 1px solid var(--c-line); }
.miss__tag {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border: 2px solid var(--c-ink); border-radius: 7px;
  color: #fff; font-family: var(--font-num); font-size: 13px; font-weight: 900;
  background: var(--c-a);
}
.miss__row--b .miss__tag { background: var(--c-b); }
.miss__shape { width: 38px; height: 38px; }
.miss__value { text-align: right; white-space: nowrap; }
.miss__value .num { font-size: 18px; }
.miss__value .unit { font-size: 11px; margin-left: 2px; }
.miss__row.is-higher .miss__value .num { color: var(--c-shu); }
.miss__row.is-higher .miss__value::before { content: "▲ "; color: var(--c-shu); font-size: 11px; }
.miss__choice { margin: 6px 0 0; font-size: 12px; font-weight: 700; color: var(--c-ink-sub); }

.result__actions { display: grid; gap: 14px; }
.result__share { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result__links { margin-top: 10px; display: flex; justify-content: center; gap: 16px; }

/* ---------- 出典一覧 ---------- */

.screen--sources { gap: 12px; }

.sources__head { display: flex; align-items: center; gap: 10px; }
.sources__head .panel__title { margin: 0; flex: 1; text-align: left; }
.sources__note { margin: 0; font-size: 12px; color: var(--c-ink-sub); }

.sources__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.src {
  padding: 10px 12px;
  border: 2px solid var(--c-ink);
  border-radius: var(--radius-s);
  background: var(--c-paper);
  font-size: 12px;
  line-height: 1.5;
}

.src__name { display: block; font-size: 15px; font-weight: 900; }
.src__unit { font-size: 11px; font-weight: 700; color: var(--c-ink-sub); margin-left: 4px; }
.src__body { display: block; color: var(--c-ink-sub); }
.src a { color: var(--c-ai); font-weight: 700; word-break: break-all; }

/* ---------- トースト ---------- */

.toast {
  position: absolute;
  left: 50%; bottom: calc(110px + var(--safe-bottom));
  z-index: 30;
  padding: 8px 18px;
  border: var(--border); border-radius: 999px;
  background: var(--c-ink); color: #fff;
  font-size: 14px; font-weight: 800;
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s var(--ease-pop);
  pointer-events: none;
}

.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- レイアウト: 小さい画面 ---------- */

@media (max-height: 680px) {
  .card__kana { display: none; }
  .trivia { font-size: 12px; padding: 6px 10px 6px 6px; }
  .trivia__mascot { width: 36px; height: 36px; }
  .card__name { font-size: 24px; }
  .card__value .num { font-size: 32px; }
  .btn-hl { min-height: 70px; font-size: 22px; }
  .theme__name { font-size: 19px; }
}

/* ---------- レイアウト: PC / 横向き（A と B を左右） ---------- */

@media (min-aspect-ratio: 1/1) and (min-width: 640px) {
  .app { max-width: 980px; }
  .screen--play { padding-left: 24px; padding-right: 24px; }
  .duel { grid-template-rows: 1fr; grid-template-columns: 1fr 1fr; gap: 30px; }
  .card {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "name" "shape" "value";
    justify-items: center;
    text-align: center;
    padding: 14px;
    --shape-size: min(180px, 30vh);
  }
  .card::before { inset: 0 0 auto 0; width: auto; height: 56%; border-right: 0; border-bottom: 2px dashed rgba(59, 47, 47, 0.18); }
  .card__name { text-align: center; }
  .card__value { text-align: center; }
  .minimap { width: 72px; }
  .judge { place-items: center; padding-left: 0; }
  .stamp { width: 160px; height: 160px; }
  .card.is-win::after { left: auto; right: 14px; }
  .hl { width: min(100%, 560px); margin: 0 auto; }
  .next-row { width: min(100%, 360px); margin: 0 auto; }
  .trivia { width: min(100%, 640px); margin: 0 auto; }
}

/* スマホ横: 「縦にしてね」表示（.rotate-hint を .app の外に置く） */
.rotate-hint { display: none; }

@media (orientation: landscape) and (max-height: 460px) and (pointer: coarse) {
  .app { display: none; }
  .rotate-hint { display: flex; }
}

.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--c-bg);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.rotate-hint__phone {
  width: 54px; height: 90px;
  border: var(--border); border-radius: 12px;
  background: var(--c-paper);
  box-shadow: inset 0 -10px 0 var(--c-line);
  animation: rotate-phone 2s ease-in-out infinite;
}

.rotate-hint.is-force { display: flex; }

@keyframes rotate-phone {
  0%, 30% { transform: rotate(-90deg); }
  60%, 100% { transform: rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001s !important;
  }
  .logo__word, .card__value.is-hidden .num { animation: none !important; }
  .screen--play.is-ng .duel, .screen--play.is-ok .duel { animation: none !important; }
  .burst { display: none; }
  .rotate-hint__phone { animation: none !important; }
  .judge.is-ok .stamp, .judge.is-ng .stamp { animation: none !important; opacity: 1; }
}

.screen--title > a.back-to-games {
  position: absolute; top: calc(12px + var(--safe-top)); left: calc(12px + env(safe-area-inset-left, 0px)); z-index: 6;
  display: inline-flex; align-items: center; padding: 6px 12px 7px;
  font: 700 13px/1 var(--font-base); color: var(--c-ink); text-decoration: none;
  background: var(--c-paper); border: 3px solid var(--c-ink); border-radius: 999px; box-shadow: 0 3px 0 var(--c-ink);
}
.screen--title > a.back-to-games[hidden] { display: none; }
.screen--title > a.back-to-games:active { transform: translateY(3px); box-shadow: none; }
.screen--title:has(> a.back-to-games:not([hidden])) { padding-top: calc(56px + var(--safe-top)); justify-content: safe center; }
@media (max-height: 760px) {
  .screen--title:has(> a.back-to-games:not([hidden])) { gap: 12px; }
  .screen--title:has(> a.back-to-games:not([hidden])) .title__mascot { width: 84px; height: 84px; }
}
