/* Cozy Garden Night — UI styling. Warm, dusky palette to match the night scene. */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #07060d; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff; -webkit-user-select: none; user-select: none; touch-action: none;
}
#game { position: fixed; inset: 0; display: block; width: 100%; height: 100%; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#tasks {
  position: absolute; top: 16px; left: 16px;
  background: rgba(18, 16, 33, 0.62); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 220, 150, 0.18);
  border-radius: 14px; padding: 12px 14px; min-width: 230px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.tasks-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.4px;
  color: #ffd9a0; margin-bottom: 8px; text-transform: uppercase;
}
.task {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; padding: 4px 0; color: #e9e6f5; transition: opacity 0.3s;
}
.task .check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.35);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: #8dffa0; flex: 0 0 auto;
}
.task.done .check { border-color: #6cff7a; background: rgba(108,255,122,0.16); }
.task.done .label { text-decoration: line-through; opacity: 0.65; }
.task .label { flex: 1; }
.task .count { font-variant-numeric: tabular-nums; color: #ffd9a0; font-size: 12px; }

#prompt {
  position: absolute; left: 50%; bottom: 92px; transform: translate(-50%, 14px);
  background: rgba(20, 18, 36, 0.8); border: 1px solid rgba(255,220,150,0.3);
  border-radius: 30px; padding: 9px 18px; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity 0.18s, transform 0.18s; white-space: nowrap;
}
#prompt.show { opacity: 1; transform: translate(-50%, 0); }
#prompt .key {
  display: inline-block; min-width: 22px; padding: 1px 7px; margin-right: 6px;
  background: #ffd9a0; color: #2a1c0a; border-radius: 7px; font-weight: 800;
  text-align: center; font-size: 13px;
}

#toasts {
  position: absolute; left: 50%; top: 70px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: rgba(28, 22, 48, 0.9); border: 1px solid rgba(255,210,140,0.3);
  border-radius: 12px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  opacity: 0; transform: translateY(-12px); transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.in { opacity: 1; transform: translateY(0); }

#top-buttons { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; pointer-events: auto; }
#mute-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(18,16,33,0.62); color: #fff; font-size: 20px; cursor: pointer;
  backdrop-filter: blur(8px);
}
#mute-btn:hover { background: rgba(40,34,66,0.8); }

/* ---------------- Start screen ---------------- */
#start-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1b1840, #07060d 75%);
  transition: opacity 0.6s; padding: 20px;
}
#start-screen.hidden { opacity: 0; pointer-events: none; }
.start-card {
  width: min(440px, 92vw); text-align: center;
  background: rgba(20, 17, 38, 0.72); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,220,150,0.2); border-radius: 22px;
  padding: 22px 26px 26px; box-shadow: 0 24px 70px rgba(0,0,0,0.55);
}
#title-art {
  width: 100%; height: 180px; object-fit: cover; border-radius: 14px;
  margin-bottom: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.start-card h1 {
  font-size: 30px; font-weight: 800; letter-spacing: 0.3px;
  background: linear-gradient(90deg, #ffd9a0, #ff9ad6, #b98cff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tagline { font-size: 14px; line-height: 1.5; color: #cfc9e6; margin: 10px 0 18px; }
#load-bar {
  height: 8px; border-radius: 6px; background: rgba(255,255,255,0.12);
  overflow: hidden; margin-bottom: 8px;
}
#load-fill {
  height: 100%; width: 2%; border-radius: 6px;
  background: linear-gradient(90deg, #ffd9a0, #ff9ad6); transition: width 0.3s;
}
#load-text { font-size: 12px; color: #b6aede; margin-bottom: 16px; min-height: 16px; }
#start-btn {
  width: 100%; padding: 14px; font-size: 17px; font-weight: 700; cursor: pointer;
  border: none; border-radius: 14px; color: #2a1c0a;
  background: linear-gradient(90deg, #ffd9a0, #ffb86b);
  transition: transform 0.15s, filter 0.15s;
}
#start-btn:disabled { filter: grayscale(0.6) brightness(0.8); cursor: default; }
#start-btn:not(:disabled):hover { transform: translateY(-2px); filter: brightness(1.05); }
.controls-hint {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px;
  margin-top: 16px; font-size: 12px; color: #aaa2cf;
}
.controls-hint b { color: #ffd9a0; }

/* ---------------- Win screen ---------------- */
#win-screen {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(40,30,70,0.7), rgba(7,6,13,0.88));
  transition: opacity 0.5s;
}
#win-screen.hidden { opacity: 0; pointer-events: none; }
.win-card {
  width: min(420px, 92vw); text-align: center;
  background: rgba(24, 19, 44, 0.85); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,220,150,0.28); border-radius: 22px;
  padding: 32px 28px; box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.win-emoji { font-size: 52px; margin-bottom: 8px; }
.win-card h2 {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(90deg, #ffd9a0, #ff9ad6);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.win-card p { font-size: 14px; line-height: 1.5; color: #cfc9e6; margin: 12px 0 22px; }
#replay-btn {
  padding: 12px 28px; font-size: 16px; font-weight: 700; cursor: pointer;
  border: none; border-radius: 14px; color: #2a1c0a;
  background: linear-gradient(90deg, #ffd9a0, #ffb86b);
  transition: transform 0.15s, filter 0.15s;
}
#replay-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }

/* ---------------- Touch controls ---------------- */
.joy-base {
  position: fixed; width: 112px; height: 112px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.25);
  display: none; z-index: 20; pointer-events: none;
}
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px;
  margin: -25px 0 0 -25px; border-radius: 50%;
  background: rgba(255,217,160,0.55); border: 2px solid rgba(255,255,255,0.5);
}
.touch-interact {
  position: fixed; right: 28px; bottom: 40px; z-index: 20;
  width: 84px; height: 84px; border-radius: 50%; font-size: 34px;
  border: 2px solid rgba(255,220,150,0.45); color: #fff;
  background: rgba(40,30,66,0.6); backdrop-filter: blur(6px); cursor: pointer;
}
.touch-interact:active { background: rgba(255,217,160,0.35); }

.hidden { opacity: 0 !important; pointer-events: none !important; }

@media (max-width: 560px) {
  #tasks { min-width: 180px; padding: 9px 11px; transform: scale(0.9); transform-origin: top left; }
  #title-art { height: 130px; }
  .start-card h1 { font-size: 24px; }
}
