:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --panel: #ffffff;
  --ink: #1b241f;
  --muted: #5f6d66;
  --line: #d9e1dc;
  --green: #1d8f61;
  --green-dark: #0f6b48;
  --blue: #276fbf;
  --amber: #b87014;
  --danger: #ba3b38;
  --shadow: 0 18px 42px rgba(24, 48, 35, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[id] {
  scroll-margin-top: 92px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.55;
}

body,
input,
textarea,
select,
button {
  overflow-wrap: break-word;
  word-break: keep-all;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(39, 111, 191, 0.55);
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(246, 248, 245, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.hamburger-menu {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px;
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.hamburger-menu span + span {
  margin-top: 6px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

nav a {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

nav a:hover {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 22px;
  padding: 42px 0 22px;
}

.tool-main,
.tool-visual,
.diagnosis-card,
.game-board,
.guide-article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tool-main {
  padding: clamp(22px, 4vw, 34px);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-size: 0.84rem;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.18;
}

h1 {
  max-width: 720px;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.lead {
  max-width: 680px;
  margin: 14px 0 22px;
  color: var(--muted);
  font-size: 1.05rem;
}

.upload-panel {
  border: 2px dashed #aac4b5;
  border-radius: 8px;
  background: #f9fcfa;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-panel.is-dragging {
  border-color: var(--green);
  background: #eef9f3;
}

.upload-panel input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-panel label {
  display: grid;
  min-height: 150px;
  place-items: center;
  gap: 4px;
  padding: 22px;
  color: var(--muted);
  cursor: pointer;
}

.upload-panel strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.controls label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.controls input,
.controls select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.quality-control {
  grid-column: span 1;
}

.quality-control input {
  padding: 0;
  accent-color: var(--green);
}

.actions,
.game-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.secondary:hover {
  border-color: #b7c4bd;
  background: #f5f8f6;
}

.status {
  min-height: 28px;
  margin: 14px 0 0;
  color: var(--muted);
}

.tool-visual {
  align-self: stretch;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.tool-visual img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.visual-note {
  display: grid;
  gap: 3px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.visual-note span {
  color: var(--muted);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 160px;
  padding: 10px 0 26px;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed #b7c4bd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.empty-state h2 {
  font-size: 1.25rem;
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.result-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(24, 48, 35, 0.07);
}

.preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-pair figure {
  min-width: 0;
  margin: 0;
}

.preview-pair img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: #eef2ef;
  object-fit: cover;
}

.preview-pair figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.result-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  border-radius: 7px;
  background: #f4f7f5;
  padding: 9px;
}

.stat span,
.meter span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat strong {
  display: block;
  margin-top: 2px;
}

.download-link {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.diagnosis {
  padding: 8px 0 32px;
}

.diagnosis h2 {
  margin-bottom: 12px;
  font-size: 1.35rem;
}

.diagnosis-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.score {
  display: grid;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #e9f7ef;
  color: var(--green-dark);
  font-size: 1.55rem;
  font-weight: 900;
}

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

.utilities {
  padding: 12px 0 34px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 18px;
}

.section-heading p,
.utility-card p,
.tool-note {
  color: var(--muted);
}

.utility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.utility-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: clamp(18px, 3vw, 24px);
  box-shadow: 0 12px 28px rgba(24, 48, 35, 0.08);
}

.utility-card h3 {
  margin: 0;
  font-size: 1.28rem;
}

.utility-card p {
  margin: 0;
}

.utility-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

.utility-card input,
.utility-card select,
.utility-card textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.utility-card textarea {
  resize: vertical;
}

.inline-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
}

.check-list input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
  accent-color: var(--green);
}

.result-box {
  min-height: 96px;
  border-radius: 8px;
  background: #f4f7f5;
  padding: 14px;
  color: var(--ink);
}

.result-box strong {
  color: var(--green-dark);
}

.result-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

#qrCanvas {
  width: min(100%, 300px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.secondary-link {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  text-decoration: none;
  font-weight: 800;
}

.secondary-link.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.game-section {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(320px, 1.25fr);
  gap: 20px;
  align-items: start;
  padding: 30px 0;
}

.game-section p {
  color: var(--muted);
}

.game-board {
  padding: 18px;
}

.meter {
  display: inline-grid;
  min-width: 130px;
  margin: 0 8px 14px 0;
  border-radius: 8px;
  background: #f4f7f5;
  padding: 12px;
}

.meter strong {
  font-size: 1.35rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-grid button {
  min-height: 72px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.choice-grid button:hover {
  border-color: var(--green);
}

.choice-grid button.is-picked {
  border-color: var(--green);
  background: #ecf8f1;
  color: var(--green-dark);
}

.game-actions {
  margin-top: 14px;
}

.game-actions p {
  margin: 0;
}

.arcade-section {
  padding: 30px 0;
  scroll-margin-top: 92px;
}

.arcade-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.55fr) minmax(0, 1.45fr);
  gap: 16px;
}

.arcade-menu {
  display: grid;
  gap: 10px;
}

.arcade-tile {
  display: grid;
  gap: 5px;
  min-height: 92px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.arcade-tile span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.arcade-tile.is-active {
  border-color: var(--green);
  background: #ecf8f1;
  color: var(--green-dark);
}

.arcade-stage {
  min-width: 0;
  border: 1px solid rgba(20, 108, 73, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 249, 244, 0.96)),
    #fff;
  padding: clamp(16px, 3vw, 22px);
  box-shadow:
    0 18px 42px rgba(16, 107, 72, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.arcade-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.arcade-head h3 {
  margin: 0;
  font-size: 1.45rem;
}

.arcade-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.arcade-score {
  display: grid;
  min-width: 84px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.9), transparent 42%),
    #eff7f3;
  padding: 10px;
  text-align: center;
}

.arcade-score span {
  color: var(--muted);
  font-size: 0.82rem;
}

.arcade-score strong {
  font-size: 1.45rem;
}

.arcade-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.arcade-settings span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.arcade-settings button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.arcade-settings button.is-active {
  border-color: var(--green);
  background: #ecf8f1;
  color: var(--green-dark);
}

.arcade-daily {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(124px, 0.36fr) auto auto;
  align-items: center;
  gap: 10px;
  margin: -2px 0 14px;
  border: 1px solid rgba(39, 111, 191, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(239, 246, 255, 0.92)),
    #ffffff;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.arcade-daily span {
  display: block;
  color: #276fbf;
  font-size: 0.75rem;
  font-weight: 900;
}

.arcade-daily strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 1rem;
}

.arcade-daily p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.arcade-daily b {
  color: #1d8f61;
  font-size: 0.95rem;
  white-space: nowrap;
}

.arcade-daily button {
  min-height: 40px;
  background: #276fbf;
  padding: 0 13px;
}

.arcade-daily.is-done {
  border-color: rgba(29, 143, 97, 0.34);
  background:
    linear-gradient(135deg, rgba(236, 248, 241, 0.96), rgba(255, 251, 230, 0.92)),
    #ffffff;
}

.daily-meter {
  position: relative;
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #dce9f5;
}

.daily-meter i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d8f61, #ffd23c);
}

.arcade-play {
  min-height: 320px;
  border: 1px solid rgba(16, 107, 72, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(29, 143, 97, 0.04), rgba(39, 111, 191, 0.05)),
    #f7faf8;
  padding: 14px;
  box-shadow: inset 0 0 28px rgba(16, 107, 72, 0.06);
}

.arcade-play.is-mahjong-play {
  padding: 10px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 220, 116, 0.1), transparent 42%),
    #eef7f2;
}

.arcade-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

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

.arcade-ranking {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid rgba(29, 143, 97, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(232, 246, 239, 0.9)),
    #f4faf7;
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

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

.ranking-head strong,
.arcade-ranking > strong {
  color: var(--green-dark);
  font-size: 0.95rem;
}

.arcade-ranking span,
.arcade-ranking small {
  color: var(--muted);
  font-size: 0.84rem;
}

.ranking-empty {
  border: 1px dashed rgba(29, 143, 97, 0.22);
  border-radius: 7px;
  padding: 10px;
}

.arcade-ranking ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.arcade-ranking li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(29, 143, 97, 0.12);
  border-radius: 7px;
  background: rgba(255,255,255,0.66);
  padding: 7px 8px;
}

.ranking-medal {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: #123f2d;
  color: #fff;
  font-style: normal;
  font-weight: 900;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}

.arcade-ranking b {
  color: var(--ink);
}

.game-page {
  background:
    radial-gradient(circle at 12% 10%, rgba(29, 143, 97, 0.15), transparent 28%),
    linear-gradient(135deg, #f6f8f5 0%, #eef4f1 48%, #f8f3e8 100%);
}

.game-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 42px 0 18px;
}

.mahjong-page-shell {
  margin-bottom: 28px;
}

.mahjong-game {
  display: grid;
  gap: 12px;
}

.mahjong-toolbar {
  display: grid;
  grid-template-columns: minmax(140px, 1.25fr) repeat(4, minmax(72px, 0.75fr));
  gap: 8px;
}

.mahjong-field,
.mahjong-stat {
  display: grid;
  min-width: 0;
  border: 1px solid rgba(27, 36, 31, 0.12);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.mahjong-field span,
.mahjong-stat span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.mahjong-field select {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

.mahjong-stat strong {
  font-size: 1.02rem;
}

.mahjong-timer {
  position: relative;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(17, 94, 62, 0.28);
  border-radius: 999px;
  background: rgba(15, 107, 72, 0.12);
}

.mahjong-timer span {
  position: absolute;
  inset: 0;
  transform: scaleX(1);
  transform-origin: left center;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a168, #ffd166 62%, #ff7a59);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.34);
  transition: transform 0.24s ease, background 0.2s ease;
}

.mahjong-timer.is-countup span {
  background: linear-gradient(90deg, #2f80ed, #35c78a);
}

.mahjong-timer.is-warning span {
  background: linear-gradient(90deg, #ffbf47, #ff6b4a);
}

.mahjong-timer.is-critical span {
  animation: mahjong-timer-pulse 0.7s ease-in-out infinite alternate;
}

.mahjong-streak {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  border: 1px solid rgba(17, 94, 62, 0.16);
  border-radius: 8px;
  background: #f4fbf7;
  color: #115e3e;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-weight: 900;
}

.mahjong-board-wrap {
  position: relative;
  z-index: 2;
  overflow: hidden;
  border: 1px solid #0f6b48;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 42%),
    radial-gradient(circle at 50% 45%, rgba(255, 220, 116, 0.16), transparent 34%),
    #0f6b48;
  box-shadow: inset 0 0 42px rgba(5, 55, 34, 0.4);
}

.mahjong-board {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  aspect-ratio: var(--mahjong-board-ratio, 12.4 / 8.2);
  margin: 0 auto;
  padding: 0;
}

.mahjong-tile {
  position: absolute;
  display: grid;
  aspect-ratio: 0.78 / 1;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 1px solid #c8d3ce;
  border-right-color: #a9b8b1;
  border-bottom-color: #8fa29a;
  border-radius: 7px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(230, 237, 234, 0.96)),
    #fff;
  color: var(--ink);
  box-shadow:
    5px 7px 0 rgba(22, 53, 37, 0.36),
    inset -5px -6px 8px rgba(167, 184, 176, 0.35),
    inset 4px 4px 7px rgba(255, 255, 255, 0.9);
  transform: translateY(0);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
}

.mahjong-tile::after {
  content: "";
  position: absolute;
  inset: 11%;
  border: 2px solid rgba(29, 143, 97, 0.18);
  border-radius: 5px;
  pointer-events: none;
}

.mahjong-tile.is-free:hover {
  transform: translateY(-5px);
  box-shadow:
    5px 10px 0 rgba(22, 53, 37, 0.28),
    0 0 0 3px rgba(255, 204, 73, 0.55),
    inset -5px -6px 8px rgba(167, 184, 176, 0.28);
}

.mahjong-tile.is-selected {
  border-color: #ffd23c;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.98), transparent 32%),
    linear-gradient(150deg, #fffdf0, #ffffff 66%, #fff2a8);
  filter: saturate(1.22) brightness(1.06);
  transform: translateY(-8px) scale(1.035);
  box-shadow:
    6px 12px 0 rgba(22, 53, 37, 0.22),
    0 0 0 4px rgba(255, 210, 60, 0.86),
    0 0 0 8px rgba(10, 119, 255, 0.42),
    0 0 28px rgba(255, 210, 60, 0.7),
    inset -5px -6px 8px rgba(255, 210, 60, 0.18),
    inset 4px 4px 7px rgba(255, 255, 255, 0.95);
  animation: mahjong-selected-pulse 0.82s ease-in-out infinite alternate;
}

.mahjong-tile.is-selected::after {
  border-color: rgba(10, 119, 255, 0.74);
}

.mahjong-tile.is-locked {
  cursor: not-allowed;
  filter: saturate(0.64) brightness(0.78);
  opacity: 0.74;
}

.mahjong-tile.is-hint {
  box-shadow:
    5px 10px 0 rgba(22, 53, 37, 0.24),
    0 0 0 4px rgba(39, 111, 191, 0.55),
    0 0 22px rgba(39, 111, 191, 0.38);
}

.mahjong-tile.is-wrong {
  box-shadow:
    5px 7px 0 rgba(22, 53, 37, 0.3),
    0 0 0 4px rgba(186, 59, 56, 0.55);
}

.mahjong-tile.is-clearing {
  opacity: 0;
  transform: translateY(-22px) scale(0.86) rotate(-4deg);
}

@keyframes mahjong-selected-pulse {
  from {
    box-shadow:
      6px 12px 0 rgba(22, 53, 37, 0.22),
      0 0 0 4px rgba(255, 210, 60, 0.86),
      0 0 0 8px rgba(10, 119, 255, 0.34),
      0 0 20px rgba(255, 210, 60, 0.55),
      inset -5px -6px 8px rgba(255, 210, 60, 0.18),
      inset 4px 4px 7px rgba(255, 255, 255, 0.95);
  }
  to {
    box-shadow:
      6px 12px 0 rgba(22, 53, 37, 0.22),
      0 0 0 5px rgba(255, 210, 60, 0.98),
      0 0 0 10px rgba(10, 119, 255, 0.48),
      0 0 34px rgba(255, 210, 60, 0.78),
      inset -5px -6px 8px rgba(255, 210, 60, 0.2),
      inset 4px 4px 7px rgba(255, 255, 255, 0.95);
  }
}

@keyframes mahjong-timer-pulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.35);
  }
}

.tile-mark {
  font-size: clamp(1rem, 2.8vw, 2rem);
  font-weight: 900;
  line-height: 1;
}

.tile-number {
  margin-top: -8%;
  font-size: clamp(0.76rem, 1.6vw, 1.12rem);
  font-weight: 900;
}

.tone-green .tile-mark,
.tone-jade .tile-mark {
  color: #168657;
}

.tone-red .tile-mark,
.tone-rose .tile-mark {
  color: #b22d34;
}

.tone-blue .tile-mark,
.tone-violet .tile-mark {
  color: #276fbf;
}

.tone-gold .tile-mark,
.tone-amber .tile-mark {
  color: #b87014;
}

.mahjong-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mahjong-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mahjong-item {
  position: relative;
  display: grid;
  min-height: 54px;
  align-content: center;
  justify-items: start;
  gap: 2px;
  overflow: hidden;
  border: 1px solid rgba(17, 94, 62, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 250, 244, 0.92)),
    #ffffff;
  color: #123629;
  padding: 8px 42px 8px 11px;
  text-align: left;
  box-shadow: 0 8px 18px rgba(13, 62, 41, 0.08);
}

.mahjong-item strong {
  font-size: 1rem;
  line-height: 1;
}

.mahjong-item span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.mahjong-item em {
  position: absolute;
  right: 10px;
  top: 50%;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #ffd23c;
  color: #2b2507;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 1000;
}

.mahjong-item:not(:disabled):hover {
  border-color: #ffd23c;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(13, 62, 41, 0.12), 0 0 0 3px rgba(255, 210, 60, 0.22);
}

.mahjong-item.is-empty {
  opacity: 0.46;
}

.mahjong-controls button {
  min-height: 42px;
  padding: 0 12px;
}

.mahjong-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.mahjong-status strong {
  display: grid;
  width: 58px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: #f4f7f5;
  color: var(--green-dark);
  font-size: 1.18rem;
}

.mahjong-status span {
  color: var(--muted);
}

.mahjong-ranking {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.mahjong-ranking strong {
  display: block;
  margin-bottom: 6px;
}

.mahjong-ranking span,
.mahjong-ranking small {
  color: var(--muted);
}

.mahjong-ranking ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
}

.mahjong-ranking li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.mahjong-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7, 36, 25, 0.52);
  backdrop-filter: blur(4px);
}

