:root {
  --bg: #061019; --panel: #0d1c27; --panel2: #132836; --line: #21425a; --text: #e8f6fb; --muted: #8fb0bf;
  --accent: #3ff0c8; --accent2: #b06cff; --good: #6cf0a0; --bad: #ff5c6c; --warn: #ffd257;
  --display: "Bungee", "Rubik", system-ui, sans-serif; --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); line-height: 1.5; }
body { min-height: 100vh; padding: 0 16px 40px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.wrap { max-width: 1000px; margin: 0 auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; flex-wrap: wrap; }
header.top a { color: var(--muted); text-decoration: none; }
header.top a:hover { color: var(--text); }
h1.logo { font-family: var(--display); font-weight: 400; margin: 10px 0 4px; font-size: clamp(2rem, 8vw, 3.8rem); line-height: 1;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--muted); margin: 0 0 16px; }

.btn { border: 0; border-radius: 99px; padding: 11px 20px; font-weight: 700; background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #061019; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 6px 14px; font-size: .9rem; }
.btn.big { padding: 15px 28px; font-size: 1.1rem; }
.btn.danger { background: var(--bad); color: #1a0508; }

.hud { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.hud > div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; display: grid; min-width: 0; }
.hud b { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.hud span { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { display: block; height: 10px; margin-top: 7px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 50%; background: linear-gradient(90deg, var(--warn), var(--good)); transition: width .4s; }
.meter.low i { background: var(--bad); }

.tank { position: relative; border-radius: 18px; overflow: hidden; border: 3px solid #2c5870;
  box-shadow: 0 0 0 6px #0b1b26, 0 18px 40px rgba(0,0,0,.5), inset 0 0 40px rgba(63,240,200,.12); background: #0a3a52; cursor: pointer; touch-action: manipulation; }
.tank canvas { display: block; width: 100%; }
.start { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center;
  background: rgba(3,10,16,.72); backdrop-filter: blur(2px); cursor: default; }
.start p { margin: 0; color: var(--muted); }
.start.gone { display: none; }
.debug { position: absolute; left: 8px; top: 8px; padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.55); color: var(--warn); font: 12px/1.4 ui-monospace, Consolas, monospace; pointer-events: none; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.btn.talk { font-family: var(--display); font-weight: 400; font-size: 1.5rem; padding: 16px 34px; letter-spacing: .04em; }
.btn.talk.listening { background: var(--bad); color: #1a0508; animation: pulse 1s infinite; }
.btn.feed { font-family: var(--display); font-weight: 400; font-size: 1.1rem; padding: 14px 24px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255,92,108,.18); } }
.typed { display: flex; gap: 8px; flex: 1 1 260px; min-width: 0; }
.typed input { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 11px 16px; }
.typed input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.voice-note { color: var(--warn); margin: 8px 0 0; min-height: 1.5em; font-size: .95rem; }

.captions { margin-top: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; min-height: 96px; max-height: 260px; overflow-y: auto; }
.captions p { margin: 4px 0; }
.captions .him b { color: var(--accent); }
.captions .you b { color: var(--accent2); }
.captions .note { color: var(--muted); font-style: italic; }
.live { color: var(--muted); font-style: italic; min-height: 1.5em; margin: 6px 2px 0; }
.privacy { color: var(--muted); font-size: .88rem; margin-top: 18px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; max-width: 560px; width: calc(100% - 32px); padding: 22px 24px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { font-family: var(--display); font-weight: 400; margin: 0 0 8px; color: var(--accent); }
dialog h3 { margin: 14px 0 2px; font-size: 1rem; }
dialog p, dialog li { color: #c6dde6; }
dialog ul { padding-left: 20px; margin: 0; }

@media (max-width: 640px) {
  .hud { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .btn.talk { flex: 1 1 auto; }
}
