/* ============================================================
   ポップコーン・タイピング  スタイル
   遊園地×ポップコーンの、あまくてポップな世界観
   ============================================================ */
:root {
  --cream: #fff7e6;
  --butter: #ffd86b;
  --caramel: #d98326;
  --pop-red: #e8534e;
  --pop-red-d: #c43c37;
  --ink: #5a3b1e;
  --ink-soft: #8a6a45;
  --gold: #f4b32a;
  --panel: rgba(255, 252, 244, 0.92);
  --shadow: 0 8px 24px rgba(120, 80, 30, 0.22);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* 背景 */
#bg {
  position: fixed; inset: 0;
  background-size: cover; background-position: center;
  z-index: -2;
}
#bg-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,255,255,0.05), rgba(255,240,210,0.35) 70%, rgba(255,220,170,0.55));
  z-index: -1;
}

.screen { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* ===== タイトル ===== */
#title-screen {
  display: flex; align-items: center; justify-content: center;
}
.title-card {
  text-align: center;
  background: var(--panel);
  padding: 48px 56px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  border: 4px solid #fff;
  animation: pop-in 0.5s cubic-bezier(.2,1.3,.4,1);
}
.game-title {
  font-size: 56px; line-height: 1.1; color: var(--pop-red);
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 var(--butter);
  letter-spacing: 1px;
}
.subtitle { margin: 18px 0 26px; font-size: 17px; color: var(--ink-soft); }
.kbd-note { margin-top: 16px; font-size: 12px; color: var(--ink-soft); }

.big-btn {
  font-size: 24px; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, var(--pop-red), var(--pop-red-d));
  border: none; padding: 16px 44px; border-radius: 999px;
  cursor: pointer; box-shadow: 0 6px 0 var(--pop-red-d), var(--shadow);
  transition: transform .08s, box-shadow .08s;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--pop-red-d); }

/* ===== ゲーム画面レイアウト ===== */
#game-screen {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-areas: "hud" "stage";
  gap: 14px; padding: 14px;
}

/* HUD */
#hud {
  grid-area: hud;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); border-radius: var(--radius);
  padding: 10px 20px; box-shadow: var(--shadow); border: 3px solid #fff;
}
.hud-main { display: flex; align-items: center; gap: 14px; }
#hud-corn-icon { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.hud-counts #popcorn-count {
  font-size: 38px; font-weight: 900; color: var(--caramel); line-height: 1;
  font-variant-numeric: tabular-nums;
}
#cps-line { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
#cps-count { font-weight: 700; color: var(--ink); }

.hud-stats { display: flex; align-items: center; gap: 18px; }
.stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--ink-soft); }
.stat span:last-child { font-size: 20px; font-weight: 800; }
.salt-stat { flex-direction: row; gap: 6px; }
#salt-icon { width: 26px; height: 26px; object-fit: contain; }
.icon-btn {
  font-size: 22px; background: #fff; border: 2px solid var(--butter);
  border-radius: 50%; width: 44px; height: 44px; cursor: pointer;
}

