:root {
  --bg: #12100e;
  --bg-2: #1a1612;
  --ink: #f4efe8;
  --muted: #b7a898;
  --line: rgba(244, 239, 232, 0.1);
  --gold: #e8b86d;
  --gold-2: #c48a3a;
  --listen: #3ddc97;
  --think: #f0c35a;
  --speak: #7aa7ff;
  --user: #f4efe8;
  --ai: #e8b86d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(232, 184, 109, 0.16), transparent 55%),
    radial-gradient(800px 400px at 80% 100%, rgba(196, 138, 58, 0.08), transparent 50%),
    var(--bg);
  z-index: 0;
}

.topbar,
main,
.mask,
.sheet {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 18px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

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

main {
  height: calc(100dvh - 62px - var(--safe-top));
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0 18px calc(16px + var(--safe-bottom));
  gap: 8px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
}

.orb {
  position: relative;
  width: min(52vw, 220px);
  height: min(52vw, 220px);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.orb-core,
.orb-ring {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
}

.orb-core {
  background:
    radial-gradient(circle at 35% 30%, #fff6e8 0%, var(--gold) 32%, var(--gold-2) 78%);
  box-shadow: 0 10px 40px rgba(196, 138, 58, 0.35);
}

.orb-ring {
  inset: 0;
  border: 1px solid rgba(232, 184, 109, 0.28);
  box-shadow: inset 0 0 40px rgba(232, 184, 109, 0.08);
}

.orb.listening .orb-core {
  background: radial-gradient(circle at 35% 30%, #eafff5 0%, var(--listen) 40%, #1f8a5a 80%);
  animation: pulse 1.6s ease-in-out infinite;
}

.orb.listening .orb-ring {
  border-color: rgba(61, 220, 151, 0.45);
  animation: ring 1.6s ease-out infinite;
}

.orb.thinking .orb-core {
  background: radial-gradient(circle at 35% 30%, #fff4cc 0%, var(--think) 42%, #b8861f 80%);
  animation: spin-glow 1.1s linear infinite;
}

.orb.speaking .orb-core {
  background: radial-gradient(circle at 35% 30%, #eef4ff 0%, var(--speak) 40%, #3558b8 80%);
  animation: pulse 0.9s ease-in-out infinite;
}

.orb.idle .orb-core {
  filter: saturate(0.85);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes ring {
  0% {
    transform: scale(0.92);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.08);
    opacity: 0.15;
  }
}

@keyframes spin-glow {
  0% {
    filter: hue-rotate(0deg) brightness(1);
  }
  50% {
    filter: hue-rotate(18deg) brightness(1.15);
  }
  100% {
    filter: hue-rotate(0deg) brightness(1);
  }
}

.status {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 600;
}

.hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.log-wrap {
  min-height: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.log {
  list-style: none;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.log li {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.log .user {
  align-self: flex-end;
  background: rgba(244, 239, 232, 0.08);
}

.log .ai {
  align-self: flex-start;
  background: rgba(232, 184, 109, 0.12);
}

.log .sys {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  background: transparent;
  padding: 2px 0;
}

.mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 7, 0.72);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 5;
}

.mask[hidden] {
  display: none;
}

.mask-card {
  width: min(420px, 100%);
  text-align: center;
  background: linear-gradient(180deg, #221c16, #161310);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px 24px 24px;
}

.mask-orb {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6e8, var(--gold) 45%, var(--gold-2));
  box-shadow: 0 8px 30px rgba(196, 138, 58, 0.4);
}

.mask-card h1 {
  font-size: 28px;
  margin-bottom: 10px;
}

.mask-card p {
  color: var(--muted);
  line-height: 1.55;
}

.primary {
  margin-top: 22px;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f0c27a, #c48a3a);
  color: #1a1208;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.install-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.sheet[hidden] {
  display: none;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 6;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1c1814;
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 16px 18px calc(20px + var(--safe-bottom));
  border-top: 1px solid var(--line);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.field select {
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #12100e;
  color: var(--ink);
  padding: 0 12px;
  font-size: 15px;
}

.field-note,
.sheet-install {
  margin-top: 14px;
}
