:root {
  --bg-sky-top: #4a7fc9;
  --bg-sky-bottom: #a9d0e8;
  --panel-dark: #10182b;
  --panel-dark-2: #182240;
  --gold: #f4b53f;
  --gold-2: #ffd873;
  --blue-accent: #3aa0ff;
  --purple: #8b5cf6;
  --red: #ef4444;
  --green: #34d67a;
  --text-light: #f5f7ff;
  --text-dim: #9aa4c7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(to bottom, var(--bg-sky-top), var(--bg-sky-bottom));
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.currency {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-dark);
  border-radius: 20px;
  padding: 6px 8px 6px 6px;
  color: var(--text-light);
  font-weight: 700;
  font-size: 15px;
}

.currency-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.coin-icon { background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold)); color: #7a4b00; }
.gem-icon { background: radial-gradient(circle at 35% 30%, #a9e6ff, var(--blue-accent)); color: #013a63; }

.add-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--blue-accent);
  color: white;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.settings-btn {
  margin-left: auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--panel-dark);
  color: var(--text-light);
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Level bar ---------- */
.level-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 14px 0;
  background: var(--panel-dark);
  border-radius: 20px;
  padding: 8px 14px;
}

.level-label {
  color: var(--text-light);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.level-pct {
  color: var(--text-light);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.bar {
  flex: 1;
  height: 12px;
  background: #0a0f1e;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 10px;
  transition: width 0.25s ease;
}

.bar-level .bar-fill { background: linear-gradient(to right, #6fe36f, var(--green)); }
.bar-clock .bar-fill { background: linear-gradient(to right, #ff7847, var(--gold)); }

/* ---------- Screens ---------- */
.screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 6px 14px 0;
}

.screen.active { display: flex; }

.placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-light);
}

.placeholder-icon { font-size: 48px; opacity: 0.8; }
.placeholder p { font-weight: 700; font-size: 16px; opacity: 0.85; }

.headline {
  text-align: center;
  color: white;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
  font-size: 20px;
  letter-spacing: 0.5px;
  margin: 8px 0 6px;
}

/* ---------- Clock progress bar ---------- */
.clock-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-dark);
  border-radius: 20px;
  padding: 8px 14px;
  margin-bottom: 8px;
}

.clock-bar-icon { font-size: 18px; }
.clock-bar-text {
  color: var(--text-light);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

/* ---------- Game area ---------- */
.game-area {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.multiplier-box {
  position: absolute;
  left: 0;
  top: 8px;
  background: var(--panel-dark-2);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 5;
  box-shadow: 0 0 16px rgba(244,181,63,0.6);
}

.multiplier-box.hidden { display: none; }

.multiplier-label {
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
}

.multiplier-value {
  color: white;
  font-size: 20px;
  font-weight: 900;
}

.multiplier-timer {
  color: var(--text-dim);
  font-size: 11px;
}

.tools-col {
  position: absolute;
  right: 0;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5;
}

.tool-btn {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
}

.tool-hammer { background: linear-gradient(160deg, #2b5876, #1a2e42); }
.tool-lightning { background: linear-gradient(160deg, #6d3ac9, #3a1e63); }
.tool-star { background: linear-gradient(160deg, #1a2e42, #0e1930); border-color: var(--gold); }

.tool-btn.depleted { opacity: 0.55; filter: grayscale(0.4); }

.tool-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--blue-accent);
  color: white;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--panel-dark);
}

.clock-tap-target {
  position: relative;
  width: min(78vw, 340px);
  height: min(78vw, 340px);
  touch-action: none;
  cursor: pointer;
}

#clockSvg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.35));
}

#clockSvg.shatter-anim {
  animation: shatterPop 0.35s ease forwards;
}

@keyframes shatterPop {
  0% { transform: scale(1); opacity: 1; }
  60% { transform: scale(1.15); opacity: 0.3; }
  100% { transform: scale(0.7); opacity: 0; }
}

.clock-face {
  fill: #f2e8d0;
  stroke: #2b1d0e;
  stroke-width: 6;
}

.clock-rim {
  fill: none;
  stroke: #6b4a25;
  stroke-width: 10;
}

.clock-ticks line {
  stroke: #2b1d0e;
  stroke-width: 3;
}

.clock-hand {
  stroke: #1a1108;
  stroke-linecap: round;
}
.clock-hand.hour { stroke-width: 9; }
.clock-hand.minute { stroke-width: 6; }

.clock-pin { fill: #1a1108; }

.crack-layer path {
  fill: none;
  stroke: #14171c;
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.crack-layer path.visible { opacity: 0.85; }

/* ---------- FX layer (particles / floating text) ---------- */
.fx-layer {
  position: absolute;
  inset: -40px;
  pointer-events: none;
  overflow: visible;
}

.shard {
  position: absolute;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #fff, #cfd8ff);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  opacity: 0.95;
  will-change: transform, opacity;
}

.float-dmg {
  position: absolute;
  font-weight: 900;
  font-size: 20px;
  color: var(--gold-2);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  will-change: transform, opacity;
  pointer-events: none;
}

@keyframes floatUp {
  0% { transform: translate(-50%, -50%); opacity: 1; }
  100% { transform: translate(-50%, calc(-50% - 50px)); opacity: 0; }
}

@keyframes shardBurst {
  0% { transform: translate(0, 0) scale(1); opacity: 0.95; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.4) rotate(var(--rot)); opacity: 0; }
}

/* ---------- Hints ---------- */
.hints {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 10px 0 8px;
}

.hint-chip {
  background: var(--panel-dark);
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-light);
}

.hint-icon { font-size: 20px; }
.hint-text { font-size: 11px; font-weight: 700; line-height: 1.2; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  display: flex;
  background: var(--panel-dark);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.nav-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 10px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.nav-icon { font-size: 18px; }

.nav-btn.active {
  color: var(--blue-accent);
}

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20,20,30,0.92);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
