:root {
  color-scheme: dark;
  --bg: #03130f;
  --panel: rgba(5, 38, 29, 0.9);
  --panel-strong: rgba(15, 66, 51, 0.92);
  --line: rgba(242, 206, 117, 0.22);
  --text: #f7f2df;
  --muted: #b7cbc3;
  --gold: #f2ce75;
  --tile-w: clamp(31px, 6.7vw, 52px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 78px; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0, rgba(35, 126, 91, 0.34), transparent 38rem), linear-gradient(145deg, #0b3026, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  line-height: 1.55;
}
img { display: block; }
.guide-page {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(32px, env(safe-area-inset-bottom));
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px -14px 14px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 19, 15, 0.88);
  backdrop-filter: blur(12px);
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.12em;
}
.back, .play-card > a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}
.hero, .guide-card, .play-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--panel-strong), var(--panel));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: clamp(18px, 4vw, 32px);
  overflow: hidden;
}
.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 6vw, 44px); line-height: 1.1; }
h2 { margin-bottom: 5px; font-size: clamp(20px, 4.4vw, 28px); line-height: 1.25; }
.hero p, .card-copy p, .play-card p { margin-bottom: 0; color: var(--muted); }
.hero-tiles, .tiles { display: flex; align-items: flex-end; gap: 0; }
.hero-tiles { filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.3)); transform: rotate(2deg); }
.hero-tiles img, .tiles img, .winning-tile img { width: var(--tile-w); height: auto; }
.step-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.step-nav a {
  padding: 9px 5px;
  border: 1px solid rgba(151, 195, 183, 0.28);
  border-radius: 12px;
  background: rgba(5, 38, 29, 0.72);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}
.guide-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0 12px;
  margin: 12px 0;
  padding: 18px;
}
.step-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(242, 206, 117, 0.48);
  border-radius: 50%;
  background: rgba(242, 206, 117, 0.11);
  color: var(--gold);
  font-size: 20px;
  font-weight: 900;
}
.card-copy { align-self: center; }
.tile-kinds, .finished-hand, .wait-example, .yaku-choices, .warning { grid-column: 1 / -1; margin-top: 16px; }
.tile-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kind-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.12);
}
.kind-row strong { flex: 0 0 auto; color: var(--gold); }
.kind-row small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.honors-row { grid-column: 1 / -1; }
.finished-hand {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(4px, 1vw, 10px);
  padding: 14px 8px 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  overflow: hidden;
}
.finished-hand figure { min-width: 0; margin: 0; }
.finished-hand img { min-width: 0; max-width: var(--tile-w); }
.finished-hand figcaption { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
.wait-example {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
}
.wait-example .waiting { padding: 5px; border: 2px solid rgba(255, 255, 255, 0.15); border-radius: 8px; }
.plus { color: var(--gold); font-size: 25px; font-weight: 900; }
.winning-tile { display: flex; align-items: center; gap: 6px; }
.winning-tile img { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 5px; }
.winning-tile strong { color: var(--muted); font-size: 11px; }
.wait-example p { margin: 0 0 0 4px; color: var(--muted); }
.wait-example b { color: var(--gold); }
.yaku-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.yaku-choices article {
  position: relative;
  min-height: 144px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
}
.yaku-choices article > strong { display: block; margin-top: 8px; color: var(--gold); font-size: 18px; }
.yaku-choices p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.choice-mark { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--gold); color: #193229; font-size: 11px; font-weight: 900; }
.tiles.mini img { width: clamp(28px, 5vw, 40px); }
.warning { padding: 10px 12px; border: 1px solid rgba(242, 206, 117, 0.34); border-radius: 12px; background: rgba(242, 206, 117, 0.08); color: var(--muted); font-size: 14px; }
.warning strong { color: var(--gold); }
.play-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; margin-top: 12px; padding: 18px; }
.play-card h2 { margin-bottom: 4px; }
.play-card > a { min-width: 112px; border-color: rgba(242, 206, 117, 0.55); background: linear-gradient(#f4d786, #c89b3c); color: #1b2c25; }

@media (max-width: 620px) {
  :root { --tile-w: clamp(28px, 9vw, 43px); }
  .hero, .play-card { grid-template-columns: 1fr; }
  .hero-tiles { justify-self: center; }
  .tile-kinds, .yaku-choices { grid-template-columns: 1fr; }
  .honors-row { grid-column: auto; }
  .finished-hand { justify-content: flex-start; }
  .finished-hand img { width: min(var(--tile-w), 6.2vw); }
  .wait-example { flex-wrap: wrap; }
  .wait-example p { flex-basis: 100%; text-align: center; }
  .yaku-choices article { min-height: 0; }
}

@media (orientation: landscape) and (max-height: 500px) {
  :root { --tile-w: clamp(29px, 5vw, 40px); }
}
