/* ============================================================
   ツルリン — style.css
   冬のアーケード。濃紺のインクと淡い氷青、嘴のオレンジが一差し。
   フォント: M PLUS Rounded 1c(本文/見出し) + DotGothic16(数字)
   ============================================================ */

:root {
  --ink: #1B2A44;
  --ink-2: #2A3D5E;
  --ink-soft: rgba(27, 42, 68, .62);
  --paper: #E8F1F8;
  --frost: #D8E7F2;
  --tile: #F7FBFF;
  --tile-edge: #C4D9E9;
  --blue: #2F7CC4;
  --cyan: #74C7E8;
  --beak: #FF8A3D;
  --beak-deep: #E96F1F;
  --stamp: #D8404A;
  --ok: #2FA56B;
  --danger: #DB5757;
  --radius: 18px;
  --shadow-card: 0 6px 24px rgba(27, 42, 68, .10), 0 1px 0 rgba(255,255,255,.7) inset;
  --font-round: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Yu Gothic', sans-serif;
  --font-dot: 'DotGothic16', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-round);
  font-weight: 500;
  background: var(--paper);
  color: var(--ink);
  min-height: 100svh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* 背景: 斜めのフロスト縞 + 上部の白い光 */
.bg-deco {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255,255,255,.9), rgba(255,255,255,0) 60%),
    repeating-linear-gradient(115deg, transparent 0 30px, rgba(47,124,196,.045) 30px 60px),
    var(--paper);
}
.bg-deco::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle 3px at 12% 24%, rgba(255,255,255,.9) 98%, transparent),
    radial-gradient(circle 2px at 84% 14%, rgba(255,255,255,.8) 98%, transparent),
    radial-gradient(circle 2.5px at 70% 70%, rgba(255,255,255,.7) 98%, transparent),
    radial-gradient(circle 2px at 22% 82%, rgba(255,255,255,.8) 98%, transparent);
}

/* ============ レイアウト ============ */
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 64px; }

/* ============ ヘッダー ============ */
.site-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 22px 2px 6px;
}
.brand { display: flex; align-items: flex-end; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 2px 0 rgba(27,42,68,.18)); }
.brand-text .eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .22em;
  color: var(--blue); margin-bottom: -2px;
}
.brand-text h1 {
  font-size: 34px; font-weight: 900; line-height: 1.05;
  transform: skewX(-6deg);
  letter-spacing: .02em;
  text-shadow: 2px 2px 0 rgba(116, 199, 232, .55);
  position: relative;
}
.brand-text h1::after {
  content: '';
  position: absolute; left: 4px; right: 18px; bottom: -5px; height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--beak), rgba(255,138,61,0));
}
.head-tools { display: flex; gap: 8px; padding-bottom: 4px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 2px solid rgba(27,42,68,.14);
  background: #fff; color: var(--ink);
  font-size: 17px; cursor: pointer;
  display: grid; place-items: center;
  transition: transform .12s ease, background .12s ease;
}
.icon-btn:hover { transform: translateY(-1px); background: var(--tile); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 20px; height: 20px; }

/* ============ タブナビ ============ */
.tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--ink);
  padding: 5px; border-radius: 16px;
  margin: 12px 0 18px;
  box-shadow: 0 4px 14px rgba(27,42,68,.22);
}
.tab {
  appearance: none; border: 0; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 13.5px;
  padding: 9px 2px; border-radius: 12px;
  background: transparent; color: rgba(255,255,255,.78);
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: #fff; }
.tab.active { background: var(--tile); color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset; }

/* ============ ゲームメタ ============ */
.game-meta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 800; font-size: 14.5px;
  margin-bottom: 12px; min-height: 24px;
  flex-wrap: wrap; text-align: center;
}
.game-meta .num { font-family: var(--font-dot); font-size: 17px; color: var(--blue); }
.game-meta .badge {
  font-size: 12px; font-weight: 800;
  background: var(--ink); color: #fff;
  border-radius: 999px; padding: 2px 10px;
}
.game-meta .badge.warn { background: var(--beak-deep); }