/* ステージ（タイピング） */
#stage {
  grid-area: stage; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; border-radius: var(--radius);
}
#fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* ===== 目的：ポップコーン容器（CSS/SVGで描画） ===== */
#container-wrap {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center;
  margin-bottom: 10px;
}
#container-name {
  font-weight: 900; font-size: 22px; color: var(--pop-red);
  text-shadow: 0 0 6px #fff, 2px 2px 0 #fff; margin-bottom: 6px; letter-spacing: 1px;
}
#container-box {
  position: relative; width: 128px; height: 150px;
  background: rgba(255,255,255,.42);
  border: 4px solid #fff; border-radius: 14px 14px 22px 22px;
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(216,131,38,.22);
  overflow: hidden;
}
#container-box.clear { animation: cont-clear .6s cubic-bezier(.2,1.5,.3,1); }
@keyframes cont-clear { 0%{transform:scale(1);} 35%{transform:scale(1.18) rotate(-3deg);} 100%{transform:scale(1);} }
#container-fill {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 0%;
  background: linear-gradient(0deg, #e29a2e, #ffd457 55%, #fff0c0);
  transition: height .18s ease-out;
}
/* ポップコーンの泡だった上面 */
#container-foam {
  position: absolute; top: -7px; left: -4px; right: -4px; height: 14px;
  background:
    radial-gradient(circle at 8% 60%, #fff6da 6px, transparent 6.5px),
    radial-gradient(circle at 22% 45%, #fffaf0 7px, transparent 7.5px),
    radial-gradient(circle at 38% 60%, #fff2cf 6px, transparent 6.5px),
    radial-gradient(circle at 54% 45%, #ffffff 7px, transparent 7.5px),
    radial-gradient(circle at 70% 60%, #fff6da 6px, transparent 6.5px),
    radial-gradient(circle at 86% 48%, #fffaf0 7px, transparent 7.5px);
}
/* 容器の縦ストライプ（ポップコーン箱っぽさ） */
#container-stripes {
  position: absolute; inset: 0; pointer-events: none; opacity: .16;
  background: repeating-linear-gradient(90deg, var(--pop-red) 0 13px, transparent 13px 26px);
}
#container-logo {
  position: absolute; bottom: 8px; left: 0; width: 100%; text-align: center;
  font-weight: 900; font-size: 13px; color: var(--pop-red); opacity: .5; letter-spacing: 1px;
  pointer-events: none;
}
#container-amount { margin-top: 6px; font-size: 14px; font-weight: 800; color: var(--ink); }
#container-bar {
  margin-top: 4px; width: 150px; height: 8px; background: rgba(255,255,255,.55);
  border: 2px solid #fff; border-radius: 999px; overflow: hidden;
}
#container-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--butter), var(--caramel));
  transition: width .18s ease-out;
}

/* 終盤：宇宙モード（背景を宇宙に） */
body.space-mode #bg { filter: brightness(.7); }
body.space-mode #bg-overlay {
  background:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 60% 20%, #fff, transparent),
    radial-gradient(2px 2px at 80% 50%, #fff, transparent),
    radial-gradient(1px 1px at 35% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 50% 85%, #fff, transparent),
    radial-gradient(1px 1px at 90% 80%, #fff, transparent),
    radial-gradient(ellipse at 50% 40%, rgba(60,30,90,.35), rgba(10,8,30,.7) 80%);
  opacity: 1;
}

/* ポップコーン生成ゲージ（左端の縦バー） */
#gen-gauge {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 48px; height: 58%; z-index: 3;
  background: rgba(255,255,255,.55); border: 3px solid #fff; border-radius: 999px;
  overflow: hidden; box-shadow: var(--shadow);
}
#gen-fill {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 0%;
  background: linear-gradient(0deg, var(--caramel), var(--butter), #fff7cf);
  transition: height .12s ease-out;
}
#gen-spark { position: absolute; top: 5px; width: 100%; text-align: center; font-size: 20px; opacity: .85; }
#gen-label {
  position: absolute; bottom: 6px; width: 100%; text-align: center;
  font-size: 12px; font-weight: 800; color: var(--ink);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}
#gen-label small { display: block; font-size: 9px; color: var(--ink-soft); }

/* 入手フキダシ */
.equip-bubble {
  position: absolute; z-index: 6; transform: translate(-50%, -100%);
  background: #fff; color: var(--ink); font-weight: 800; font-size: 14px;
  padding: 8px 16px; border-radius: 14px; border: 3px solid var(--butter);
  box-shadow: var(--shadow); white-space: nowrap;
  animation: bubble-pop .4s cubic-bezier(.2,1.5,.4,1), bubble-fade .5s 2s forwards;
}
.equip-bubble::after {
  content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  border: 8px solid transparent; border-top-color: #fff;
}
@keyframes bubble-pop { from { transform: translate(-50%,-100%) scale(.4); opacity: 0; } to { transform: translate(-50%,-100%) scale(1); opacity: 1; } }
@keyframes bubble-fade { to { opacity: 0; transform: translate(-50%,-130%) scale(1); } }

#typing-panel {
  position: relative; z-index: 1; text-align: center;
  background: var(--panel); border-radius: 24px; padding: 22px 44px 26px;
  box-shadow: var(--shadow); border: 4px solid #fff; min-width: 460px;
}
#typing-panel.bump { animation: panel-bump .12s ease-out; }
@keyframes panel-bump { 0%{transform:scale(1);} 50%{transform:scale(1.03);} 100%{transform:scale(1);} }
#word-display {
  font-size: 40px; font-weight: 900; margin: 14px 0 10px; color: var(--ink);
  letter-spacing: 2px;
  text-shadow: 0 0 6px #fff, 0 0 6px #fff, 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
}
#romaji-guide {
  font-size: 26px; letter-spacing: 3px; font-family: "Courier New", monospace; font-weight: 700;
  text-shadow: 0 0 5px #fff, 0 0 5px #fff, 1px 1px 0 #fff, -1px -1px 0 #fff;
}
#romaji-done { color: var(--pop-red); }
#romaji-left { color: #c9b89a; }
#typing-panel.miss { animation: shake .25s; }

