:root {
  --bg: #0f1b2d;
  --bg2: #16263d;
  --ink: #f3f6fb;
  --ink2: #b8c4d6;
  --mint: #6ee7c8;
  --sky: #7cc4ff;
  --violet: #b59cff;
  --coral: #ff8a7a;
  --sun: #ffd36e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 70% at 50% 0%, #1d3557 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: 20px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
.view {
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
[hidden] { display: none !important; }

/* PIN */
.brand { font-size: 2.4rem; margin: 18vh 0 8px; letter-spacing: .04em; background: linear-gradient(90deg, var(--mint), var(--sky), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pin { width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.pin-label { color: var(--ink2); font-size: 1rem; }
.pin input { font-size: 2rem; text-align: center; letter-spacing: .4em; padding: 14px; border-radius: 16px; border: 2px solid #2c4366; background: var(--bg2); color: var(--ink); }
.btn-primary, .btn-secondary { font: inherit; font-size: 1.3rem; padding: 14px 18px; border-radius: 16px; border: 0; }
.btn-primary { background: var(--mint); color: #062a22; font-weight: 700; }
.btn-secondary { background: var(--bg2); color: var(--ink); border: 2px solid #2c4366; }
.msg { min-height: 1.4em; color: var(--coral); text-align: center; margin: 0; }

/* 대화 */
.top { width: 100%; display: flex; justify-content: space-between; align-items: baseline; color: var(--ink2); }
.brand-sm { font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.today { font-size: .9rem; }
.status { margin: 4vh 0 0; min-height: 2.6em; font-size: 1.7rem; font-weight: 700; text-align: center; }
.status[data-phase="asking"] { color: var(--sun); }
.status[data-phase="speaking"] { color: var(--sky); }
.status[data-phase="listening"] { color: var(--mint); }
.status[data-phase="ended"], .status[data-phase="idle"] { color: var(--ink); }
.status .sub { display: block; font-size: 1.05rem; font-weight: 400; color: var(--ink2); margin-top: 4px; }

.talk {
  width: min(64vw, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  font: inherit;
  color: #062a22;
  background: radial-gradient(circle at 35% 30%, #a8f5e0, var(--mint) 55%, #2fb08f);
  box-shadow: 0 10px 40px rgba(110, 231, 200, .35), inset 0 -8px 20px rgba(0, 0, 0, .15);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform .15s ease, background .3s ease, box-shadow .3s ease;
  margin: 2vh 0;
  touch-action: manipulation;
}
.talk:active { transform: scale(.96); }
.talk-icon { font-size: 3.6rem; line-height: 1; }
.talk-label { font-size: 1.6rem; font-weight: 800; }
.talk[data-phase="connecting"] { background: radial-gradient(circle at 35% 30%, #cfe6ff, var(--sky) 60%, #3d84c4); animation: pulse 1.2s ease-in-out infinite; }
.talk[data-phase="listening"] { background: radial-gradient(circle at 35% 30%, #a8f5e0, var(--mint) 55%, #2fb08f); animation: breathe 2.4s ease-in-out infinite; }
.talk[data-phase="speaking"] { background: radial-gradient(circle at 35% 30%, #d9eeff, var(--sky) 55%, #3d84c4); box-shadow: 0 10px 50px rgba(124, 196, 255, .55); }
.talk[data-phase="asking"] { background: radial-gradient(circle at 35% 30%, #fff0c4, var(--sun) 55%, #c79a2a); animation: pulse 1.6s ease-in-out infinite; }
.talk[data-phase="closing"] { background: radial-gradient(circle at 35% 30%, #e6defe, var(--violet) 60%, #6c55c9); }
.talk.live .talk-label { font-size: 1.3rem; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes breathe { 0%, 100% { box-shadow: 0 10px 30px rgba(110, 231, 200, .25); } 50% { box-shadow: 0 10px 60px rgba(110, 231, 200, .6); } }

.hint { margin: 0; color: var(--ink2); font-size: 1rem; text-align: center; }

.captions { width: 100%; display: flex; flex-direction: column; gap: 8px; max-height: 38vh; overflow-y: auto; padding: 2px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: 1.25rem; word-break: keep-all; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: #2b4466; }
.bubble.aurora { align-self: flex-start; background: #1f3a33; }
.bubble .who { display: block; font-size: .8rem; color: var(--ink2); }

.more { width: 100%; margin-top: auto; color: var(--ink2); }
.more summary { cursor: pointer; font-size: 1rem; padding: 8px 0; }
.more-body { display: flex; flex-direction: column; gap: 8px; }
.small { font-size: .95rem; margin: 0; }
.rules { padding-left: 1.1em; display: flex; flex-direction: column; gap: 4px; }
.asks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.asks li { background: var(--bg2); border-radius: 12px; padding: 10px 12px; font-size: .95rem; color: var(--ink); }
.asks .q { color: var(--sun); }
.asks .a { white-space: pre-wrap; margin-top: 4px; }
.asks .t { color: var(--ink2); font-size: .85rem; }

/* 목소리 고르기('자세히' 안) */
.set { border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 8px 12px 10px; margin: 4px 0; display: flex; flex-direction: column; gap: 8px; }
.set legend { padding: 0 4px; font-size: 1rem; }
.voices { display: flex; flex-direction: column; gap: 8px; }
.voice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.voice label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 100%; font-size: 1rem; }
.voice .note { flex-basis: 100%; padding-left: 26px; opacity: .8; }
.voice input[type=radio] { width: 20px; height: 20px; }
.btn-mini { font: inherit; font-size: .9rem; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: inherit; margin-left: 26px; }
.btn-mini + .btn-mini { margin-left: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.check input { width: 20px; height: 20px; }
.check select { font: inherit; font-size: 1rem; padding: 4px 8px; border-radius: 8px; background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.25); }
.check select option { color: #111; }