.mahjong-overlay[hidden] {
  display: none;
}

.mahjong-finish {
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 34px));
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: #ffffff;
  padding: 20px;
  text-align: center;
}

.mahjong-finish strong {
  font-size: 1.7rem;
}

.mahjong-finish span {
  color: var(--muted);
}

.mahjong-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
}

.reaction-pad {
  display: grid;
  min-height: 290px;
  place-items: center;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.65), transparent 35%),
    linear-gradient(145deg, #dfe7e2, #cfdad4);
  color: var(--ink);
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 900;
  text-align: center;
  box-shadow: inset 0 -10px 24px rgba(27, 36, 31, 0.08);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.reaction-pad.is-ready {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.72), transparent 32%),
    linear-gradient(145deg, #a9e7c2, #64d79c);
  color: #0f5132;
  transform: scale(1.01);
}

.reaction-pad.is-waiting {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.65), transparent 34%),
    linear-gradient(145deg, #f2e5c4, #e8cf91);
}

.balloon-game {
  display: grid;
  gap: 12px;
}

.balloon-canvas {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  margin-inline: auto;
  aspect-ratio: 16 / 10;
  border: 2px solid #163225;
  border-radius: 8px;
  background: #dff2ff;
  touch-action: none;
  box-shadow:
    inset 0 0 22px rgba(255, 255, 255, 0.46),
    0 14px 34px rgba(20, 77, 52, 0.16);
}