/* コンボ */
#combo-badge {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 3; background: linear-gradient(180deg, var(--butter), var(--gold));
  color: var(--ink); font-weight: 900; padding: 8px 22px; border-radius: 999px;
  box-shadow: var(--shadow); border: 3px solid #fff; display: flex; align-items: baseline; gap: 8px;
}
#combo-num { font-size: 30px; }
.combo-x { font-size: 13px; }
#combo-mult { font-size: 22px; color: var(--pop-red); }
#combo-badge.pulse { animation: pulse .3s; }

/* 数字キーのヒントバー */
#key-hints {
  position: absolute; bottom: 46px; left: 50%; transform: translateX(-50%);
  z-index: 3; display: flex; gap: 10px;
}
.key-hint {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--panel); border: 3px solid #fff; border-radius: 14px;
  padding: 8px 14px; cursor: pointer; box-shadow: var(--shadow);
  font-weight: 800; color: var(--ink); transition: transform .08s;
}
.key-hint .kh-name, .key-hint .kh-cost { white-space: nowrap; }
.key-hint:active { transform: translateY(2px); }
.key-hint kbd {
  background: var(--ink); color: #fff; border-radius: 8px; padding: 2px 9px;
  font-size: 16px; font-family: inherit; box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.key-hint .kh-name { font-size: 13px; }
.key-hint .kh-cost { font-size: 13px; color: var(--caramel); }
.key-hint.affordable { border-color: var(--butter); box-shadow: 0 0 0 3px var(--butter), var(--shadow); }
.key-hint.affordable kbd { background: var(--pop-red); animation: kbd-glow 1s infinite; }
.key-hint.locked { opacity: .6; }
.key-hint.locked .kh-cost { color: #bbb; }
.key-hint.maxed .kh-cost { color: var(--ink-soft); }
.key-hint.pressed { animation: kh-press .42s cubic-bezier(.2,1.4,.4,1); }
.key-hint.press-fail { animation: kh-fail .42s; }
@keyframes kh-press {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); box-shadow: 0 0 0 5px var(--butter), 0 0 18px var(--gold); }
  100% { transform: scale(1); }
}
@keyframes kh-fail { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-6px);} 75%{transform:translateX(6px);} }
@keyframes kbd-glow { 0%,100%{box-shadow:0 2px 0 rgba(0,0,0,.3);} 50%{box-shadow:0 2px 0 rgba(0,0,0,.3), 0 0 10px var(--pop-red);} }

/* 山盛りメーター */
#pile-wrap {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: 60%; max-width: 520px; height: 22px; z-index: 1;
  background: rgba(255,255,255,.55); border-radius: 999px; overflow: hidden;
  border: 2px solid #fff; box-shadow: var(--shadow);
}
#pile-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--butter), var(--gold), var(--caramel));
  transition: width .4s ease;
}
#pile-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--ink);
}

