:root {
  --bg: #04101c; --panel: rgba(12, 34, 56, .62); --line: rgba(90, 210, 255, .28);
  --text: #e6f6ff; --muted: #8fb2cf; --accent: #36d6ff; --accent-rgb: 54, 214, 255; --warn: #ff5a6a;
  --font: "Pretendard", "Noto Sans KR", "Samsung One", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Roboto Mono", "Cascadia Mono", ui-monospace, monospace;
}
body.listening { --accent: #3dffb0; --accent-rgb: 61, 255, 176; }
body.thinking  { --accent: #ffb547; --accent-rgb: 255, 181, 71; }
body.speaking  { --accent: #7fe8ff; --accent-rgb: 127, 232, 255; }
body.ringing   { --accent: #3dffb0; --accent-rgb: 61, 255, 176; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(ellipse 120% 60% at 50% 28%, rgba(var(--accent-rgb), .22) 0%, rgba(var(--accent-rgb), .06) 40%, transparent 70%),
    radial-gradient(ellipse at 50% 100%, #0b2a45 0%, transparent 60%),
    linear-gradient(180deg, #071a2d 0%, var(--bg) 100%);
  color: var(--text); font-family: var(--font); font-size: 15px; overflow: hidden; height: 100dvh;
  transition: background .6s;
}
#bg-grid { position: fixed; inset: 0; pointer-events: none; opacity: .55;
  background-image: linear-gradient(rgba(var(--accent-rgb), .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), .07) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: radial-gradient(ellipse at 50% 35%, #000 25%, transparent 75%); }
#vignette { position: fixed; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 1;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.reactor { display: block; width: 100%; }

/* panel (PC HUD와 같은 모서리 잘린 패널) */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; position: relative;
  padding: 10px 12px; backdrop-filter: blur(8px);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px)); }
.panel::before { content: ""; position: absolute; left: 0; top: 0; width: 34px; height: 2px;
  background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.panel h2 { margin: 0 0 8px; font: 600 10px var(--mono); letter-spacing: .3em; color: var(--accent);
  display: flex; align-items: center; justify-content: space-between; text-shadow: 0 0 8px rgba(var(--accent-rgb), .6); }
.mini { font: 600 10px var(--mono); letter-spacing: .15em; color: var(--muted); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 10px; }
.mini b { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* top */
#top { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 4px; }
.wordmark { font: 700 15px var(--mono); letter-spacing: .32em; color: var(--accent);
  text-shadow: 0 0 14px rgba(var(--accent-rgb), .9), 0 0 2px #fff; display: flex; align-items: center; gap: 8px; }
.wordmark.big { font-size: 22px; justify-content: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent);
  animation: blink 2.4s infinite; display: inline-block; }
.brand { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.state { width: 100%; padding-left: 16px; color: var(--muted); font-size: 12px; }
@keyframes blink { 50% { opacity: .35; } }
.clock { text-align: right; }
#clock-time { font: 500 26px var(--mono); letter-spacing: .08em; text-shadow: 0 0 16px rgba(var(--accent-rgb), .6); line-height: 1; }
#clock-date { font-size: 11px; color: var(--muted); letter-spacing: .08em; margin-top: 3px; }

/* status strip */
#strip { display: grid; grid-template-columns: 1fr 1fr 1.5fr 1.2fr; gap: 6px; padding: 6px 12px 0; }
.cell { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 6px 4px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 66px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
.cell > span { font: 9px var(--mono); letter-spacing: .18em; color: var(--muted); }
.ring-g { position: relative; width: 42px; height: 42px; }
.ring-g svg { width: 100%; height: 100%; transform: rotate(135deg); }
.ring-g circle { fill: none; stroke-width: 8; stroke-linecap: round; stroke-dasharray: 188.5 251.3; }
.ring-g .track { stroke: rgba(var(--accent-rgb), .15); }
.ring-g .val { stroke: var(--accent); stroke-dasharray: 0 251.3; transition: stroke-dasharray .8s;
  filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), .9)); }
.ring-g b { position: absolute; inset: 0; display: grid; place-items: center; font: 600 11px var(--mono); }
.w-temp { font: 300 26px var(--font); line-height: 1; text-shadow: 0 0 12px rgba(var(--accent-rgb), .5); }
.w-temp small { font-size: 13px; color: var(--muted); }
.w-desc { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { font: 700 11px var(--mono); letter-spacing: .15em; color: var(--warn); }
.link.on { color: #3dffb0; text-shadow: 0 0 8px rgba(61, 255, 176, .8); }

/* reactor */
#stage { position: relative; flex: 0 0 auto; height: min(36vh, 330px); }
#reactor { height: 100%; cursor: pointer; }
#tap-hint { position: absolute; bottom: 2px; width: 100%; text-align: center; font: 10px var(--mono);
  letter-spacing: .25em; color: var(--muted); pointer-events: none; }
body.listening #tap-hint { color: var(--accent); }
#caption { text-align: center; padding: 0 18px 6px; min-height: 52px; }
#heard { color: var(--muted); font-size: 13px; min-height: 18px; }
#heard:not(:empty)::before { content: "▸ "; color: var(--accent); }
#said { font-size: 16px; line-height: 1.5; text-shadow: 0 0 18px rgba(var(--accent-rgb), .45);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#said .cursor { display: inline-block; width: 7px; height: 1em; background: var(--accent); margin-left: 3px;
  vertical-align: -2px; animation: blink 1s infinite; }

/* log */
#log-panel { flex: 1; min-height: 90px; margin: 0 12px; display: flex; flex-direction: column; }
#log { flex: 1; overflow-y: auto; font-size: 14px; line-height: 1.55; user-select: text; overscroll-behavior: contain; }
#log .m { margin: 0 0 10px; animation: fadein .35s ease; }
#log .who { font: 600 9px var(--mono); letter-spacing: .22em; color: var(--muted); display: block; margin-bottom: 2px; }
#log .who i { font-style: normal; opacity: .7; letter-spacing: .05em; margin-left: 6px; }
#log .user .who { color: var(--accent); }
#log .user .txt { color: #fff; }
#log .jv .txt { color: var(--text); }
#log .sys { color: var(--muted); font: 11px var(--mono); }
#log .txt { white-space: pre-wrap; word-break: break-word; }
#log a { color: var(--accent); }
#log .act { margin-top: 6px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), .3); border-radius: 2px; }

#notice { margin: 8px 12px 0; padding: 8px 10px; display: flex; align-items: center; gap: 10px; font-size: 13px;
  border: 1px solid rgba(255, 181, 71, .6); background: rgba(255, 181, 71, .12); border-radius: 3px; }
#notice span { flex: 1; }

/* bottom */
#bottom { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px; font-size: 13px;
  background: rgba(8, 24, 40, .6); transition: all .2s; }
.chip:active { transform: scale(.96); }
.chip.on { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px rgba(var(--accent-rgb), .35) inset, 0 0 8px rgba(var(--accent-rgb), .25); }
#ask { display: flex; gap: 8px; }
#text { flex: 1; min-width: 0; background: rgba(8, 24, 40, .85); border: 1px solid var(--line); color: var(--text);
  border-radius: 24px; padding: 0 18px; height: 46px; font-size: 16px; outline: none; }
#text:focus { border-color: var(--accent); box-shadow: 0 0 18px rgba(var(--accent-rgb), .25); }
.round { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: rgba(8, 24, 40, .85);
  display: grid; place-items: center; }
.round svg { width: 21px; height: 21px; fill: var(--accent); filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), .8)); }
.round.send { background: rgba(var(--accent-rgb), .18); border-color: var(--accent); }
body.listening #mic { background: rgba(var(--accent-rgb), .25); box-shadow: 0 0 22px rgba(var(--accent-rgb), .7); border-color: var(--accent); }