.balloon-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.balloon-panel span {
  border-radius: 7px;
  background: #f4f7f5;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 800;
}

.arcade-item-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.arcade-item {
  position: relative;
  display: grid;
  min-height: 54px;
  align-content: center;
  justify-items: start;
  gap: 2px;
  overflow: hidden;
  border: 1px solid rgba(27, 36, 31, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(240, 249, 245, 0.9)),
    #ffffff;
  color: #123629;
  padding: 8px 42px 8px 11px;
  text-align: left;
  box-shadow: 0 8px 20px rgba(13, 62, 41, 0.08);
}

.territory-items .arcade-item {
  border-color: rgba(44, 233, 255, 0.26);
  background:
    linear-gradient(135deg, rgba(10, 23, 42, 0.92), rgba(8, 49, 70, 0.86)),
    #0e1b2b;
  color: #d9fbff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.arcade-item strong {
  line-height: 1;
  font-size: 1rem;
}

.arcade-item span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.territory-items .arcade-item span {
  color: rgba(217, 251, 255, 0.72);
}

.arcade-item em {
  position: absolute;
  right: 10px;
  top: 50%;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #ffd23c;
  color: #2b2507;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 1000;
}

.arcade-item:not(:disabled):hover {
  border-color: #ffd23c;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(13, 62, 41, 0.13), 0 0 0 3px rgba(255, 210, 60, 0.22);
}

