:root {
  --ink: #e8fff8;
  --muted: #9fc9c7;
  --bg: #04141b;
  --panel: rgba(4, 26, 33, 0.72);
  --line: rgba(159, 232, 224, 0.2);
  --accent: #7fe3e0;
  --gold: #ffd166;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#app canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#vignette {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(0, 8, 12, 0.34) 100%),
    linear-gradient(180deg, rgba(4, 30, 38, 0.06), rgba(1, 8, 12, 0.18));
}

.hidden {
  display: none !important;
}

/* ---- 載入 ---- */

#loading {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-align: center;
  transition: opacity 0.6s ease;
}

/* ---- 覆蓋層 ---- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(4, 30, 38, 0.25), rgba(1, 8, 12, 0.68) 75%);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: overlay-in 0.45s ease both;
}

/* 開始畫面不模糊，讓右側的 Doro 保持清楚；左暗右亮，面板與角色各自有空間。 */
#start-screen {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background:
    radial-gradient(circle at 79% 55%, rgba(190, 255, 247, 0.09), rgba(190, 255, 247, 0) 17%),
    linear-gradient(
      90deg,
      rgba(1, 8, 12, 0.62) 0%,
      rgba(1, 8, 12, 0.46) 34%,
      rgba(1, 8, 12, 0.16) 62%,
      rgba(1, 8, 12, 0.02) 80%,
      rgba(1, 8, 12, 0.14) 100%
    ),
    linear-gradient(180deg, rgba(4, 30, 38, 0.02), rgba(1, 8, 12, 0.22));
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.panel {
  width: min(460px, 94vw);
  max-height: 92vh;
  overflow: auto;
  padding: 42px 42px 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(11, 48, 56, 0.82), rgba(3, 18, 24, 0.9));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(232, 255, 248, 0.08);
}

.panel.small {
  width: min(400px, 92vw);
  padding: 36px 38px 30px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-weight: 500;
  letter-spacing: 0.14em;
}

h1 {
  font-size: clamp(44px, 8vw, 62px);
  line-height: 1.05;
  text-shadow: 0 0 34px rgba(127, 227, 224, 0.28);
}

h2 {
  font-size: 34px;
  line-height: 1.15;
}

.subtitle {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.03em;
}

.controls {
  margin: 26px 0 4px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.controls li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.controls span {
  flex: 0 0 auto;
  color: var(--gold);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
}

button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.primary,
.ghost {
  border-radius: 999px;
  padding: 14px 30px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.primary {
  width: 100%;
  margin-top: 24px;
  border: 0;
  background: linear-gradient(135deg, #a5f4ec, var(--accent) 55%, #4cb9b8);
  color: #032026;
  box-shadow: 0 12px 34px rgba(127, 227, 224, 0.22);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(127, 227, 224, 0.32);
}

.primary:active {
  transform: translateY(0);
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 26px;
}

.button-row .primary {
  margin-top: 0;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.ghost:hover {
  background: rgba(127, 227, 224, 0.08);
}

.footnote {
  margin: 18px 0 0;
  color: rgba(159, 201, 199, 0.62);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-align: center;
}

/* ---- HUD ---- */

#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#zone-name {
  position: absolute;
  top: 28px;
  left: 32px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-shadow: 0 0 18px rgba(127, 227, 224, 0.4);
  opacity: 1;
  transition: opacity 1.4s ease;
}

#zone-name.faded {
  opacity: 0;
}

#controls-hint {
  position: absolute;
  bottom: 28px;
  left: 32px;
  color: rgba(220, 255, 248, 0.52);
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 1;
  transition: opacity 1.6s ease;
}

#controls-hint.faded {
  opacity: 0;
}

#debug {
  position: fixed;
  top: 26px;
  right: 26px;
  z-index: 15;
  padding: 12px 14px;
  border: 1px solid rgba(127, 227, 224, 0.18);
  border-radius: 10px;
  background: rgba(0, 10, 14, 0.72);
  color: #bff5ee;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  white-space: pre;
  pointer-events: none;
}

@media (max-width: 560px) {
  .panel {
    padding: 30px 24px 26px;
    border-radius: 22px;
  }

  h1 {
    font-size: 42px;
  }

  .controls li {
    font-size: 12px;
  }

  #debug {
    display: none;
  }
}
