/* Shisha Drop - mobile-first, portrait, no-scroll. Colors come from THEME.vars in game.js. */
:root {
  --bg1: #3a2418;
  --bg2: #1c120d;
  --ink: #fff3dc;
  --accent: #e0a63a;
  --card: #4a3224;
  --board-bg: rgba(30, 18, 12, .55);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Nunito', 'Segoe UI Rounded', 'Arial Rounded MT Bold', system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 50% 0%, var(--bg1), var(--bg2));
  background-size: cover;
}

#app {
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
}

header { text-align: center; flex: 0 0 auto; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
#title { font-size: clamp(22px, 6.5vw, 32px); font-weight: 900; letter-spacing: .5px; color: var(--accent); line-height: 1.1; }
#subtitle { font-size: 11px; font-weight: 700; letter-spacing: .4px; opacity: .85; padding: 0 8px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
#subtitle:empty { display: none; }

#topbar { display: flex; gap: 8px; width: 100%; flex: 0 0 auto; }
.pill {
  flex: 1;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.pill small { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; opacity: .65; line-height: 1; }
.pill b { font-size: 20px; font-weight: 900; line-height: 1.15; }
.pill img { height: 26px; width: 26px; }

#board-wrap {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#board {
  display: block;
  background: var(--board-bg);
  border-radius: 12px;
  box-shadow: 0 0 0 3px var(--accent), 0 8px 20px rgba(0,0,0,.45);
  touch-action: none;
}

#chain { display: flex; align-items: center; gap: 2px; width: 100%; flex: 0 0 auto; }
#chain img { flex: 1 1 0; min-width: 0; max-width: 32px; aspect-ratio: 1; }
#chain i { font-style: normal; font-size: 8px; opacity: .5; }

#tools { display: flex; gap: 8px; width: 100%; flex: 0 0 auto; }
.tool {
  flex: 1;
  border: 0;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  padding: 9px 4px;
  border-radius: 12px;
  box-shadow: 0 3px 0 rgba(0,0,0,.3);
}
.tool:active { transform: translateY(3px); box-shadow: none; }
#btn-mute { flex: 0 0 52px; }
#btn-help { position: relative; }
#btn-help.attention { background: var(--accent); color: #2a1a12; animation: helpPulse 1.4s ease-out infinite; }
@keyframes helpPulse { 0% { box-shadow: 0 0 0 0 rgba(224,166,58,.7); } 70%, 100% { box-shadow: 0 0 0 14px rgba(224,166,58,0); } }

#footer { flex: 0 0 auto; font-size: 10px; font-weight: 700; opacity: .55; text-align: center; }
#footer:empty { display: none; }
@media (max-height: 720px) { #footer { display: none; } }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .6);
  padding: 20px;
}
.hidden { display: none; }
.card {
  width: min(100%, 380px);
  max-height: 90dvh;
  overflow: auto;
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: 22px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: pop .3s;
}
.card h2 { font-size: 26px; font-weight: 900; color: var(--accent); margin-bottom: 8px; }
.card p { font-weight: 700; margin-bottom: 8px; font-size: 18px; }
#over-best { font-size: 14px; opacity: .8; }
#help-list { list-style: none; text-align: left; margin: 10px 0 4px; display: grid; gap: 9px; }
#help-list li { font-size: 14px; font-weight: 700; line-height: 1.35; padding: 8px 10px; background: rgba(255,255,255,.07); border-radius: 12px; }

.big-btn {
  display: block;
  width: 100%;
  border: 0;
  font: inherit;
  font-weight: 900;
  font-size: 18px;
  padding: 12px;
  margin-top: 12px;
  background: var(--accent);
  color: #2a1a12;
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,.35);
}
.big-btn:active { transform: translateY(3px); box-shadow: none; }

@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---------- Leaderboard ---------- */
#initials-form { margin: 6px 0 8px; }
#initials-form label { display: block; font-size: 13px; font-weight: 800; opacity: .8; margin-bottom: 6px; }
#initials {
  width: 7ch;
  font: inherit;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: .15em;
  text-align: center;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(0,0,0,.35);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 4px 0 4px .15em;
  user-select: text;
  -webkit-user-select: text;
}
.scores { margin: 8px 0 2px; }
.scores table { width: 100%; border-collapse: collapse; font-size: 13px; font-weight: 800; }
.scores td { padding: 5px 4px; border-bottom: 1px solid rgba(255,255,255,.1); text-align: left; }
.scores td:first-child { width: 22px; opacity: .6; }
.scores .ini { letter-spacing: .1em; color: var(--accent); font-size: 15px; }
.scores .pts { text-align: right; font-size: 15px; }
.scores .when { text-align: right; font-size: 10px; opacity: .6; font-weight: 700; white-space: nowrap; }
.scores tr.me td { background: rgba(224,166,58,.25); }
.scores .empty { font-size: 14px; opacity: .7; margin: 14px 0; }
#tools { gap: 6px; }
.tool { font-size: 13px; }
#btn-mute { flex: 0 0 46px; }