.territory-items .arcade-item:not(:disabled):hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2), 0 0 0 3px rgba(255, 210, 60, 0.28);
}

.arcade-item.is-empty {
  opacity: 0.48;
}

.balloon-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.balloon-controls button {
  min-height: 48px;
  padding: 0 10px;
}

.territory-game {
  display: grid;
  gap: 12px;
}

.territory-canvas {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  margin-inline: auto;
  aspect-ratio: 16 / 10;
  border: 2px solid #101723;
  border-radius: 8px;
  background: #08111f;
  touch-action: none;
  box-shadow:
    inset 0 0 28px rgba(44, 233, 255, 0.18),
    0 14px 34px rgba(15, 23, 42, 0.22);
}

.territory-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}

.territory-panel span {
  border: 1px solid rgba(44, 233, 255, 0.25);
  border-radius: 7px;
  background: #0e1b2b;
  color: #d9fbff;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 800;
}

.territory-controls {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 8px;
  justify-content: center;
}

.territory-controls button {
  width: 58px;
  min-height: 48px;
  padding: 0;
  background: #276fbf;
}

.territory-controls .wide {
  grid-column: 1 / -1;
  justify-self: center;
}

.color-game {
  display: grid;
  min-height: 290px;
  place-items: center;
  gap: 16px;
  text-align: center;
}

