:root {
  --gold: #f4c95d;
  --gold-strong: #ffd166;
  --ink: #f6efdf;
  --muted: rgba(246, 239, 223, 0.55);
  --line: rgba(244, 201, 93, 0.26);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(92% 72% at 50% 56%, rgba(255, 178, 84, 0.2) 0%, rgba(198, 124, 44, 0.07) 38%, rgba(8, 9, 16, 0) 70%),
    linear-gradient(180deg, #232647 0%, #191b2c 34%, #0e0f1a 66%, #07080e 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  height: 100svh;
  width: 100%;
}

#scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.sky-moon {
  position: absolute;
  top: 17%;
  right: 7%;
  z-index: 0;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff8e2, #ffe9b8 58%, #f3d092);
  -webkit-mask: radial-gradient(circle at 70% 32%, transparent 0 45%, #000 47%);
  mask: radial-gradient(circle at 70% 32%, transparent 0 45%, #000 47%);
  filter: drop-shadow(0 0 14px rgba(255, 220, 150, 0.55)) drop-shadow(0 0 44px rgba(255, 200, 110, 0.26));
  opacity: 0.9;
  pointer-events: none;
}

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 36%, transparent 45%, rgba(0, 0, 0, 0.62) 100%);
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 26px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 7, 12, 0.58), rgba(5, 7, 12, 0.16) 58%, transparent);
}

.hud > * { pointer-events: auto; }

.stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.stat {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(12, 16, 26, 0.62);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.coin {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a6, #e8a92f 58%, #9c6a14);
  box-shadow: 0 0 10px rgba(255, 190, 70, 0.5);
}

.today-value {
  min-width: 46px;
  color: var(--gold-strong);
  font: 700 16px/1 inherit;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #8fe3a7;
  box-shadow: 0 0 8px rgba(143, 227, 167, 0.8);
  animation: livePulse 2.4s ease-in-out infinite;
}

.live-dot.stale {
  background: #8a93a8;
  box-shadow: none;
  animation: none;
}

@keyframes livePulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.apples b {
  min-width: 24px;
  text-align: center;
  font-size: 15px;
  color: var(--gold-strong);
  font-variant-numeric: tabular-nums;
}

.apple-icon {
  position: relative;
  width: 15px;
  height: 14px;
  flex: none;
  border-radius: 48% 48% 44% 44% / 54% 54% 46% 46%;
  background: radial-gradient(circle at 34% 28%, #fff4c6, #f4c04a 55%, #9c6a14);
  box-shadow: 0 0 8px rgba(255, 198, 80, 0.55);
}

.apple-icon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -4px;
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: #7a5320;
  transform: translateX(-50%) rotate(10deg);
}

.hint-chip {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  left: 50%;
  top: calc(68px + env(safe-area-inset-top));
  z-index: 3;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(12, 16, 26, 0.62);
  border: 1px solid var(--line);
  color: #ffd166;
  font-size: 16px;
  letter-spacing: 0.18em;
  pointer-events: none;
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

.picker {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 4;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(560px, calc(100% - 28px));
  padding: 14px 16px;
  border-radius: 24px;
  background: rgba(13, 16, 25, 0.84);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
  animation: rise 0.22s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(244, 201, 93, 0.32);
  background: rgba(255, 255, 255, 0.04);
  color: #ffd166;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn.gold {
  border: 0;
  background: linear-gradient(135deg, #ffe193, #e8a92f 55%, #b97b16);
  color: #2a1a02;
  box-shadow: 0 10px 26px rgba(232, 169, 47, 0.35);
}

.slider-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  padding-bottom: 6px;
}

.name-row {
  display: flex;
  justify-content: center;
  margin-bottom: 1px;
}

#nickname {
  width: 150px;
  padding: 4px 8px;
  text-align: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 209, 102, 0.26);
  border-radius: 0;
  color: #ffe9c0;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

#nickname::placeholder {
  color: rgba(255, 233, 192, 0.42);
  letter-spacing: 0.2em;
}

#nickname:focus {
  border-bottom-color: rgba(255, 209, 102, 0.65);
}

.price-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 2px;
}

.mood { font-size: 20px; }

.price-value {
  font-size: 27px;
  font-weight: 700;
  color: #ffe1a0;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(244, 201, 93, 0.16), rgba(244, 201, 93, 0.85));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 235, 180, 0.9);
  background: radial-gradient(circle at 35% 30%, #fff3cf, #f0b53d 60%, #a06a12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(244, 201, 93, 0.16), rgba(244, 201, 93, 0.85));
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 235, 180, 0.9);
  background: radial-gradient(circle at 35% 30%, #fff3cf, #f0b53d 60%, #a06a12);
}

.tick {
  position: absolute;
  left: 31%;
  bottom: 14px;
  width: 2px;
  height: 10px;
  transform: translateX(-1px);
  border-radius: 1px;
  background: rgba(255, 209, 102, 0.85);
  box-shadow: 0 0 8px rgba(255, 200, 90, 0.7);
  pointer-events: none;
}

.toast {
  position: absolute;
  left: 50%;
  top: calc(76px + env(safe-area-inset-top));
  z-index: 5;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(20, 23, 32, 0.92);
  border: 1px solid rgba(244, 201, 93, 0.35);
  color: #ffe0a0;
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: pop 0.2s ease-out;
}

@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.fallback {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #070a13;
}

.hidden { display: none !important; }

@media (max-width: 720px) {
  .hud {
    padding: calc(12px + env(safe-area-inset-top)) 14px 24px;
  }

  .sky-moon {
    top: 15%;
    right: 8%;
    width: 46px;
    height: 46px;
  }

  .stat { height: 34px; padding: 0 10px; }

  .today-value { min-width: 40px; font-size: 15px; }

  .hint-chip { top: calc(64px + env(safe-area-inset-top)); }

  .picker {
    gap: 10px;
    padding: 12px 12px;
    border-radius: 20px;
  }

  .icon-btn { width: 44px; height: 44px; }

  .price-value { font-size: 24px; }
}