/* ===== ショップ ===== */
#shop {
  grid-area: shop; display: flex; flex-direction: column;
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 3px solid #fff; overflow: hidden;
}
#shop-tabs { display: flex; }
.tab {
  flex: 1; padding: 12px 4px; border: none; cursor: pointer;
  background: #f0e2c8; color: var(--ink-soft); font-weight: 800; font-size: 14px;
}
.tab.active { background: var(--panel); color: var(--pop-red); box-shadow: inset 0 -3px 0 var(--pop-red); }
#shop-body { flex: 1; overflow-y: auto; padding: 12px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ショップ項目カード */
.shop-item {
  display: flex; gap: 12px; align-items: center;
  background: #fff; border-radius: 14px; padding: 10px; margin-bottom: 10px;
  border: 2px solid #f3e6cd; cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.shop-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.shop-item.locked { opacity: .55; cursor: not-allowed; filter: grayscale(.4); }
.shop-item.affordable { border-color: var(--butter); box-shadow: 0 0 0 2px var(--butter); }
.shop-item img { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; background: #fff7e6; }
.si-body { flex: 1; min-width: 0; }
.si-name { font-weight: 800; font-size: 15px; }
.si-desc { font-size: 11px; color: var(--ink-soft); margin: 2px 0 4px; line-height: 1.3; }
.si-meta { display: flex; justify-content: space-between; font-size: 13px; }
.si-cost { font-weight: 800; color: var(--caramel); }
.si-cost.cant { color: #bbb; }
.si-owned { font-weight: 800; color: var(--ink-soft); }
.si-rate { font-size: 11px; color: var(--ink-soft); }

/* 転生パネル */
.prestige-box { text-align: center; padding: 8px; }
.prestige-box img.salt-big { width: 80px; height: 80px; object-fit: contain; margin: 6px; }
.prestige-box h3 { font-size: 18px; color: var(--pop-red); margin-bottom: 8px; }
.prestige-box p { font-size: 13px; color: var(--ink-soft); line-height: 1.6; margin: 6px 0; }
.prestige-gain { font-size: 30px; font-weight: 900; color: var(--gold); }
#prestige-btn {
  margin-top: 14px; width: 100%; font-size: 18px; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, var(--gold), var(--caramel));
  border: none; padding: 14px; border-radius: 14px; cursor: pointer;
  box-shadow: 0 5px 0 var(--caramel);
}
#prestige-btn:disabled { background: #ddd; box-shadow: 0 5px 0 #bbb; cursor: not-allowed; }
#prestige-btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 var(--caramel); }
.reset-link { margin-top: 18px; font-size: 11px; color: #c8a; text-decoration: underline; cursor: pointer; background: none; border: none; }

/* ===== トースト ===== */
#toast-area {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--ink); color: #fff; padding: 12px 24px; border-radius: 999px;
  font-weight: 700; font-size: 15px; box-shadow: var(--shadow);
  animation: toast-in .3s, toast-out .4s 2.6s forwards;
}
.toast.good { background: linear-gradient(90deg, var(--caramel), var(--gold)); }
.toast.big  { font-size: 20px; padding: 16px 32px; }

/* ===== アニメーション ===== */
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes corn-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-4deg); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-8px);} 75%{transform:translateX(8px);} }
@keyframes pulse { 0%{transform:translateX(-50%) scale(1);} 50%{transform:translateX(-50%) scale(1.2);} 100%{transform:translateX(-50%) scale(1);} }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateY(-10px); opacity: 0; } }