.color-word {
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 900;
}

.color-buttons {
  display: flex;
  gap: 10px;
}

.memory-game,
.dodge-wrap {
  position: relative;
  display: grid;
  gap: 12px;
  overflow: hidden;
  border-radius: 8px;
  padding: clamp(10px, 2vw, 16px);
  isolation: isolate;
}

.memory-game::before,
.dodge-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(135deg, rgba(5, 34, 21, 0.66), rgba(7, 58, 47, 0.44)),
    url("assets/arcade-mini-atlas.webp");
  background-position: center, left top;
  background-size: cover, 200% 200%;
}

.dodge-wrap::before {
  background-image:
    linear-gradient(135deg, rgba(4, 10, 24, 0.6), rgba(6, 20, 50, 0.38)),
    url("assets/arcade-mini-atlas.webp");
  background-position: center, right top;
}

.memory-game::after,
.dodge-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 210, 60, 0.18), transparent 25%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
  pointer-events: none;
}

.memory-status,
.dodge-status {
  display: grid;
  gap: 8px;
}

.memory-status {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dodge-status {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.memory-status span,
.memory-status strong,
.dodge-status span,
.dodge-status strong,
.dodge-status b {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: rgba(4, 29, 21, 0.72);
  color: #f4fff8;
  padding: 8px 9px;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 900;
}

.memory-status strong,
.dodge-status strong {
  color: #ffd23c;
}

.dodge-status b {
  color: #93c5fd;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 12px);
}

.memory-card {
  position: relative;
  display: grid;
  min-height: clamp(72px, 10vw, 94px);
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 210, 60, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(19, 94, 68, 0.96), rgba(6, 56, 34, 0.98));
  color: #f5fff8;
  box-shadow:
    0 8px 0 rgba(2, 32, 20, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.06);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.memory-card:not(.is-open):not(.is-done):not(.is-preview):hover {
  transform: translateY(-2px);
  box-shadow:
    0 10px 0 rgba(2, 32, 20, 0.58),
    0 0 0 3px rgba(255, 210, 60, 0.2);
}

.memory-card-back,
.memory-card-face {
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.memory-card-back {
  border: 1px solid rgba(255, 210, 60, 0.24);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 210, 60, 0.18), transparent 27%),
    linear-gradient(145deg, rgba(0, 101, 65, 0.92), rgba(0, 53, 34, 0.96));
  color: #ffd23c;
  font-size: 1.45rem;
  font-weight: 1000;
}

.memory-card-face {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.9), transparent 32%),
    linear-gradient(145deg, #ffffff, #eaf7ef);
  color: var(--ink);
  opacity: 0;
  transform: scale(0.92);
}

