:root {
  --bg: #fff3dc;
  --bg2: #ffe7bd;
  --ink: #6b4528;
  --ink-soft: #9a7452;
  --orange: #f29a2e;
  --orange-d: #d97a14;
  --gold: #f6c94c;
  --cream: #fffaf0;
  --mint: #7fcfae;
  --mint-d: #4fae8a;
  --line: #ecd3a6;
  --star: #f5b324;
  --star-off: #e8d9bd;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
body {
  /* 描いた背景（2026-10-25〜）。読めないときは 下の 色の重ねが 見える */
  background:
    linear-gradient(rgba(255, 246, 228, .34), rgba(255, 246, 228, .34)),
    url("../img/art/bg.webp") center / cover no-repeat,
    radial-gradient(circle at 12% 18%, rgba(246, 201, 76, .25) 0 26px, transparent 27px),
    radial-gradient(circle at 88% 30%, rgba(242, 154, 46, .16) 0 34px, transparent 35px),
    radial-gradient(circle at 20% 82%, rgba(242, 154, 46, .14) 0 30px, transparent 31px),
    radial-gradient(circle at 84% 88%, rgba(246, 201, 76, .22) 0 22px, transparent 23px),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}
#app { position: fixed; inset: 0; display: flex; justify-content: center; }
.screen {
  position: absolute; inset: 0; margin: 0 auto; max-width: 560px; width: 100%;
  display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
}
.hidden { display: none !important; }

/* ボタン */
.btn {
  font: inherit; color: var(--ink); cursor: pointer;
  border: 0; border-radius: 999px;
  background: var(--cream);
  box-shadow: 0 3px 0 var(--line), 0 4px 10px rgba(150, 90, 20, .12);
  padding: 10px 18px; font-size: 16px; font-weight: 700;
  transition: transform .08s ease, box-shadow .08s ease, opacity .2s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line), 0 2px 6px rgba(150, 90, 20, .12); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.big { font-size: 20px; padding: 14px 40px; background: linear-gradient(180deg, #ffb54d, var(--orange)); color: #fff; box-shadow: 0 4px 0 var(--orange-d), 0 6px 14px rgba(217, 122, 20, .3); text-shadow: 0 1px 0 rgba(160, 80, 0, .35); }
.btn.big:active { box-shadow: 0 1px 0 var(--orange-d), 0 2px 6px rgba(217, 122, 20, .3); }
.btn.small { font-size: 14px; padding: 8px 14px; }
.btn.ghost { background: rgba(255, 250, 240, .85); }
.btn.mint { background: linear-gradient(180deg, #a6e3c9, var(--mint)); color: #2f6b55; box-shadow: 0 3px 0 var(--mint-d), 0 4px 10px rgba(60, 140, 110, .2); }
.btn:focus-visible { outline: 3px solid #ffd27a; outline-offset: 2px; }

.muteBtn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 250, 240, .9) center / 24px 24px no-repeat;
  box-shadow: 0 2px 0 var(--line);
  flex: none;
}
#scTitle > .muteBtn { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 16px; }
.muteBtn.on { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%236b4528'/%3E%3Cpath d='M16 8.5c1.2 1 1.8 2.2 1.8 3.5s-.6 2.5-1.8 3.5M18.6 6c2 1.6 3 3.6 3 6s-1 4.4-3 6' stroke='%236b4528' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.muteBtn.off { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%23b49a80'/%3E%3Cpath d='M16.5 9.5l5 5M21.5 9.5l-5 5' stroke='%23b49a80' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* タイトル */
.titleWrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; min-height: 0; }
.logo { margin: 0; line-height: 1.15; font-weight: 800; letter-spacing: .02em; }
.logo .l1 { display: block; font-size: clamp(24px, 7vw, 34px); color: var(--orange-d); }
.logo .l2 { display: block; font-size: clamp(28px, 8.6vw, 42px); color: var(--ink); }
#titleArt { display: block; }
.lead { margin: 0; font-size: 15px; line-height: 1.7; color: var(--ink-soft); }
.small { font-size: 12px; }
.hint { margin: 0; color: var(--ink-soft); opacity: .8; }

/* 上の帯 */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.barTitle { flex: 1; text-align: center; font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stNo { color: var(--orange-d); margin-right: .4em; }

/* 面えらび */
.starTotal { text-align: center; margin: 6px 0 10px; color: var(--ink-soft); font-size: 14px; }
.starTotal b { color: var(--star); font-size: 16px; }
.stageGrid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-content: start; padding: 4px 2px 12px; }
.stBtn {
  position: relative; aspect-ratio: 1 / 1.05; border: 0; border-radius: 18px; cursor: pointer; font: inherit; color: var(--ink);
  background: linear-gradient(160deg, #ffd56e, #f6a53b);
  box-shadow: 0 3px 0 #d98a24, inset 0 0 0 3px rgba(255, 255, 255, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px;
}
.stBtn .num { font-size: 22px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 rgba(160, 80, 0, .45); }
.stBtn .st { font-size: 13px; letter-spacing: 1px; color: rgba(150, 80, 10, .28); }
.stBtn .st .on { color: #fffbe0; text-shadow: 0 1px 0 #b86a08, 0 0 3px rgba(180, 100, 0, .6); }
.stBtn .nm { font-size: 9.5px; color: #7a4a14; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stBtn.locked { background: linear-gradient(160deg, #efe4cf, #dccbaa); box-shadow: 0 3px 0 #c9b38b; cursor: default; }
.stBtn.locked .num { color: #b8a27e; text-shadow: none; }
.stBtn.locked .zz { font-size: 12px; color: #a68f6a; }
.stBtn.cleared::after { content: ""; position: absolute; right: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #fff6c9; }
.stBtn:active:not(.locked) { transform: translateY(2px); box-shadow: 0 1px 0 #d98a24; }

/* あそぶ */
.info { display: flex; justify-content: center; gap: 10px; margin-top: 4px; }
.pill { background: var(--cream); border-radius: 999px; padding: 5px 14px; font-size: 14px; box-shadow: 0 2px 0 var(--line); }
.pill b { font-size: 18px; color: var(--orange-d); margin: 0 2px; }
.pill.soft b { color: var(--ink); }
.bubbleRow { height: 34px; display: flex; justify-content: center; align-items: center; margin-top: 6px; }
.bubble {
  position: relative; max-width: 100%; background: #fff; border-radius: 14px; padding: 5px 12px; font-size: 13.5px; color: var(--ink);
  box-shadow: 0 2px 0 var(--line); opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bubble.show { opacity: 1; transform: none; }
.bubble.mint { background: #e6f7ef; color: #2f6b55; box-shadow: 0 2px 0 #bfe6d4; }
.boardWrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
#board { display: block; touch-action: none; }
.tools { display: flex; gap: 8px; justify-content: center; padding-top: 8px; }
.tools .btn { flex: 1; max-width: 150px; padding: 11px 6px; font-size: 15px; }

/* クリア */
.overlay { position: fixed; inset: 0; background: rgba(255, 238, 205, .78); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; animation: fadeIn .3s ease; }
.card {
  width: min(360px, 100%); background: var(--cream); border-radius: 26px; padding: 18px 18px 20px; text-align: center;
  box-shadow: 0 6px 0 var(--line), 0 14px 40px rgba(150, 90, 20, .2); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.clearHead { font-size: 26px; font-weight: 800; color: var(--orange-d); letter-spacing: .1em; }
.clearImg { height: min(190px, 26vh); display: block; margin: 4px auto 0; animation: bob 2.4s ease-in-out infinite; }
.stars { font-size: 38px; letter-spacing: 6px; height: 48px; margin-top: 2px; }
.stars span { display: inline-block; color: var(--star-off); transform: scale(.4); opacity: 0; animation: starIn .4s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.stars span.on { color: var(--star); text-shadow: 0 2px 0 #d48e0a; }
.clearLine { margin: 6px 0 4px; font-size: 15px; line-height: 1.6; min-height: 3.2em; }
.clearMoves { margin: 0 0 12px; font-size: 13px; color: var(--ink-soft); }
.cardBtns { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cardBtns .row { display: flex; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-6px); } }

@media (max-height: 640px) {
  .clearImg { height: 120px; }
  .bubbleRow { height: 28px; margin-top: 2px; }
}