/* reminders sheet */
#sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; z-index: 5; }
.sheet-box { width: 100%; max-height: 70vh; overflow-y: auto; margin: 0 8px calc(8px + env(safe-area-inset-bottom)); padding: 14px; background: rgba(8, 26, 44, .97); }
.list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.list li { padding: 9px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.list li .t { font: 12px var(--mono); color: var(--accent); white-space: nowrap; }

/* pair */
#pair { align-items: center; justify-content: center; padding: 20px; gap: 6px; }
#pair-reactor { height: 38vh; max-height: 320px; }
.pair-box { width: 100%; max-width: 360px; text-align: center; padding: 16px; }
.pair-box h2 { justify-content: center; }
.hint { color: var(--muted); line-height: 1.6; margin: 0 0 12px; font-size: 14px; }
.hint b { color: var(--accent); }
#code { width: 100%; text-align: center; font: 600 32px var(--mono); letter-spacing: .4em; padding: 10px;
  background: rgba(4, 14, 24, .9); color: var(--accent); border: 1px solid var(--line); border-radius: 3px; outline: none;
  text-shadow: 0 0 12px rgba(var(--accent-rgb), .7); }
#code:focus { border-color: var(--accent); box-shadow: 0 0 20px rgba(var(--accent-rgb), .3); }
.cta { margin-top: 12px; width: 100%; padding: 13px; font-weight: 700; letter-spacing: .1em; color: #021522;
  background: linear-gradient(90deg, #36d6ff, #7fe8ff); border-radius: 3px; box-shadow: 0 0 22px rgba(54, 214, 255, .5); }
.err { color: var(--warn); min-height: 1.2em; margin: 10px 0 0; font-size: 13px; }

/* call: 받는 전화(cm-in) / 거는 중(cm-out) / 통화 중(cm-live) */
#callview { z-index: 10; justify-content: space-between; padding-top: calc(env(safe-area-inset-top) + 30px);
  background: radial-gradient(ellipse at 50% 40%, rgba(var(--accent-rgb), .25) 0%, rgba(4, 16, 28, .96) 60%, #020910 100%); }
body.cm-in #callview { background: radial-gradient(ellipse at 50% 38%, rgba(61, 255, 176, .32) 0%, rgba(3, 30, 26, .96) 55%, #010c0a 100%); }
body.cm-out #callview, body.cm-live #callview { background: radial-gradient(ellipse at 50% 36%, rgba(var(--accent-rgb), .22) 0%, rgba(4, 16, 28, .97) 55%, #020910 100%); }
.call-top { text-align: center; }
.c-label { display: inline-block; font: 700 11px var(--mono); letter-spacing: .3em; padding: 4px 12px; border-radius: 12px;
  color: #021a12; background: #3dffb0; box-shadow: 0 0 16px rgba(61, 255, 176, .7); margin-bottom: 14px; }
body.cm-out .c-label, body.cm-live .c-label { color: var(--accent); background: transparent; border: 1px solid var(--accent); box-shadow: none; }
.wordmark.big { font-size: 24px; }
.cstatus { margin-top: 8px; font-size: 14px; color: var(--muted); }
body.cm-out .cstatus::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.ctimer { font: 500 30px var(--mono); letter-spacing: .1em; margin-top: 6px; min-height: 0; color: var(--text);
  text-shadow: 0 0 14px rgba(var(--accent-rgb), .7); }
body:not(.cm-live) .ctimer { display: none; }
.c-stage { position: relative; flex: 1; min-height: 0; display: flex; }
#call-reactor { flex: 1; min-height: 0; height: auto; position: relative; z-index: 1; }
body.cm-live .c-stage { flex: 0 0 auto; height: 32vh; }
.ripples { position: absolute; inset: 0; z-index: 2; display: none; place-items: center; pointer-events: none; }
body.cm-in .ripples, body.cm-out .ripples { display: grid; }
.ripples i { grid-area: 1 / 1; width: 46vmin; height: 46vmin; border-radius: 50%; border: 2px solid rgba(var(--accent-rgb), .7);
  animation: ripple 2.4s ease-out infinite; opacity: 0; }
.ripples i:nth-child(2) { animation-delay: .8s; }
.ripples i:nth-child(3) { animation-delay: 1.6s; }
body.cm-out .ripples i { animation-duration: 3.2s; border-style: dashed; }
@keyframes ripple { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.reason { margin: 0 20px; text-align: left; }
.reason h2 { color: #3dffb0; }
#c-reason-text { font-size: 16px; line-height: 1.5; }
body:not(.cm-in) .reason { display: none; }
.call-cap { text-align: center; padding: 0 22px; min-height: 90px; }
body:not(.cm-live) .call-cap { display: none; }
#c-heard { color: var(--muted); font-size: 13px; min-height: 18px; }
#c-heard:not(:empty)::before { content: "▸ "; color: var(--accent); }
#c-said { font-size: 17px; line-height: 1.5; margin-top: 4px; text-shadow: 0 0 18px rgba(var(--accent-rgb), .45);
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cbtns { display: flex; justify-content: space-around; align-items: center; padding: 22px 30px calc(46px + env(safe-area-inset-bottom)); }
body:not(.cm-in) .in-btns { display: none; }
body.cm-in .live-btns { display: none; }
.cbtn { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.cbtn.big { width: 78px; height: 78px; }
.cbtn svg { width: 30px; height: 30px; fill: #fff; }
.cbtn small { position: absolute; bottom: -24px; width: 140%; left: -20%; text-align: center; font-size: 12px; color: var(--muted); }
.cbtn.green { background: #1fcf7a; box-shadow: 0 0 24px rgba(31, 207, 122, .7); animation: pulse 1.2s infinite; }
.cbtn.red { background: #ff4757; box-shadow: 0 0 22px rgba(255, 71, 87, .55); }
.cbtn.grey { background: rgba(255, 255, 255, .1); border: 1px solid var(--line); }
.cbtn.grey svg { fill: var(--accent); }
.cbtn.grey.on { background: #fff; }
.cbtn.grey.on svg { fill: #000; }
.in-btns .cbtn { width: 76px; height: 76px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 207, 122, .7); } 100% { box-shadow: 0 0 0 26px rgba(31, 207, 122, 0); } }