.memory-card-face i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1d8f61;
  box-shadow: 0 0 18px rgba(29, 143, 97, 0.42);
}

.memory-card-face b {
  margin-top: -2px;
  font-size: 1.25rem;
  font-weight: 1000;
}

.memory-card.is-open,
.memory-card.is-preview,
.memory-card.is-done {
  transform: translateY(5px) scale(1.01);
}

.memory-card.is-open {
  border-color: #ffd23c;
  box-shadow:
    0 4px 0 rgba(2, 32, 20, 0.5),
    0 0 0 4px rgba(255, 210, 60, 0.34),
    0 0 22px rgba(255, 210, 60, 0.28);
}

.memory-card.is-preview {
  border-color: #60a5fa;
  box-shadow:
    0 4px 0 rgba(2, 32, 20, 0.5),
    0 0 0 4px rgba(96, 165, 250, 0.28),
    0 0 20px rgba(96, 165, 250, 0.25);
}

.memory-card.is-done {
  border-color: #4ade80;
  opacity: 0.86;
  box-shadow:
    0 3px 0 rgba(2, 32, 20, 0.4),
    0 0 0 4px rgba(74, 222, 128, 0.22);
}

.memory-card.is-open .memory-card-back,
.memory-card.is-preview .memory-card-back,
.memory-card.is-done .memory-card-back {
  opacity: 0;
  transform: scale(1.06);
}

.memory-card.is-open .memory-card-face,
.memory-card.is-preview .memory-card-face,
.memory-card.is-done .memory-card-face {
  opacity: 1;
  transform: scale(1);
}