/* 画面が狭いとき */
/* ===== レスポンシブ（埋め込み・小さめ画面） ===== */
@media (max-width: 900px) {
  #game-screen { padding: 8px; gap: 8px; }
  #hud { flex-wrap: wrap; padding: 6px 12px; gap: 6px; }
  .hud-main { gap: 8px; }
  #hud-corn-icon { width: 38px; height: 38px; }
  .hud-counts #popcorn-count { font-size: 26px; }
  #cps-line { font-size: 11px; }
  #facility-strip { gap: 6px; margin: 0 6px; justify-content: flex-start; }
  .fac { width: 46px; height: 46px; }
  .hud-stats { gap: 10px; }
  .stat span:last-child { font-size: 16px; }
  #typing-panel { min-width: 0; width: 92%; max-width: 520px; padding: 14px 20px; }
  #word-display { font-size: clamp(22px, 6vw, 36px); margin: 6px 0 8px; }
  #romaji-guide { font-size: clamp(16px, 4.2vw, 24px); }
  #container-box { width: 92px; height: 110px; }
  #container-name { font-size: 17px; }
  #container-amount, #container-bar { font-size: 12px; }
  #gen-gauge { width: 34px; height: 50%; left: 6px; }
  #gen-spark { font-size: 14px; }
  #gen-label { font-size: 9px; }
  #key-hints { bottom: 8px; gap: 6px; flex-wrap: nowrap; justify-content: center; }
  .key-hint { padding: 6px 9px; gap: 5px; }
  .key-hint kbd { padding: 2px 7px; font-size: 13px; }
  .key-hint .kh-name { font-size: 11px; }
  .key-hint .kh-cost { font-size: 11px; }
  .game-title { font-size: 42px; }
}
@media (max-width: 560px) {
  #hud-corn-icon { width: 30px; height: 30px; }
  .hud-counts #popcorn-count { font-size: 21px; }
  .fac { width: 44px; height: 44px; }
  #typing-panel { width: 96%; padding: 10px 12px; }
  #word-display { font-size: clamp(18px, 7vw, 28px); }
  #romaji-guide { font-size: clamp(14px, 5vw, 20px); letter-spacing: 2px; }
  #container-box { width: 74px; height: 92px; }
  #container-name { font-size: 15px; }
  #gen-gauge { display: none; }
  .key-hint kbd { padding: 2px 7px; font-size: 13px; }
  #toast-area { top: 56px; right: 8px; }
  .toast { font-size: 12px; padding: 8px 14px; }
  .toast.big { font-size: 14px; padding: 10px 18px; }
}

/* ============================================================
   v2: 施設ストリップ / レベルUP / 通知移動 / チートモード
   ============================================================ */

/* 施設ストリップ（白いHUDバーの中に大きく並べる。多い時は横スクロール） */
#facility-strip {
  flex: 1; min-width: 0; margin: 0 10px;
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: nowrap; overflow-x: auto; overflow-y: visible;
  padding: 6px 4px; scrollbar-width: thin;
}
#facility-strip::-webkit-scrollbar { height: 6px; }
#facility-strip::-webkit-scrollbar-thumb { background: var(--butter); border-radius: 999px; }
.fac {
  position: relative; flex: 0 0 auto; width: 80px; height: 80px;
  background: #fff; border: 2px solid var(--butter); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(120,80,30,.18);
  animation: fac-in .35s cubic-bezier(.2,1.5,.4,1);
}
.fac img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.fac .fac-n {
  position: absolute; right: -5px; bottom: -5px;
  background: var(--pop-red); color: #fff; font-weight: 800; font-size: 12px;
  padding: 1px 7px; border-radius: 999px; border: 2px solid #fff;
}
.fac.bump { animation: fac-bump .3s; }
@keyframes fac-in { from{transform:scale(.3) translateY(-10px);opacity:0;} to{transform:scale(1);opacity:1;} }
@keyframes fac-bump { 0%{transform:scale(1);} 45%{transform:scale(1.25);} 100%{transform:scale(1);} }

/* チートバッジ */
#cheat-badge {
  background: linear-gradient(180deg,#7b5cff,#5a3bbf); color:#fff; font-weight:900;
  padding: 4px 12px; border-radius: 999px; font-size: 15px; border: 2px solid #fff;
}