/* ============ 盤面 ============ */
.board-wrap { position: relative; display: flex; justify-content: center; }
.board-frame {
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border-radius: 22px;
  padding: 10px;
  box-shadow: 0 14px 34px rgba(24, 42, 70, .30), 0 2px 0 rgba(255,255,255,.25) inset;
}
.board {
  position: relative;
  width: calc(var(--bw) * var(--cs));
  height: calc(var(--bh) * var(--cs));
  border-radius: 12px;
  overflow: hidden;
  background: var(--tile-edge);
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.grid-layer {
  display: grid;
  grid-template-columns: repeat(var(--bw), var(--cs));
  grid-auto-rows: var(--cs);
}
.cell { position: relative; }
.cell::before {
  content: '';
  position: absolute; inset: 2px;
  border-radius: 6px;
  background: linear-gradient(155deg, #FDFEFF 0%, var(--tile) 55%, #EAF4FC 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 -1px 0 rgba(116,168,205,.25) inset;
}
/* 氷のフロスト変化(手作業感) */
.cell.sheen-1::before { background: linear-gradient(155deg, #FFFFFF 0%, #F3F9FE 50%, #E6F1FA 100%); }
.cell.sheen-2::before { background: linear-gradient(200deg, #FBFDFF 0%, var(--tile) 60%, #E9F3FB 100%); }
.cell.sheen-3::before { background: linear-gradient(130deg, #FDFEFF 10%, #F1F8FD 65%, #E7F2FA 100%); }
.cell > svg { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); }
.cell.t-wall::before { background: linear-gradient(155deg, #E9F0F6, #DCE7F0); }
.cell.t-sand > svg, .cell.t-arrow > svg { inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
.cell.t-crack:not(.broken) > svg { inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
@keyframes crack-pop {
  0% { transform: scale(1.18); opacity: .35; }
  100% { transform: scale(1); opacity: 1; }
}
.cell.t-crack.just-broke > svg { animation: crack-pop .3s ease-out; }
.start-mark { position: absolute; inset: 0; opacity: .9; }
.start-mark svg { width: 100%; height: 100%; }

/* ============ スプライト ============ */
.sprite-layer { position: absolute; inset: 0; pointer-events: none; }
.sprite {
  position: absolute; top: 0; left: 0;
  width: var(--cs); height: var(--cs);
  transition-property: transform;
  transition-timing-function: linear;
  will-change: transform;
}
.sprite svg { position: absolute; inset: 6%; width: 88%; height: 88%; }
.sprite.hidden { display: none; }

.sprite.penguin { z-index: 5; transition-timing-function: cubic-bezier(.2, .65, .45, 1); }
.sprite.penguin svg { transition: transform .15s ease; }
.sprite.penguin.lean-1 svg { transform: rotate(7deg); }
.sprite.penguin.lean-3 svg { transform: rotate(-7deg); }
.sprite.penguin.lean-0 svg { transform: translateY(-4%); }
.sprite.penguin.lean-2 svg { transform: translateY(3%); }
.sprite.penguin.sliding svg { transform: scale(1.04, .96); }
.sprite.penguin.falling { transition: transform .5s cubic-bezier(.5, 0, 1, .5), opacity .5s ease; }
.sprite.penguin.falling svg { transform: scale(.12) rotate(300deg); opacity: 0; transition: transform .5s cubic-bezier(.5,0,1,.5), opacity .45s ease .1s; }
.sprite.penguin.dizzy svg { animation: dizzy .7s ease; }
@keyframes dizzy {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(13deg); } 40% { transform: rotate(-13deg); }
  60% { transform: rotate(9deg); } 80% { transform: rotate(-9deg); }
}
.sprite.penguin.happy svg { animation: hop .55s ease; }
@keyframes hop {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-22%) scale(1.05); }
  60% { transform: translateY(0) scale(.97, 1.0); }
}

.sprite.crystal svg { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7%); } }
.sprite.crystal.picked svg { animation: pickup .26s ease forwards; }
@keyframes pickup { to { transform: translateY(-40%) scale(1.5); opacity: 0; } }

.sprite.block { z-index: 4; }
.sprite.block.sunk svg { transition: transform .22s ease-in, opacity .22s ease-in; transform: scale(.5); opacity: .2; }

/* 雪しぶき */
.spray {
  position: absolute; top: 0; left: 0;
  width: var(--cs); height: var(--cs);
  pointer-events: none; z-index: 6;
}
.spray i {
  position: absolute; left: 46%; top: 46%;
  width: 9%; height: 9%; border-radius: 50%;
  background: #fff; box-shadow: 0 0 4px rgba(116,199,232,.8);
  animation: puff .45s ease-out forwards;
}
.spray i:nth-child(2) { animation-delay: .03s; }
.spray i:nth-child(3) { animation-delay: .06s; }
.spray.d0 i { --px: 0; --py: 55%; } .spray.d0 i:nth-child(2) { --px: -38%; --py: 48%; } .spray.d0 i:nth-child(3) { --px: 38%; --py: 48%; }
.spray.d2 i { --px: 0; --py: -55%; } .spray.d2 i:nth-child(2) { --px: -38%; --py: -48%; } .spray.d2 i:nth-child(3) { --px: 38%; --py: -48%; }
.spray.d1 i { --px: -55%; --py: 0; } .spray.d1 i:nth-child(2) { --px: -48%; --py: -38%; } .spray.d1 i:nth-child(3) { --px: -48%; --py: 38%; }
.spray.d3 i { --px: 55%; --py: 0; } .spray.d3 i:nth-child(2) { --px: 48%; --py: -38%; } .spray.d3 i:nth-child(3) { --px: 48%; --py: 38%; }
@keyframes puff {
  0% { transform: translate(0, 0) scale(1); opacity: .95; }
  100% { transform: translate(calc(var(--px) * 5), calc(var(--py) * 5)) scale(.4); opacity: 0; }
}

/* ============ ハンコ(結果スタンプ)============ */
#stampLayer {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none; z-index: 10;
}
.stamp {
  border: 5px solid var(--stamp);
  color: var(--stamp);
  background: rgba(255, 255, 255, .9);
  border-radius: 14px;
  padding: 10px 22px 12px;
  text-align: center;
  transform: rotate(-8deg);
  box-shadow: 0 6px 18px rgba(216, 64, 74, .25);
  animation: stampIn .38s cubic-bezier(.2, 1.6, .3, 1) both;
  mix-blend-mode: multiply;
}
.stamp .big { font-size: 30px; font-weight: 900; line-height: 1.1; letter-spacing: .04em; }
.stamp .sub { font-family: var(--font-dot); font-size: 14px; margin-top: 2px; }
.stamp.blue { border-color: var(--blue); color: var(--blue); box-shadow: 0 6px 18px rgba(47,124,196,.25); }
.stamp.ok { border-color: var(--ok); color: var(--ok); box-shadow: 0 6px 18px rgba(47,165,107,.25); }
@keyframes stampIn {
  0% { transform: rotate(-8deg) scale(2.1); opacity: 0; }
  100% { transform: rotate(-8deg) scale(1); opacity: 1; }
}

/* ============ HUD ============ */
.hud {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 14px; flex-wrap: wrap; min-height: 38px;
}
.chip {
  background: #fff; border: 2px solid rgba(27,42,68,.12);
  border-radius: 999px; padding: 5px 14px;
  font-size: 13px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip b { font-family: var(--font-dot); font-size: 17px; font-weight: 400; color: var(--blue); }
.chip-ic { display: inline-flex; width: 16px; height: 16px; }
.chip-ic svg { width: 100%; height: 100%; }
.chip.alert b { color: var(--danger); }

/* ============ 操作 ============ */
.controls {
  display: flex; align-items: center; justify-content: center;
  gap: 26px; margin-top: 16px;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  gap: 4px;
}
.dpad button {
  appearance: none; cursor: pointer;
  border: 2px solid rgba(27,42,68,.15);
  border-bottom-width: 4px;
  background: #fff; color: var(--ink);
  border-radius: 14px; font-size: 19px;
  display: grid; place-items: center;
  transition: transform .08s ease;
}
.dpad button:active { transform: translateY(2px); border-bottom-width: 2px; }
.dpad .d-u { grid-area: 1 / 2; } .dpad .d-l { grid-area: 2 / 1; }
.dpad .d-r { grid-area: 2 / 3; } .dpad .d-d { grid-area: 3 / 2; }
.dpad .d-c {
  grid-area: 2 / 2; border: 0; background: transparent;
  font-size: 10px; font-weight: 800; color: var(--ink-soft);
  cursor: default; line-height: 1.35;
  display: grid; place-items: center;
  text-align: center; white-space: nowrap; padding: 0;
}
.side-actions { display: flex; flex-direction: column; gap: 10px; }

/* ============ ボタン ============ */
.btn {
  appearance: none; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 14.5px;
  border: 2px solid rgba(27,42,68,.16);
  border-bottom-width: 4px;
  border-radius: 14px;
  background: #fff; color: var(--ink);
  padding: 9px 18px;
  transition: transform .08s ease, background .12s ease;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn:hover { background: var(--tile); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn.primary {
  background: var(--beak); border-color: var(--beak-deep); color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.btn.primary:hover { background: #FF9A57; }
.btn.dark { background: var(--ink); border-color: #0F1B30; color: #fff; }
.btn.dark:hover { background: var(--ink-2); }
.btn.small { font-size: 13px; padding: 6px 13px; border-radius: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ============ 結果カード ============ */
.card {
  background: #fff;
  border: 2px solid rgba(27,42,68,.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-top: 18px;
}
.result-title { font-size: 19px; font-weight: 900; text-align: center; }
.result-sub { text-align: center; color: var(--ink-soft); font-size: 13.5px; font-weight: 700; margin-top: 2px; }
.result-stats {
  display: flex; justify-content: center; gap: 18px;
  margin: 12px 0 4px;
  font-family: var(--font-dot); font-size: 15px;
}
.result-stats span b { font-size: 22px; color: var(--blue); font-weight: 400; display: block; text-align: center; }
.share-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.share-preview {
  background: var(--frost); border-radius: 12px;
  font-size: 12.5px; line-height: 1.7; font-weight: 700;
  padding: 10px 14px; margin-top: 12px;
  white-space: pre-wrap; word-break: break-all;
  color: var(--ink-2);
}
.streak-line { text-align: center; margin-top: 8px; font-weight: 800; color: var(--beak-deep); }

/* ============ エディタ ============ */
.editor-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.size-pick { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; }
.ed-actions { display: flex; align-items: center; gap: 8px; }
.btn.erase-tool { display: inline-flex; align-items: center; gap: 5px; }
.btn.erase-tool .erase-mark { font-size: 15px; line-height: 1; color: var(--ink-soft); }
.btn.erase-tool.active {
  border-color: var(--beak);
  box-shadow: 0 0 0 2.5px rgba(255,138,61,.35);
}
.btn.erase-tool.active .erase-mark { color: var(--beak); }
.size-pick select {
  font-family: var(--font-dot); font-size: 15px;
  border: 2px solid rgba(27,42,68,.16); border-radius: 10px;
  background: #fff; color: var(--ink); padding: 4px 8px;
}
.palette {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  margin: 14px 0;
}
.pal-btn {
  appearance: none; cursor: pointer;
  background: #fff; border: 2px solid rgba(27,42,68,.14);
  border-radius: 12px; padding: 5px 3px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: transform .1s ease, border-color .1s ease, box-shadow .1s ease;
}
.pal-btn svg, .pal-btn .erase-mark { width: 30px; height: 30px; }
.pal-btn .erase-mark { display: grid; place-items: center; font-size: 19px; color: var(--ink-soft); }
.pal-btn span { font-size: 10px; font-weight: 800; color: var(--ink-soft); }
.pal-btn.active {
  border-color: var(--beak);
  box-shadow: 0 0 0 2.5px rgba(255,138,61,.35);
  transform: translateY(-1px);
}
.editor-board-wrap { display: flex; justify-content: center; }
.editor-mode .cell { cursor: pointer; }
.editor-mode .cell:hover::before { background: #E2F0FA; }
.ed-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.ed-status {
  text-align: center; font-size: 13.5px; font-weight: 800;
  min-height: 24px; margin-top: 10px;
}
.ed-status.ok { color: var(--ok); }
.ed-status.bad { color: var(--danger); }
.publish-panel { margin-top: 14px; }
.publish-panel h3 { font-size: 16px; font-weight: 900; text-align: center; }
.publish-panel .rec { text-align: center; font-weight: 800; margin: 6px 0 10px; }
.publish-panel .rec b { font-family: var(--font-dot); font-size: 20px; color: var(--beak-deep); font-weight: 400; }
.name-row { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 10px; }
.name-row label { font-size: 13px; font-weight: 800; }
.name-row input {
  font-family: inherit; font-weight: 700; font-size: 14px;
  border: 2px solid rgba(27,42,68,.16); border-radius: 10px;
  padding: 7px 10px; width: 170px; background: #fff; color: var(--ink);
}
.url-box {
  font-family: var(--font-dot); font-size: 12px;
  background: var(--frost); border-radius: 10px;
  padding: 9px 12px; word-break: break-all;
  color: var(--ink-2); margin-bottom: 10px;
  max-height: 74px; overflow: auto;
}

/* ============ あそびかた ============ */
.how h2 { font-size: 21px; font-weight: 900; margin: 22px 0 8px; }
.how h2:first-child { margin-top: 0; }
.how p { font-size: 14.5px; margin-bottom: 8px; }
.how .core-rule {
  background: var(--ink); color: #fff;
  border-radius: 14px; padding: 14px 18px;
  font-weight: 800; font-size: 15.5px; line-height: 1.7;
  box-shadow: 0 6px 16px rgba(27,42,68,.25);
}
.how .core-rule em { color: var(--cyan); font-style: normal; }
.how .core-rule strong { color: var(--beak); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.legend-item {
  display: flex; gap: 9px; align-items: center;
  background: #fff; border: 2px solid rgba(27,42,68,.10);
  border-radius: 12px; padding: 8px 10px;
}
.legend-item .tile-pic { width: 40px; height: 40px; flex: none; background: linear-gradient(155deg,#FDFEFF,#EAF4FC); border-radius: 8px; padding: 3px; }
.legend-item .tile-pic svg { width: 100%; height: 100%; }
.legend-item .t-name { font-size: 13px; font-weight: 900; }
.legend-item .t-desc { font-size: 11.5px; color: var(--ink-soft); font-weight: 700; line-height: 1.45; }

/* ============ エラービュー ============ */
.error-card { text-align: center; padding: 34px 18px; }
.error-card .face { font-size: 44px; }
.error-card h2 { font-size: 19px; font-weight: 900; margin: 8px 0 4px; }
.error-card p { color: var(--ink-soft); font-size: 13.5px; font-weight: 700; }

/* ============ トースト ============ */
#toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  font-size: 13.5px; font-weight: 800;
  padding: 10px 20px; border-radius: 999px;
  box-shadow: 0 8px 20px rgba(27,42,68,.35);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ フッター ============ */
.site-foot {
  text-align: center; margin-top: 44px;
  font-size: 11.5px; color: var(--ink-soft); font-weight: 700;
}
.site-foot .lock { font-size: 12px; }

/* ============ フォーカス・モーション ============ */
:focus-visible { outline: 3px solid var(--beak); outline-offset: 2px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============ レスポンシブ ============ */
@media (max-width: 420px) {
  .brand-text h1 { font-size: 29px; }
  .tab { font-size: 11.5px; }
  .stage-grid { grid-template-columns: repeat(5, 1fr); }
  .dpad { grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); }
  .legend { grid-template-columns: 1fr; }
  .palette { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 720px) {
  .wrap { max-width: 600px; }
}

/* ============ ステージ一覧 ============ */
.stage-head { text-align: center; margin-bottom: 14px; }
.stage-head h2 { font-size: 21px; font-weight: 900; }
.stage-head p { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-top: 2px; }
.stage-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.stage-btn {
  appearance: none; cursor: pointer;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid rgba(27,42,68,.14);
  border-bottom-width: 4px;
  background: #fff; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: transform .08s ease, background .12s ease;
  position: relative;
}
.stage-btn:not([disabled]):hover { background: var(--tile); }
.stage-btn:not([disabled]):active { transform: translateY(2px); border-bottom-width: 2px; }
.stage-btn .sn { font-family: var(--font-dot); font-size: 18px; line-height: 1; }
.stage-btn .st { width: 16px; height: 16px; }
.stage-btn .nb {
  font-size: 8.5px; font-weight: 900; letter-spacing: .06em;
  color: var(--beak-deep);
}
.stage-btn.cleared { background: var(--ink); border-color: #0F1B30; color: #fff; }
.stage-btn.cleared:not([disabled]):hover { background: var(--ink-2); }
.stage-btn.cleared .st { color: var(--cyan); }
.stage-btn.perfect { background: var(--beak); border-color: var(--beak-deep); color: #fff; }
.stage-btn.perfect:not([disabled]):hover { background: #FF9A57; }
.stage-btn.perfect .st { color: #FFE9C9; }
.stage-btn.locked { opacity: .42; cursor: not-allowed; background: var(--frost); }
.stage-btn.locked .st { width: 13px; height: 13px; color: var(--ink-soft); }

/* 関門(チェックポイント)ステージ */
.stage-btn.cp { border-width: 3px; border-bottom-width: 5px; border-color: var(--blue); }
.stage-btn.cp.cleared, .stage-btn.cp.perfect { border-color: rgba(255,255,255,.45); }
.stage-btn.cp.locked { border-color: rgba(47,124,196,.35); }
.stage-btn .nb.cpb { color: var(--blue); }
.stage-hint { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); margin-top: 4px; }

/* エディタ: ランダム生成行 */
.editor-random {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-wrap: wrap;
  background: #fff; border: 2px solid rgba(27,42,68,.10);
  border-radius: 14px; padding: 9px 12px;
  margin-top: 12px;
}
.editor-random .er-label { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); }
.editor-random select {
  font-family: inherit; font-weight: 800; font-size: 13px;
  border: 2px solid rgba(27,42,68,.16); border-radius: 10px;
  background: #fff; color: var(--ink); padding: 5px 8px;
}

/* クリア後: 操作パッドを畳んで結果カードをすぐ見せる */
#view-game.won .controls { display: none; }
#view-game.won .hud { margin-bottom: 0; }