.memory-card.theme-1 .memory-card-face i { background: #276fbf; }
.memory-card.theme-2 .memory-card-face i { background: #ffd23c; border-radius: 7px; }
.memory-card.theme-3 .memory-card-face i { background: #ba3b38; transform: rotate(45deg); border-radius: 8px; }
.memory-card.theme-4 .memory-card-face i { background: #6d5dfc; }
.memory-card.theme-5 .memory-card-face i { background: #14b8a6; border-radius: 30% 70% 40% 60%; }

.memory-game.is-guarded {
  box-shadow: inset 0 0 0 2px rgba(255, 210, 60, 0.58);
}

.dodge-wrap {
  place-items: center;
}

.dodge-status,
.dodge-grid,
.dodge-controls,
.dodge-items {
  width: min(100%, 360px);
}

.dodge-grid {
  display: grid;
  aspect-ratio: 1;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  border: 2px solid rgba(96, 165, 250, 0.36);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(3, 12, 32, 0.18), rgba(3, 28, 49, 0.18)),
    url("assets/arcade-mini-atlas.webp");
  background-position: center, right top;
  background-size: cover, 200% 200%;
  padding: 9px;
  box-shadow:
    0 16px 36px rgba(2, 8, 23, 0.26),
    inset 0 0 34px rgba(96, 165, 250, 0.24);
}

.dodge-grid.is-shield {
  animation: dodgeShieldFlash 0.36s ease;
}

.dodge-grid.is-slow {
  animation: dodgeSlowFlash 0.36s ease;
}

.dodge-grid.is-clear {
  animation: dodgeClearFlash 0.36s ease;
}

.dodge-cell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(147, 197, 253, 0.28);
  border-radius: 7px;
  background:
    linear-gradient(145deg, rgba(13, 36, 68, 0.86), rgba(8, 20, 42, 0.94));
  box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.22);
}

.dodge-cell::after {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: rgba(147, 197, 253, 0.18);
}

.dodge-cell.is-player {
  border-color: #60a5fa;
  background:
    radial-gradient(circle at 50% 32%, #dbeafe 0 16%, transparent 17%),
    radial-gradient(circle at 50% 62%, #93c5fd 0 28%, transparent 29%),
    linear-gradient(145deg, #3b82f6, #1d4ed8);
  box-shadow:
    0 0 0 4px rgba(96, 165, 250, 0.28),
    0 0 22px rgba(96, 165, 250, 0.48);
}

.dodge-cell.is-player::after {
  inset: 20%;
  border: 2px solid rgba(255, 255, 255, 0.54);
  background: transparent;
}

.dodge-cell.is-player.is-shielded {
  border-color: #ffd23c;
  box-shadow:
    0 0 0 5px rgba(255, 210, 60, 0.3),
    0 0 28px rgba(255, 210, 60, 0.45);
}

.dodge-cell.is-danger {
  border-color: #ef4444;
  background:
    radial-gradient(circle at 50% 38%, #fecaca 0 18%, transparent 19%),
    linear-gradient(145deg, #ef4444, #7f1d1d);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.38);
  animation: dangerPulse 0.72s ease-in-out infinite alternate;
}

.dodge-controls {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 8px;
  justify-content: center;
}

.dodge-controls button {
  width: 58px;
  min-height: 48px;
  padding: 0;
  background: #276fbf;
}

.dodge-controls .wide {
  grid-column: 1 / -1;
  justify-self: center;
}

@keyframes dangerPulse {
  from { transform: scale(1); }
  to { transform: scale(0.93); }
}

@keyframes dodgeShieldFlash {
  0%, 100% { box-shadow: 0 16px 36px rgba(2, 8, 23, 0.26), inset 0 0 34px rgba(96, 165, 250, 0.24); }
  50% { box-shadow: 0 16px 36px rgba(2, 8, 23, 0.26), 0 0 0 5px rgba(255, 210, 60, 0.34), inset 0 0 42px rgba(255, 210, 60, 0.42); }
}

@keyframes dodgeSlowFlash {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.25) hue-rotate(18deg); }
}

@keyframes dodgeClearFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.38); }
}

.guide-article {
  margin: 10px 0 34px;
  padding: clamp(20px, 4vw, 34px);
}

.guide-article p {
  max-width: 760px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: #eef5f1;
}

tr:last-child td {
  border-bottom: 0;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px clamp(18px, 4vw, 48px) 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

footer a {
  min-height: 28px;
}

.bottom-cta {
  display: none;
}

@media (max-width: 900px) {
  .tool-shell,
  .game-section,
  .arcade-layout {
    grid-template-columns: 1fr;
  }

  .controls,
  .results-grid,
  .utility-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-hero,
  .mahjong-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-hero {
    display: grid;
    align-items: start;
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: 78px;
  }

  .site-header,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .hamburger-menu {
    display: block;
  }

  nav {
    grid-column: 1 / -1;
    display: none;
    width: 100%;
  }

  .site-header.is-open nav {
    display: flex;
  }

  nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .controls,
  .results-grid,
  .choice-grid,
  .utility-grid,
  .inline-controls,
  .mahjong-toolbar {
    grid-template-columns: 1fr;
  }

.game-hero {
  padding-top: 26px;
}

  .game-hero h1 span {
    display: block;
  }

  .mahjong-board-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-color: #1d8f61 #dfeee7;
    scrollbar-width: thin;
  }

  .mahjong-board {
    width: max(100%, var(--mahjong-min-board-width, 420px));
    max-width: none;
    min-height: 0;
  }

  .mahjong-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mahjong-items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mahjong-item {
    min-height: 50px;
    padding: 7px 34px 7px 9px;
  }

  .mahjong-item strong {
    font-size: 0.9rem;
  }

  .mahjong-item span {
    font-size: 0.68rem;
  }

  .mahjong-item em {
    right: 7px;
    width: 22px;
    height: 22px;
  }

  .mahjong-streak {
    align-items: flex-start;
    justify-content: center;
    min-height: 42px;
    text-align: center;
  }

  .mahjong-status,
  .mahjong-ranking li {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .mahjong-status {
    display: grid;
  }

  .mahjong-status strong {
    width: 100%;
  }

  .diagnosis-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .arcade-head {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
  }

  .arcade-head h3 {
    font-size: 1.22rem;
  }

  .arcade-menu {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .arcade-tile {
    min-width: 152px;
    min-height: 74px;
    padding: 12px;
    scroll-snap-align: start;
  }

  .arcade-tile span {
    font-size: 0.82rem;
  }

  .arcade-stage {
    padding: 12px;
  }

  .arcade-settings {
    gap: 6px;
  }

  .arcade-settings button {
    flex: 1 1 84px;
    min-height: 42px;
    padding: 0 8px;
  }

  .arcade-daily {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .arcade-daily button {
    width: 100%;
  }

  .arcade-play {
    min-height: 0;
    padding: 10px;
  }

  .memory-status,
  .dodge-status {
    grid-template-columns: 1fr;
  }

  .memory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .memory-card {
    min-height: 68px;
  }

  .dodge-status,
  .dodge-grid,
  .dodge-controls,
  .dodge-items {
    width: min(100%, 326px);
  }

  .dodge-controls {
    grid-template-columns: repeat(3, 64px);
  }

  .dodge-controls button {
    width: 64px;
    min-height: 46px;
  }

  .balloon-game,
  .territory-game {
    gap: 10px;
  }

  .balloon-panel,
  .balloon-controls,
  .arcade-item-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .balloon-panel span {
    padding: 7px 4px;
    font-size: 0.82rem;
  }

  .arcade-item {
    min-height: 50px;
    padding: 7px 30px 7px 8px;
  }

  .arcade-item strong {
    font-size: 0.86rem;
  }

  .arcade-item span {
    font-size: 0.66rem;
  }

  .arcade-item em {
    right: 6px;
    width: 21px;
    height: 21px;
    font-size: 0.72rem;
  }

  .balloon-controls button {
    min-height: 54px;
    padding: 0 4px;
    font-size: 0.95rem;
  }

  .territory-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .territory-panel span {
    padding: 7px 6px;
    font-size: 0.76rem;
  }

  .territory-controls {
    grid-template-columns: repeat(3, 74px);
    gap: 6px;
  }

  .territory-controls button {
    width: 74px;
    min-height: 42px;
    font-size: 0.86rem;
  }

  .bottom-cta {
    position: fixed;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 20;
    display: grid;
    min-height: 52px;
    place-items: center;
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    text-decoration: none;
    font-weight: 900;
    box-shadow: 0 14px 32px rgba(16, 107, 72, 0.28);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .bottom-cta.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(100% + 16px));
  }
}

.game-page {
  padding-bottom: 0;
}

.game-page .bottom-cta {
  position: static;
  display: grid;
  width: min(1180px, calc(100% - 32px));
  min-height: 52px;
  margin: 0 auto 18px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(16, 107, 72, 0.22);
}

@media (max-width: 640px) {
  .game-page .bottom-cta {
    position: fixed;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 1;
    width: auto;
    min-height: 52px;
    margin: 0;
    font-size: 0.94rem;
    box-shadow: 0 10px 24px rgba(16, 107, 72, 0.26);
  }
}