/* レベルUPボタン（中央と重ならないよう左上に固定） */
.levelup-btn {
  position: absolute; top: 14px; left: 14px; z-index: 4;
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--panel); border: 3px solid #fff; border-radius: 14px;
  padding: 8px 14px; box-shadow: var(--shadow); font-weight: 800; color: var(--ink);
}
.levelup-btn kbd {
  background: var(--ink); color: #fff; border-radius: 8px; padding: 2px 9px;
  font-size: 15px; font-family: inherit; box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.levelup-btn .lu-cost { font-size: 13px; color: var(--caramel); }
.levelup-btn.affordable { border-color: var(--butter); box-shadow: 0 0 0 3px var(--butter), var(--shadow); }
.levelup-btn.affordable kbd { background: var(--pop-red); animation: kbd-glow 1s infinite; }
@keyframes kbd-glow { 0%,100%{box-shadow:0 2px 0 rgba(0,0,0,.3);} 50%{box-shadow:0 2px 0 rgba(0,0,0,.3),0 0 10px var(--pop-red);} }
.levelup-btn.pressed { animation: kh-press .42s cubic-bezier(.2,1.4,.4,1); }
@keyframes kh-press { 0%{transform:scale(1);} 40%{transform:scale(1.12);} 100%{transform:scale(1);} }

/* 通知トーストを右上へ（中央のタイピングと重ならない） */
#toast-area {
  bottom: auto; top: 70px; right: 16px; left: auto; transform: none;
  align-items: flex-end;
}

/* サブボタン（チートモーダル用） */
.sub-btn {
  font-size: 15px; font-weight: 800; color: var(--caramel); cursor: pointer;
  background: #fff; border: 3px solid var(--butter); padding: 12px 22px; border-radius: 999px;
}
.sub-btn:active { transform: translateY(2px); }

/* クリア／チートモード解放モーダル */
#cheat-modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(40,20,60,.55);
}
.cheat-card {
  text-align: center; background: var(--panel); border: 4px solid #fff; border-radius: 26px;
  padding: 30px 36px; box-shadow: var(--shadow); animation: pop-in .4s cubic-bezier(.2,1.3,.4,1);
  max-width: 92vw;
}
.cheat-emoji { font-size: 54px; }
.cheat-card h2 { color: var(--pop-red); font-size: 26px; margin: 6px 0 10px; }
.cheat-card p { color: var(--ink-soft); font-size: 16px; line-height: 1.6; margin-bottom: 20px; }
.cheat-card b { color: var(--caramel); }
.cheat-buttons { display: flex; gap: 12px; justify-content: center; }

/* タイトルの「放置型タイピングゲーム」タグ */
.game-tag {
  display: inline-block; background: var(--butter); color: var(--ink);
  font-weight: 800; font-size: 13px; padding: 4px 14px; border-radius: 999px;
  margin-bottom: 10px; border: 2px solid #fff;
}

/* 低い/埋め込み画面で要素が重ならないようコンパクト化 */
@media (max-height: 560px) {
  #container-wrap { margin-bottom: 4px; }
  #container-box { width: 64px; height: 78px; }
  #container-name { font-size: 14px; margin-bottom: 2px; }
  #container-amount { font-size: 11px; margin-top: 2px; }
  #container-bar { margin-top: 2px; height: 6px; }
  #combo-badge { top: 6px; padding: 3px 12px; }
  #combo-num { font-size: 18px; }
  #combo-badge .combo-x { font-size: 10px; }
  #combo-mult { font-size: 16px; }
  #typing-panel { padding: 8px 16px; }
  #word-display { font-size: clamp(18px,5vw,26px); margin: 2px 0 4px; }
  #romaji-guide { font-size: clamp(14px,3.5vw,19px); }
  #key-hints { bottom: 6px; }
  #gen-gauge { height: 44%; }
}

/* 埋め込み時は全画面ボタンを隠す（はてな等のiframeでは全画面APIが効かないため） */
html.embedded #fs-btn { display: none; }
