/* あわじまゲーム共通キット(16bit喫茶店トーン)
   Coffee Merge / SUGAR BREAK が使う共通の見た目。
   盤面(canvas)の背景色などゲーム固有の差分は各ページの <style> で上書きする */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(ellipse 70% 35% at 50% -5%, rgba(232,168,78,.16), transparent 70%),
    #241a12;
  color: #f2e0c4;
  font-family: 'DotGothic16', 'Hiragino Maru Gothic ProN', sans-serif;
  display: flex; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
/* ブラウン管風スキャンライン */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 30;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.07) 2px 4px);
}
#wrap { width: min(440px, 100vw); padding: 8px 8px 16px; display: flex; flex-direction: column; align-items: center; }

/* ---- トップバー(ホーム / タイトル / ⏸ / 🔊 / 🏆) ---- */
#topbar { width: 100%; display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
#homeBtn, #rankTop, #pauseBtn, #muteBtn {
  font-size: 13px; color: #f2e0c4; text-decoration: none; white-space: nowrap;
  border: 2px solid #8a5a33; border-radius: 8px; padding: 8px 12px 7px;
  background: rgba(138,90,51,.3); letter-spacing: .05em; cursor: pointer;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
#pauseBtn, #muteBtn { padding: 8px 10px 7px; }
#homeBtn:hover, #rankTop:hover, #pauseBtn:hover, #muteBtn:hover { background: rgba(138,90,51,.6); }
#homeBtn:active, #rankTop:active, #pauseBtn:active, #muteBtn:active { transform: scale(.96); }
header {
  flex: 1; text-align: center; white-space: nowrap; overflow: hidden;
  font-family: 'Press Start 2P', monospace; font-size: clamp(8px, 2.4vw, 13px); letter-spacing: 0;
  margin: 0; color: #f2e0c4; text-shadow: 0 2px 0 #2a1c10;
}

/* ---- モードタブ(デイリー / フリー) ---- */
#bar { width: 100%; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.tab {
  flex: 1; padding: 8px 0 7px; font-size: 14px; font-family: inherit;
  border: 2px solid #8a5a33; border-radius: 8px; background: rgba(242,224,196,.05);
  color: #c9a87c; cursor: pointer;
}
.tab.active { background: #f2e0c4; border-color: #f2e0c4; color: #3a2a1d; }

/* ---- HUD(スコア等の横並び) ---- */
#hud {
  width: 100%; display: flex; justify-content: space-between; font-size: 14px;
  padding: 0 4px 6px; color: #c9a87c;
}
#hud b { font-size: 18px; color: #f2e0c4; }

/* ---- 盤面の額縁(背景色はゲームごとに指定) ---- */
canvas#cv {
  display: block; border-radius: 8px;
  border: 3px solid #f2e0c4; outline: 3px solid #2a1c10;
  box-shadow: inset 0 0 0 3px #8a5a33, 0 8px 30px rgba(0,0,0,.45);
}

footer { margin-top: 10px; font-size: 13px; color: #8a6d50; }

/* ---- ゲームオーバーパネル ---- */
#overlay {
  position: fixed; inset: 0; background: rgba(20,12,6,.6);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
#overlay.hidden { display: none; }
#panel {
  background: linear-gradient(#4a3526, #2e2118);
  border: 4px solid #f2e0c4; outline: 4px solid #2a1c10;
  box-shadow: inset 0 0 0 4px #8a5a33, 0 8px 30px rgba(0,0,0,.5);
  border-radius: 10px; padding: 24px 28px 18px; text-align: center;
  width: min(320px, 86vw); color: #f2e0c4;
}
#panel h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: .08em; }
#panel .row { font-size: 14px; margin: 6px 0; color: #c9a87c; }
#panel .row b { font-size: 20px; color: #f2e0c4; }
#panel .row span { color: #f2e0c4; }
#panel button {
  display: block; width: 100%; margin-top: 10px; padding: 12px 0 11px; font-size: 15px;
  font-family: inherit; border: 2px solid #8a5a33; border-radius: 8px; cursor: pointer;
}
#againBtn { background: #f2e0c4; border-color: #f2e0c4; color: #3a2a1d; }
#rankBtn, #shareBtn { background: rgba(242,224,196,.06); color: #f2e0c4; }

/* ---- トースト(kit.js が .kit-toast を注入する) ---- */
.kit-toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: #f2e0c4; color: #3a2a1d; border: 2px solid #2a1c10;
  padding: 10px 22px; border-radius: 8px;
  font-size: 14px; z-index: 20; transition: opacity .4s; opacity: 0;
  pointer-events: none; white-space: nowrap;
}
