:root {
  color-scheme: light;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #12313f;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(18, 49, 63, 0.16);
  --accent: #f5774d;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #d7eef6;
}

body {
  color: var(--ink);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 100svh;
  overflow: hidden;
  background: linear-gradient(180deg, #76cdfa 0%, #c5ecff 58%, #76c99d 100%);
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}


.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.hud-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.scorebox,
.icon-button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(25, 70, 94, 0.12);
  backdrop-filter: blur(12px);
}

.scorebox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.scorebox {
  width: 72px;
}


.icon-button {
  width: 38px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
  pointer-events: auto;
}

.icon-button:active,
.primary:active,
.secondary:active {
  transform: translateY(1px) scale(0.99);
}

.start-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}

.start-layer[hidden] {
  display: none;
}

.start-panel {
  display: flex;
  width: min(360px, 100%);
  flex-direction: column;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 60px rgba(28, 75, 101, 0.24);
  padding: 22px;
  text-align: center;
}

h1 {
  margin: 0;
  color: #153a49;
  font-size: clamp(34px, 12vw, 48px);
  line-height: 0.94;
  letter-spacing: 0;
}

.status {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #386373;
  font-size: 14px;
  line-height: 1.45;
}

.start-layer.is-result .status {
  min-height: auto;
  color: #214d5e;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.2;
}

.loading-dots {
  display: none;
  height: 26px;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.start-layer.is-loading .loading-dots {
  display: flex;
}

.start-layer.is-result .loading-dots {
  display: none;
}


.button-row {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr;
  gap: 8px;
}

.primary,
.secondary {
  min-width: 0;
  height: 46px;
  padding: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}

.primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(245, 119, 77, 0.26);
}

.secondary {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: #244c5c;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 7;
  max-width: min(86vw, 340px);
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(18, 49, 63, 0.84);
  color: white;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 560px) {
  .game {
    left: 50%;
    width: min(430px, 100vw);
    transform: translateX(-50%);
    box-shadow: 0 0 0 1px rgba(18, 49, 63, 0.12), 0 30px 80px rgba(18, 49, 63, 0.18);
  }
}
