/* Suika — 2D physics drop-merge.
   NOTE: never use a bare `canvas {}` rule — confetti.js injects a global canvas. */

.app {
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
}

.suika-hud {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  justify-content: space-between;
  align-items: center;
}

.hud-cell {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 56px;
}

.hud-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hud-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.1;
  margin-top: 2px;
}

.hud-next {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
}

/* ── Glass-jar effect ─────────────────────────────────────────────────────
   The canvas renders fruit; the wrapper hosts a multi-layer glass overlay
   on TOP (via ::before/::after + inset box-shadow). Effects, top → bottom:
     1. Outer drop shadow — "weight" of a heavy glass jar
     2. Inner rim highlight — thin bright edge around the opening
     3. Top rim band — slightly darker line at the very top (jar mouth)
     4. Left soft highlight streak (wide) — main glass reflection
     5. Right thin highlight streak — secondary reflection
     6. Inner vignette + bottom shadow — depth + accumulated weight at base
   pointer-events: none on overlays so canvas still receives clicks. */
.board-wrapper {
  position: relative;
  width: 100%;
  max-width: 360px;
  border-radius: 18px 18px 24px 24px;
  overflow: hidden;
  /* shape + shadow of the whole jar */
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.18));
  isolation: isolate;
}

#canvas {
  width: 100%;
  height: auto;
  display: block;
  background:
    /* subtle tinted-glass background — light cream with a hint of refraction */
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(255, 220, 150, 0.35) 0%, transparent 60%),
    linear-gradient(180deg, #fffaea 0%, #fff0c8 100%);
  border-radius: 18px 18px 24px 24px;
  /* Inner shadow — depth, bottom pile shadow, rim highlight */
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -2px 0 rgba(140, 95, 35, 0.18),
    inset 0 -28px 38px rgba(120, 70, 20, 0.18),
    inset 6px 0 24px rgba(255, 255, 255, 0.18),
    inset -6px 0 22px rgba(0, 0, 0, 0.06);
  touch-action: none;
  cursor: pointer;
}

/* Glass surface highlights — sit ON TOP of the canvas. */
.board-wrapper::before,
.board-wrapper::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
  z-index: 2;
}
/* Wide soft highlight streak (left side — main reflection) */
.board-wrapper::before {
  left: 6%;
  top: 4%;
  bottom: 18%;
  width: 10%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.28) 35%,
    rgba(255, 255, 255, 0.0)  100%);
}
/* Thin sharp highlight (right side — secondary reflection) */
.board-wrapper::after {
  right: 10%;
  top: 12%;
  height: 36%;
  width: 3.5%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.0)  100%);
  filter: blur(1px);
}

/* Rim band at the top — a thin glassy lip showing the jar opening. */
.board-wrapper > .jar-rim {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 14px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.7) 0%,
    rgba(255, 255, 255, 0.25) 30%,
    rgba(180, 130, 60, 0.15) 65%,
    rgba(120, 80, 30, 0.18) 100%);
  pointer-events: none;
  z-index: 3;
}
.board-wrapper > .jar-rim::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(180deg, rgba(0,0,0,0.16), rgba(0,0,0,0));
}

/* Dark mode — glass tint shifts to cool dark, highlights still visible */
body.dark #canvas {
  background:
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(255, 200, 120, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, #2a2218 0%, #3d2f1c 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    inset 0 -28px 38px rgba(0, 0, 0, 0.35),
    inset 6px 0 24px rgba(255, 255, 255, 0.06),
    inset -6px 0 22px rgba(0, 0, 0, 0.2);
}
body.dark .board-wrapper::before {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.10) 35%,
    rgba(255, 255, 255, 0.0)  100%);
}
body.dark .board-wrapper::after {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.0)  100%);
}
body.dark .board-wrapper > .jar-rim {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.08) 30%,
    rgba(0, 0, 0, 0.25) 65%,
    rgba(0, 0, 0, 0.5) 100%);
}

.toolbar {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  justify-content: center;
}

.toolbar .btn {
  flex: 1;
  max-width: 160px;
}

.suika-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
}
.suika-overlay[hidden] { display: none; }

.overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  padding: 28px 32px;
  text-align: center;
  min-width: 240px;
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0,0,0,.2));
}

.overlay-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 8px;
}

.overlay-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

#daily-btn.active {
  background: var(--accent);
  color: white;
}

/* Error overlay — explicit [hidden] rule because the visible state uses
   display:flex which would otherwise override the browser default. */
#error[hidden] { display: none; }
#error {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 18px;
  padding: 20px;
  text-align: center;
  z-index: 9999;
}
#error .err-detail {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.7;
}
