:root {
  --ground: #0d0e10;
  --panel: #15171a;
  --pill: #16181b;
  --line: #2a2d33;
  --rule: #262930;
  --row: #1f2227;
  --text: #f2f3f5;
  --soft: #c9ced6;
  --sec: #9aa0a8;
  --dim: #6b7078;
  --accent: #8fc8ff;
  --live: #7ee0a5;
  --off: #ff8a80;
  --amber: #ffc98a;
  --sans: Geist, system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'Roboto Mono', monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--text); font-family: var(--sans); }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
h1 { margin: 0; font-weight: 500; }

.primary { height: 48px; padding: 0 20px; border: 0; border-radius: 24px; background: var(--accent); color: var(--ground); font-weight: 600; font-size: 17px; }
.primary:active { background: #b5dbff; }
.primary:disabled { opacity: .5; }
.primary.wide { width: 100%; height: 56px; border-radius: 28px; font-size: 19px; }
.ghost { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--pill); color: var(--soft); font-size: 15px; }
.ghost:disabled { opacity: .4; }
.err { color: var(--off); min-height: 22px; margin: 4px 0 0; font-size: 15px; }

.signin { min-height: 100%; padding: calc(48px + var(--safe-top)) 24px 32px; display: flex; flex-direction: column; gap: 36px; max-width: 480px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand h1 { font-size: 34px; letter-spacing: -.5px; }
.brand p { margin: 4px 0 0; color: var(--sec); font-size: 16px; }
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; color: var(--sec); font-size: 15px; }
.field input { height: 56px; padding: 0 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 19px; outline: none; }
.field input:focus { border-color: var(--accent); }

.app { position: fixed; inset: 0; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.bar { position: relative; flex: none; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 12px 10px 20px; border-bottom: 1px solid var(--rule); }
.bar-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.bar-title h1 { font-size: 26px; letter-spacing: -.3px; white-space: nowrap; }
.conn { font-size: 13px; color: var(--live); white-space: nowrap; }
.conn::before { content: '● '; }
.conn.off { color: var(--off); }
.conn.wait { color: var(--dim); }
.chip { height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-size: 14px; font-weight: 500; }
.iconbtn { width: 44px; height: 44px; border: 0; border-radius: 22px; background: transparent; color: var(--soft); display: flex; align-items: center; justify-content: center; }
.iconbtn:active { background: var(--pill); }
.menu { position: absolute; right: 12px; top: calc(60px + var(--safe-top)); z-index: 20; min-width: 240px; padding: 8px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); display: flex; flex-direction: column; }
.menu-who { padding: 10px 12px; color: var(--sec); font-size: 14px; }
.menu-note { padding: 0 12px 8px; color: var(--dim); font-size: 13px; line-height: 1.35; }
.menu-note:empty { display: none; }
.menu-item { height: 48px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-size: 16px; color: var(--text); }
.menu-item:active { background: var(--pill); }
.menu-item.danger { color: var(--off); }
.menu-item:empty { display: none; }

.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.clips { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; }
.empty { margin: auto; padding: 24px; text-align: center; color: var(--dim); font-size: 16px; line-height: 1.45; max-width: 300px; }
.clip { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 18px; background: var(--panel); max-width: 92%; border: 1px solid transparent; }
.clip.mine { align-self: flex-end; background: #172231; }
.clip.new { border-color: rgba(143, 200, 255, .45); }
.clip.playing { border-color: var(--accent); }
.clip .play { flex: none; width: 48px; height: 48px; border-radius: 24px; border: 0; background: var(--accent); color: var(--ground); display: flex; align-items: center; justify-content: center; }
.clip .play:active { background: #b5dbff; }
.clip .play.loading { opacity: .6; }
.clip .meta { min-width: 0; flex: 1; }
.clip .who { font-size: 16px; font-weight: 500; display: flex; gap: 8px; align-items: baseline; }
.clip .when { font-size: 13px; color: var(--sec); font-weight: 400; }
.clip .bar2 { margin-top: 8px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; min-width: 120px; }
.clip .bar2 i { display: block; height: 100%; width: 0; background: var(--accent); }
.clip .sub { margin-top: 6px; font: 400 12px var(--mono); color: var(--dim); display: flex; justify-content: space-between; gap: 10px; }
.clip .heard { font-family: var(--sans); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.talkbar { flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 16px 18px; border-top: 1px solid var(--rule); }
.rechint { font-size: 15px; color: var(--sec); min-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.rechint.rec { color: var(--off); font-family: var(--mono); font-size: 17px; }
.rechint.err { color: var(--off); }
.hold { width: 132px; height: 132px; border-radius: 66px; border: 0; background: var(--accent); color: var(--ground); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 600; font-size: 15px; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform .12s, background .12s; }
.hold.starting { transform: scale(1.06); background: #b5dbff; }
.hold.rec { transform: scale(1.12); background: var(--off); animation: recpulse 1.2s ease-in-out infinite; }
.hold.cancel { transform: scale(1); background: var(--line); color: var(--soft); animation: none; }
.hold.sending { opacity: .6; }
.hold:disabled { opacity: .45; }
@keyframes recpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 128, .5); } 50% { box-shadow: 0 0 0 22px rgba(255, 138, 128, 0); } }

.addrow { flex: none; display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid var(--rule); }
.addrow input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: 24px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 17px; outline: none; }
.addrow input:focus { border-color: var(--accent); }
.items { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 6px 0; }
.item { position: relative; overflow: hidden; }
.item .swipe { position: absolute; inset: 0; background: rgba(255, 138, 128, .18); color: var(--off); display: flex; align-items: center; justify-content: flex-end; padding-right: 24px; font-size: 15px; }
.item .row { position: relative; display: flex; align-items: center; background: var(--ground); touch-action: pan-y; transition: transform .18s; }
.item .row.dragging { transition: none; }
.item .toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 4px 8px 18px; border: 0; background: transparent; text-align: left; }
.item .box { flex: none; width: 26px; height: 26px; border-radius: 13px; border: 2px solid var(--chip, #3a3f47); display: flex; align-items: center; justify-content: center; }
.item.done .box { background: var(--live); border-color: var(--live); }
.item .txt { min-width: 0; }
.item .name { display: block; font-size: 18px; overflow-wrap: anywhere; }
.item.done .name { color: var(--dim); text-decoration: line-through; }
.item .by { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; }
.item .del { flex: none; width: 52px; height: 52px; margin-right: 6px; border: 0; border-radius: 26px; background: transparent; color: var(--dim); display: flex; align-items: center; justify-content: center; }
.item .del:active { background: var(--pill); color: var(--off); }
.items .empty { list-style: none; margin-top: 40px; }
.listfoot { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--rule); color: var(--sec); font-size: 14px; }

.tabs { flex: none; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); padding-bottom: var(--safe-bottom); background: var(--ground); }
.tabs button { position: relative; height: 62px; border: 0; background: transparent; color: var(--dim); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 500; }
.tabs button.on { color: var(--accent); }
.badge { position: absolute; top: 8px; left: calc(50% + 10px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--ground); font: 600 12px/20px var(--sans); font-style: normal; text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #23272d; color: var(--text); font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.toast.err { color: var(--off); }
