/* GUS: dark, dreamy, glowy UI. */
:root {
  --bg0: #07061a;
  --bg1: #0e0a2c;
  --bg2: #17124a;
  --panel: rgba(16, 12, 48, 0.78);
  --panel-solid: #120e38;
  --line: rgba(150, 140, 255, 0.22);
  --line-hi: rgba(120, 240, 225, 0.45);
  --text: #ece9ff;
  --muted: #a7a3d6;
  --dim: #7470a8;
  --teal: #3fe6d2;
  --teal-2: #20b3a6;
  --violet: #a184ff;
  --magenta: #ff5fd2;
  --gus: #ffb35c;
  --gus-hi: #ffd9a0;
  --danger: #ff6b7a;
  --radius: 20px;
  --radius-sm: 14px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --pad: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body { position: fixed; inset: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

#app {
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 110%, rgba(63, 230, 210, 0.12), transparent 60%),
    radial-gradient(90% 70% at 15% -10%, rgba(161, 132, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#world, #touch-ui { position: absolute; inset: 0; }
#world { z-index: 0; }
#world canvas { display: block; }
#touch-ui { z-index: 2; pointer-events: none; }
#touch-ui > * { pointer-events: auto; }
#bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; transition: opacity 0.8s; }
body.playing #bg { opacity: 0; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(60, 50, 150, 0.45), rgba(30, 24, 90, 0.5));
  color: var(--text);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 0.12s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  touch-action: manipulation;
}
.btn:hover { border-color: var(--line-hi); box-shadow: 0 0 22px rgba(63, 230, 210, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .icon-btn:focus-visible, .hud-btn:focus-visible, .choice:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.btn-primary {
  background: linear-gradient(180deg, #46f0dc, #1fae9f);
  color: #06201e;
  border-color: rgba(160, 255, 240, 0.6);
  box-shadow: 0 0 28px rgba(63, 230, 210, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-primary:hover { box-shadow: 0 0 38px rgba(63, 230, 210, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn-big { min-height: 58px; font-size: 1.15rem; padding: 14px 28px; }
.btn-small { min-height: 42px; font-size: 0.92rem; padding: 8px 16px; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; box-shadow: none; }
.btn-quiet:hover { color: var(--text); border-color: var(--line); box-shadow: none; }
.btn-danger { background: rgba(255, 107, 122, 0.12); border-color: rgba(255, 107, 122, 0.4); color: #ffc2c8; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
  color: var(--muted); font-size: 1.05rem; display: grid; place-items: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-hi); }

.card {
  background: linear-gradient(180deg, rgba(28, 22, 78, 0.82), rgba(14, 10, 42, 0.86));
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(120, 100, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

/* ---------------- the Gus orb (CSS) ---------------- */
.logo-orb, .dlg-orb, .talk-orb {
  position: relative;
  display: inline-block;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3d6 0%, #ffd27a 22%, #ff9d3c 60%, #e2621c 100%);
  box-shadow: 0 0 18px rgba(255, 170, 80, 0.85), 0 0 60px rgba(255, 140, 50, 0.45);
  flex: none;
}
.logo-orb { width: 86px; height: 86px; animation: bob 3.2s ease-in-out infinite; }
.logo-orb i {
  position: absolute; top: 34%; width: 22%; height: 26%; border-radius: 50%;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.logo-orb i::after { content: ""; position: absolute; width: 50%; height: 50%; left: 30%; top: 32%; border-radius: 50%; background: #1b1340; animation: look 6s ease-in-out infinite; }
.logo-orb i:first-child { left: 24%; }
.logo-orb i:last-child { right: 24%; }
.logo-orb::after { content: ""; position: absolute; left: 50%; top: -16%; width: 3px; height: 18%; background: #ffcf8a; transform: translateX(-50%); border-radius: 2px; }
.logo-orb::before { content: ""; position: absolute; left: 50%; top: -26%; width: 12%; height: 12%; border-radius: 50%; background: #fff4c0; transform: translateX(-50%); box-shadow: 0 0 10px #ffe08a; }
.dlg-orb { width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; animation: pulse 2.2s ease-in-out infinite; }
.talk-orb { width: 18px; height: 18px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes look { 0%, 40% { transform: translate(0, 0); } 50%, 70% { transform: translate(-30%, 10%); } 80%, 100% { transform: translate(25%, 0); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 10px rgba(255, 170, 80, 0.8); } 50% { box-shadow: 0 0 22px rgba(255, 170, 80, 1), 0 0 40px rgba(255, 140, 50, 0.5); } }

/* ---------------- screens ---------------- */
.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--sat) + var(--pad)) calc(var(--sar) + var(--pad)) calc(var(--sab) + var(--pad)) calc(var(--sal) + var(--pad));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.45s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
body.playing .screen { background: rgba(5, 4, 20, 0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* age gate */
.gate { z-index: 50; background: radial-gradient(100% 70% at 50% 0%, #1d1658, var(--bg0) 70%); }
.gate-card { max-width: 480px; width: 100%; padding: 34px 28px 26px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; margin: auto; }
.gate-orb { width: 64px; height: 64px; }
.gate-title { margin: 6px 0 0; font-size: 2.4rem; letter-spacing: 0.16em; color: var(--gus-hi); text-shadow: 0 0 24px rgba(255, 170, 80, 0.6); }
.gate-lead { margin: 0; font-size: 1.12rem; line-height: 1.55; color: var(--text); }
.gate-actions { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 6px; }

.check { display: inline-flex; align-items: center; gap: 12px; text-align: left; padding: 10px 14px; border-radius: 14px; color: var(--muted); cursor: pointer; min-height: 48px; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line-hi); display: grid; place-items: center; transition: background 0.15s; flex: none; }
.check input:checked + span { background: var(--teal); border-color: var(--teal); }
.check input:checked + span::after { content: "✓"; color: #06201e; font-weight: 900; font-size: 0.95rem; }
.check input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 3px; }

/* title */
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 420px; margin: auto; }
.logo { display: flex; align-items: center; gap: 20px; }
.logo h1 {
  margin: 0; font-size: clamp(4.2rem, 17vw, 7rem); line-height: 1; letter-spacing: 0.08em; font-weight: 900;
  background: linear-gradient(180deg, #fff1d6 10%, #ffbf6e 55%, #ff8a3d 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 160, 70, 0.55)) drop-shadow(0 0 60px rgba(255, 120, 60, 0.25));
}
.tagline { margin: 0 0 18px; color: var(--muted); font-size: 1.08rem; letter-spacing: 0.06em; }
.tagline em { color: var(--teal); font-style: normal; font-weight: 700; }
.menu { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.menu-row { display: flex; gap: 12px; width: 100%; }
.menu-row > .btn { flex: 1; }
.title-status { min-height: 1.3em; margin: 12px 0 0; color: var(--muted); font-size: 0.92rem; text-align: center; }
.title-status strong { color: var(--teal); }
.title-foot { color: var(--dim); font-size: 0.8rem; text-align: center; padding-top: 12px; }

/* loading */
.screen-loading { background: radial-gradient(80% 60% at 50% 50%, rgba(23, 18, 74, 0.6), rgba(5, 4, 20, 0.92)); }
.loader { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.loader-orb { width: 70px; height: 70px; animation: bob 1.6s ease-in-out infinite; }
.loader-text { color: var(--muted); font-size: 1.05rem; margin: 0; }
.loader-error { display: flex; flex-direction: column; gap: 12px; align-items: center; max-width: 360px; }
.loader-error-msg { color: #ffc2c8; margin: 0; }

/* summary */
.summary { width: 100%; max-width: 480px; padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 16px; margin: auto; }
.sum-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.summary h2 { margin: -8px 0 0; font-size: 2rem; color: var(--gus-hi); text-shadow: 0 0 22px rgba(255, 170, 80, 0.5); }
.eyebrow { margin: 0; font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal); font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 16px; padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 0.78rem; color: var(--muted); }
.trust-row { display: flex; justify-content: space-between; gap: 10px; white-space: nowrap; color: var(--muted); font-size: 0.92rem; margin-bottom: 8px; }
.trust-row strong { color: var(--gus-hi); }
.trust-bar { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; border: 1px solid var(--line); }
.trust-bar span { display: block; height: 100%; width: 50%; border-radius: inherit; background: linear-gradient(90deg, #ff6b7a, #ffb35c 50%, #3fe6d2); background-size: 400px 100%; transition: width 1.2s cubic-bezier(.2, .9, .3, 1); box-shadow: 0 0 14px rgba(255, 180, 90, 0.6); }
.verdict { margin: 0; padding: 14px 16px; border-radius: 16px; background: rgba(255, 179, 92, 0.08); border: 1px solid rgba(255, 179, 92, 0.25); color: var(--gus-hi); font-size: 1.06rem; line-height: 1.45; }
.next-level { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px; border-radius: 16px; border: 1px dashed var(--line-hi); text-align: center; }
.next-level strong { font-size: 1.1rem; }
.soon { color: var(--muted); font-size: 0.85rem; }

/* ---------------- HUD ---------------- */
#hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.hud-btn {
  pointer-events: auto; position: absolute; top: calc(var(--sat) + 12px);
  height: 48px; min-width: 48px; border-radius: 999px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(14, 10, 42, 0.55); border: 1px solid var(--line); color: var(--text);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-weight: 700; touch-action: manipulation;
}
.hud-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }
#btn-menu { left: calc(var(--sal) + 12px); padding: 0; width: 48px; }
.hud-talk { right: calc(var(--sar) + 12px); }
.hud-talk kbd { font: inherit; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.hud-btn:hover { border-color: var(--line-hi); }

.prompt {
  position: absolute; left: 50%; bottom: calc(var(--sab) + 24%);
  transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px;
  background: rgba(10, 8, 34, 0.6); border: 1px solid var(--line-hi);
  color: var(--text); font-weight: 700; font-size: 1rem; white-space: nowrap;
  box-shadow: 0 0 24px rgba(63, 230, 210, 0.2);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: popIn 0.18s ease both;
  max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.prompt .key { display: inline-grid; place-items: center; min-width: 26px; height: 26px; margin-right: 8px; border-radius: 7px; background: var(--teal); color: #06201e; font-size: 0.85rem; font-weight: 900; padding: 0 6px; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, 6px) scale(0.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

.barks { position: absolute; left: 50%; top: calc(var(--sat) + 74px); transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bark {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 16px 11px 12px; border-radius: 18px 18px 18px 6px;
  background: rgba(20, 12, 44, 0.72); border: 1px solid rgba(255, 179, 92, 0.32);
  color: var(--gus-hi); font-size: 1.04rem; line-height: 1.4; font-weight: 600;
  box-shadow: 0 0 28px rgba(255, 150, 60, 0.18), 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: barkIn 0.3s cubic-bezier(.2, 1.3, .4, 1) both;
  text-shadow: 0 0 12px rgba(255, 160, 60, 0.35);
}
.bark .dlg-orb { margin: 4px 0 0; }
.bark.out { animation: barkOut 0.45s ease forwards; }
.bark.hint { border-color: rgba(63, 230, 210, 0.45); }
@keyframes barkIn { from { opacity: 0; transform: translateY(-8px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes barkOut { to { opacity: 0; transform: translateY(-10px); } }

.trust-pop { position: absolute; left: 50%; bottom: calc(var(--sab) + 50%); transform: translateX(-50%); z-index: 12; pointer-events: none; }
.trust-chip { padding: 7px 14px; border-radius: 999px; font-weight: 800; font-size: 0.92rem; white-space: nowrap; animation: chip 2.4s ease forwards; }
.trust-chip.up { background: rgba(63, 230, 210, 0.18); color: #a9fff3; border: 1px solid rgba(63, 230, 210, 0.5); box-shadow: 0 0 20px rgba(63, 230, 210, 0.35); }
.trust-chip.down { background: rgba(255, 107, 122, 0.16); color: #ffc2c8; border: 1px solid rgba(255, 107, 122, 0.45); }
@keyframes chip { 0% { opacity: 0; transform: translateY(10px); } 12%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-16px); } }

.toasts { position: absolute; z-index: 60; left: 50%; bottom: calc(var(--sab) + 12%); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, calc(100vw - 120px)); }
.toast { padding: 10px 16px; border-radius: 14px; background: rgba(16, 12, 48, 0.88); border: 1px solid var(--line-hi); color: var(--text); font-size: 0.95rem; text-align: center; animation: barkIn 0.25s ease both; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.toast.out { animation: barkOut 0.4s ease forwards; }
.toast.warn { border-color: rgba(255, 107, 122, 0.5); }

/* ---------------- dialogue ---------------- */
.dialogue {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 calc(var(--sar) + 14px) calc(var(--sab) + 14px) calc(var(--sal) + 14px);
  background: linear-gradient(180deg, transparent 45%, rgba(5, 3, 20, 0.55));
  cursor: pointer;
  touch-action: manipulation;
}
.dlg-box {
  position: relative; width: min(780px, 100%);
  padding: 18px 22px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(26, 18, 70, 0.9), rgba(12, 9, 38, 0.92));
  border: 1px solid rgba(255, 179, 92, 0.35);
  box-shadow: 0 0 50px rgba(255, 150, 60, 0.16), 0 20px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: dlgIn 0.28s cubic-bezier(.2, 1.2, .4, 1) both;
}
@keyframes dlgIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.dlg-name {
  display: inline-flex; align-items: center; font-weight: 900; letter-spacing: 0.18em; font-size: 0.82rem;
  color: var(--gus); text-shadow: 0 0 12px rgba(255, 160, 60, 0.6); margin-bottom: 6px;
}
.dlg-text {
  margin: 0; min-height: 3em;
  font-size: clamp(1.08rem, 2.4vw, 1.28rem); line-height: 1.5; font-weight: 600;
  color: var(--gus-hi); text-shadow: 0 0 14px rgba(255, 160, 60, 0.28);
  user-select: text; -webkit-user-select: text;
}
.dlg-text.ooc { color: var(--text); text-shadow: none; font-weight: 500; }
.dlg-next { position: absolute; right: 18px; bottom: 10px; color: var(--muted); font-size: 0.78rem; opacity: 0; transition: opacity 0.2s; }
.dialogue.can-next .dlg-next { opacity: 1; animation: nudge 1.1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(3px); } }
.dlg-choices { display: grid; gap: 10px; margin-top: 14px; }
.dlg-choices:empty { display: none; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 52px; padding: 10px 16px; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
  color: var(--text); font-weight: 650; font-size: 1.02rem; line-height: 1.3;
  animation: barkIn 0.3s ease both; touch-action: manipulation;
}
.choice:nth-child(2) { animation-delay: 0.05s; }
.choice:nth-child(3) { animation-delay: 0.1s; }
.choice .num { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 0.8rem; font-weight: 900; background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.choice .tone { margin-left: auto; flex: none; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); font-weight: 800; }
.choice.kind:hover, .choice.kind:focus-visible { border-color: rgba(63, 230, 210, 0.7); background: rgba(63, 230, 210, 0.1); box-shadow: 0 0 22px rgba(63, 230, 210, 0.2); }
.choice.sarcastic:hover, .choice.sarcastic:focus-visible { border-color: rgba(161, 132, 255, 0.75); background: rgba(161, 132, 255, 0.12); box-shadow: 0 0 22px rgba(161, 132, 255, 0.2); }
.choice.swear:hover, .choice.swear:focus-visible { border-color: rgba(255, 140, 80, 0.75); background: rgba(255, 140, 80, 0.1); box-shadow: 0 0 22px rgba(255, 140, 80, 0.2); }
.choice.kind .tone { color: #7ff1e2; }
.choice.sarcastic .tone { color: #c3b1ff; }
.choice.swear .tone { color: #ffb38a; }

/* ---------------- chat ---------------- */
.chat {
  position: absolute; inset: 0; z-index: 11;
  display: flex; align-items: flex-end; justify-content: center;
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 14px) calc(var(--sab) + 14px) calc(var(--sal) + 14px);
  background: linear-gradient(180deg, transparent 30%, rgba(5, 3, 20, 0.6));
}
.chat-panel { width: min(640px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 12px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(26, 18, 70, 0.92), rgba(12, 9, 38, 0.94)); border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(120, 100, 255, 0.12); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: dlgIn 0.25s ease both; }
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.chat-head .dlg-name { margin: 0; }
.chat-log { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 60px; max-height: 38vh; padding: 2px; user-select: text; -webkit-user-select: text; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; line-height: 1.42; font-size: 1.02rem; animation: barkIn 0.2s ease both; }
.msg.me { align-self: flex-end; background: rgba(63, 230, 210, 0.13); border: 1px solid rgba(63, 230, 210, 0.3); border-bottom-right-radius: 6px; }
.msg.gus { align-self: flex-start; color: var(--gus-hi); background: rgba(255, 179, 92, 0.08); border: 1px solid rgba(255, 179, 92, 0.28); border-bottom-left-radius: 6px; font-weight: 600; }
.msg.ooc { align-self: stretch; max-width: none; color: var(--text); background: rgba(120, 140, 255, 0.12); border: 1px solid rgba(150, 170, 255, 0.45); font-weight: 500; }
.msg.ooc strong { display: block; color: #c9d3ff; margin-bottom: 4px; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }
.msg.thinking { color: var(--muted); font-style: italic; }
.msg.thinking::after { content: "…"; animation: dots 1s steps(3) infinite; display: inline-block; width: 1em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1em; } }
.chat-empty { color: var(--muted); font-size: 0.95rem; text-align: center; padding: 8px; }
.chat-form { display: flex; gap: 10px; }
.chat-input { flex: 1; min-width: 0; min-height: 50px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--text); font-size: 16px; outline: none; user-select: text; -webkit-user-select: text; }
.chat-input:focus { border-color: var(--line-hi); box-shadow: 0 0 0 3px rgba(63, 230, 210, 0.15); }
.chat-foot { display: flex; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 0.78rem; padding: 0 6px; }

/* ---------------- lock overlay ---------------- */
.lock-overlay { position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(5, 4, 20, 0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn 0.2s ease both; }
.lock-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 32px; border-radius: 24px; border: 1px solid var(--line-hi); background: rgba(16, 12, 48, 0.85); color: var(--text); box-shadow: 0 0 40px rgba(63, 230, 210, 0.2); max-width: calc(100vw - 32px); }
.lock-card strong { font-size: 1.3rem; }
.lock-card span { color: var(--muted); font-size: 0.9rem; text-align: center; }
.lock-card:hover { border-color: var(--teal); }

/* ---------------- modals ---------------- */
.modal { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: calc(var(--sat) + 14px) calc(var(--sar) + 14px) calc(var(--sab) + 14px) calc(var(--sal) + 14px); background: rgba(4, 3, 16, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn 0.2s ease both; }
.modal-card { width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; padding: 22px 22px 20px; animation: dlgIn 0.25s ease both; }
.modal-small { max-width: 380px; text-align: center; }
.modal-card h2 { margin: 0 0 14px; font-size: 1.5rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { margin: 0; }
.pause-status { color: var(--muted); font-size: 0.88rem; text-align: center; margin: 14px 0 0; min-height: 1.2em; }
.confirm-text { font-size: 1.08rem; line-height: 1.5; margin: 4px 0 18px; }

.settings { display: flex; flex-direction: column; gap: 4px; }
.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 4px; border-bottom: 1px solid rgba(150, 140, 255, 0.1); min-height: 58px; cursor: pointer; }
.settings .row > span { display: flex; flex-direction: column; gap: 2px; }
.settings small { color: var(--muted); font-size: 0.82rem; }
.settings select { min-height: 44px; padding: 0 34px 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a7a3d6' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center; appearance: none; -webkit-appearance: none; }
.settings input[type="range"] { width: 48%; accent-color: var(--teal); height: 32px; }
.settings .toggle input { position: absolute; opacity: 0; pointer-events: none; }
.settings .toggle i { flex: none; width: 54px; height: 32px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line); position: relative; transition: background 0.2s; }
.settings .toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #d8d4ff; transition: transform 0.2s; }
.settings .toggle input:checked + i { background: var(--teal-2); border-color: var(--teal); }
.settings .toggle input:checked + i::after { transform: translateX(22px); background: #fff; }
.settings .toggle input:focus-visible + i { outline: 2px solid var(--teal); outline-offset: 3px; }
.settings [data-act="reset"] { margin-top: 16px; align-self: center; }

/* profile */
.profile-body { display: flex; flex-direction: column; gap: 14px; }
.profile-body p { margin: 0; color: var(--muted); line-height: 1.5; }
.profile-body p strong { color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 0.92rem; }
.text-input { min-height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.28); color: var(--text); font-size: 16px; outline: none; width: 100%; user-select: text; -webkit-user-select: text; }
.text-input:focus { border-color: var(--line-hi); box-shadow: 0 0 0 3px rgba(63, 230, 210, 0.15); }
.form-error { color: #ffb0b8; font-size: 0.92rem; min-height: 1.2em; margin: 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.save-key {
  display: block; padding: 18px 14px; border-radius: 16px; text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: clamp(1.05rem, 4.6vw, 1.35rem); font-weight: 800; letter-spacing: 0.02em;
  color: var(--gus-hi); background: rgba(255, 179, 92, 0.08); border: 1px dashed rgba(255, 179, 92, 0.55);
  text-shadow: 0 0 14px rgba(255, 160, 60, 0.4); word-break: break-all; user-select: all; -webkit-user-select: all;
}
.who { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.who .logo-orb { width: 40px; height: 40px; animation: none; }
.who .logo-orb::before, .who .logo-orb::after { display: none; }
.who strong { font-size: 1.15rem; display: block; }
.who span { color: var(--muted); font-size: 0.86rem; }

/* touch vs desktop hints */
body.touch .desk-only { display: none !important; }
body:not(.touch) .touch-only { display: none !important; }

/* ---------------- small / landscape phones ---------------- */
@media (max-width: 520px) {
  .gate .btn-big { font-size: 1.04rem; padding: 12px 16px; }
  .summary .menu-row .btn { padding: 12px 12px; }
  .stat-label { font-size: 0.72rem; }
  .hud-talk .talk-label { display: none; }
  .hud-talk { width: 48px; padding: 0; }
  .dlg-box { padding: 14px 16px 16px; border-radius: 20px; }
  .choice { min-height: 50px; font-size: 0.98rem; }
  .choice .tone { display: none; }
  .logo-orb { width: 66px; height: 66px; }
  .logo { gap: 14px; }
}
@media (max-height: 500px) {
  .barks { top: calc(var(--sat) + 10px); width: min(480px, calc(100vw - 150px)); }
  .bark { font-size: 0.96rem; padding: 8px 14px 9px 10px; }
  .dialogue { padding-bottom: calc(var(--sab) + 8px); }
  .dlg-box { padding: 10px 16px 12px; }
  .dlg-text { min-height: 2.6em; font-size: 1.04rem; line-height: 1.4; }
  .dlg-choices { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
  .choice { min-height: 46px; padding: 8px 10px; font-size: 0.92rem; }
  .choice .tone, .choice .num { display: none; }
  .title-wrap { flex-direction: row; flex-wrap: wrap; justify-content: center; max-width: 760px; gap: 8px 28px; }
  .title-wrap .logo { flex-direction: column; gap: 6px; }
  .title-wrap .logo h1 { font-size: 3.4rem; }
  .title-wrap .logo-orb { width: 48px; height: 48px; }
  .title-wrap .tagline { display: none; }
  .title-wrap .menu { width: 360px; gap: 8px; }
  .title-wrap .btn-big { min-height: 50px; }
  .title-status { width: 100%; margin: 0; }
  .title-foot { display: none; }
  .gate-card { padding: 16px 22px; gap: 8px; }
  .gate-orb { display: none; }
  .gate-title { font-size: 1.8rem; }
  .gate-lead { font-size: 1rem; }
  .gate-actions { flex-direction: row; }
  .gate-actions .btn { flex: 1; }
  .summary { padding: 16px 20px; gap: 18px; max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .summary .sum-col { gap: 10px; }
  .summary h2 { font-size: 1.6rem; }
  .summary .stat { padding: 8px 6px; }
  .summary .stat-num { font-size: 1.25rem; }
  .summary .verdict { font-size: 0.98rem; padding: 10px 14px; }
  .summary .next-level { padding: 8px; }
  .toasts { bottom: calc(var(--sab) + 18%); }
  .chat-log { max-height: 32vh; }
  .chat-foot { display: none; }
  .prompt { bottom: calc(var(--sab) + 30%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------------- talk out loud (push-to-talk mic) ---------------- */
.hud-mic { right: calc(var(--sar) + 132px); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.hud-mic kbd { font: inherit; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.mic-ico { font-size: 1.15rem; line-height: 1; }
.hud-mic.rec, .chat-mic.rec { background: rgba(255, 70, 110, 0.55); border-color: rgba(255, 140, 170, 0.9); box-shadow: 0 0 0 6px rgba(255, 70, 110, 0.18); }
/* phones: a big round mic button above the ✋ button, in thumb reach */
body.touch .hud-mic {
  top: auto; right: calc(var(--sar) + 36px); bottom: calc(var(--sab) + 136px);
  width: 64px; height: 64px; padding: 0; border-radius: 50%;
}
body.touch .hud-mic .talk-label, body.touch .hud-mic kbd { display: none; }
body.touch .hud-mic .mic-ico { font-size: 1.6rem; }
@media (max-width: 520px) { .hud-mic .talk-label { display: none; } .hud-mic { right: calc(var(--sar) + 72px); } body.touch .hud-mic { right: calc(var(--sar) + 36px); } }

.chat-mic { min-width: 52px; padding: 0 12px; font-size: 1.15rem; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }

.mic-ind {
  position: absolute; left: 50%; top: calc(var(--sat) + 72px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; z-index: 30;
  background: rgba(14, 10, 42, 0.78); border: 1px solid rgba(255, 140, 170, 0.6); color: var(--text); font-weight: 700;
  pointer-events: none; white-space: nowrap; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.mic-dot { width: 12px; height: 12px; border-radius: 50%; background: #ff5a7e; box-shadow: 0 0 10px #ff5a7e; animation: micpulse 1s ease-in-out infinite; }
.mic-ind.busy .mic-dot { background: #ffc46b; box-shadow: 0 0 10px #ffc46b; }
.mic-ind.busy .mic-level { display: none; }
.mic-level { width: 70px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.mic-level i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6bf0d0, #ff5a7e); transition: width 60ms linear; }
@keyframes micpulse { 50% { transform: scale(0.7); opacity: 0.6; } }
.chat .mic-ind { top: auto; bottom: 120px; }

/* Gus is about to talk (his voice line is loading) */
.dlg-text.waiting:empty::before, .bark.waiting .bark-text { content: ""; }
.dlg-text.waiting:empty::before {
  content: "• • •"; display: inline-block; letter-spacing: 2px; opacity: 0.85; animation: gusdots 1s ease-in-out infinite;
}
.bark.waiting .bark-text { display: inline-block; animation: gusdots 1s ease-in-out infinite; letter-spacing: 2px; }
@keyframes gusdots { 0%, 100% { opacity: 0.35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
