/* Dark charcoal tiles, orange accents and a glowing status ring. */
:root {
  --bg: #0c0c0e;
  --bg-2: #141417;
  --surface: #17171b;
  --surface-2: #202026;
  --surface-3: #2a2a31;
  --text: #f3f3f5;
  --muted: #9a9aa4;
  --border: #2b2b32;
  --accent: #ff7a1a;
  --accent-2: #ffb15c;
  --accent-ink: #1a0d02;
  --accent-soft: rgba(255, 122, 26, .14);
  --glow: 0 0 24px rgba(255, 122, 26, .45);
  --ok: #4fd18b;
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, .14);
  --danger: #ff5a4f;
  --danger-soft: rgba(255, 90, 79, .14);
  --info-soft: rgba(255, 255, 255, .05);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #1d1612 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(255, 122, 26, .35); }

/* ---------- controls */
button, .btn {
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: .45rem 1.05rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .05s;
}
button:hover:not(:disabled), .btn:hover { border-color: #45454f; background: var(--surface-3); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 18px rgba(255, 122, 26, .25); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #ffc27a, #ff8a33); border-color: transparent; box-shadow: var(--glow); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { min-height: 34px; padding: .25rem .8rem; font-size: .85rem; }
.icon-btn { min-height: 32px; width: 32px; padding: 0; background: transparent; border-color: transparent; color: var(--muted); border-radius: 10px; }
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); border-color: transparent; }

input[type=text], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .8rem; width: 100%;
}
input::placeholder, textarea::placeholder { color: #6b6b75; }
textarea { resize: vertical; min-height: 5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly], textarea[readonly] { background: transparent; }
label { font-weight: 600; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.check { display: flex; gap: .65rem; align-items: flex-start; font-weight: 500; font-size: .95rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }

.card {
  background: linear-gradient(180deg, var(--surface) 0%, #141418 100%);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .03);
}
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--surface-3); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pill.live { background: var(--danger-soft); color: var(--danger); }
.pill.shared { background: var(--accent-soft); color: var(--accent-2); }

.banner { border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .9rem; margin-bottom: .75rem; border: 1px solid transparent; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(255, 181, 71, .3); }
.banner.err { background: var(--danger-soft); color: var(--danger); }
.banner.ok { background: rgba(79, 209, 139, .12); color: var(--ok); }
.banner.info { background: var(--accent-soft); color: var(--text); border-color: rgba(255, 122, 26, .3); }

/* ---------- app shell */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1rem; background: rgba(12, 12, 14, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); min-height: 60px;
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--accent); text-decoration: none; white-space: nowrap;
  font-weight: 800; letter-spacing: .18em; text-transform: uppercase; font-size: .95rem; text-shadow: 0 0 18px rgba(255, 122, 26, .35); }
.brand img { width: 30px; height: 30px; }
.topbar .search { max-width: 420px; flex: 1; border-radius: 999px; padding-left: 1rem; }

.shell { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 60px); }
.sidebar { border-right: 1px solid var(--border); background: rgba(16, 16, 19, .9); padding: 1rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; max-height: calc(100vh - 60px); position: sticky; top: 60px; }
.main { padding: 1.4rem; min-width: 0; }
.main-inner { max-width: 940px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.side-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .4rem; }

.filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter { font-size: .8rem; min-height: 28px; padding: .1rem .7rem; }
.filter[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.note-list a { display: block; padding: .7rem .85rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.note-list a:hover { border-color: #45454f; }
.note-list a[aria-current=page] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent), 0 0 18px rgba(255, 122, 26, .12); }
.note-list .t { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-list .m { font-size: .78rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h2 { color: var(--text); }

/* ---------- capture panel with the status ring */
.capture { padding: 1.4rem 1.2rem; overflow: hidden; position: relative; }
.capture.is-live { border-color: rgba(255, 122, 26, .55); }
.ring-stage { display: grid; place-items: center; padding: .5rem 0 .25rem; }
.ring {
  --level: 0;
  --ring: #3a3a43;
  position: relative; width: min(300px, 78vw); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 50%, #1b1b20 0 56%, transparent 56.5%),
    conic-gradient(from 210deg, var(--ring) 0turn, var(--ring) .78turn, rgba(255,255,255,.04) .78turn);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04), 0 0 0 14px rgba(255, 255, 255, .02), 0 0 0 30px rgba(255, 255, 255, .015);
  transition: box-shadow .3s;
}
.ring-glow { position: absolute; inset: -6%; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle, transparent 58%, rgba(255, 122, 26, calc(.18 + var(--level) * .5)) 66%, transparent 74%); }
.ring-core { position: relative; text-align: center; padding: 0 16%; display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.ring-label { font-size: clamp(1.15rem, 4.6vw, 1.6rem); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.ring-sub { font-size: .82rem; color: var(--muted); max-width: 22ch; min-height: 1.2em; }
.ring-dots { display: flex; gap: .4rem; align-items: center; height: 14px; }
.ring-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .6; }

.ring[data-state=connecting], .ring[data-state=finishing] { --ring: #6b4a2c; }
.ring[data-state=connecting] .ring-dots i, .ring[data-state=finishing] .ring-dots i { background: var(--accent-2); animation: blink 1.2s infinite; }
.ring-dots i:nth-child(2) { animation-delay: .2s !important; width: 11px; height: 11px; }
.ring-dots i:nth-child(3) { animation-delay: .4s !important; }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.ring[data-state=listening] {
  background:
    radial-gradient(circle at 50% 50%, #1b1b20 0 56%, transparent 56.5%),
    conic-gradient(from 0deg, #ff5a1a, var(--accent-2), #ff5a1a, #ff8a33, #ff5a1a);
  animation: spin 6s linear infinite;
  box-shadow: 0 0 calc(20px + var(--level) * 50px) rgba(255, 122, 26, .45), 0 0 0 14px rgba(255, 122, 26, .05), 0 0 0 30px rgba(255, 122, 26, .03);
}
.ring[data-state=listening] .ring-core { animation: spin 6s linear infinite reverse; }
.ring[data-state=listening] .ring-glow { opacity: 1; }
.ring[data-state=listening] .ring-label { color: var(--accent); text-shadow: 0 0 18px rgba(255, 122, 26, .55); }
.ring[data-state=listening] .ring-dots i { background: var(--accent); opacity: calc(.4 + var(--level)); transform: scale(calc(1 + var(--level) * .8)); }
.ring[data-state=silent] { --ring: #8a6a2a; }
.ring[data-state=silent] .ring-label { color: var(--warn); }
.ring[data-state=paused] { --ring: #6e5a32; }
.ring[data-state=paused] .ring-label { color: var(--warn); }
.ring[data-state=paused] .ring-dots i { background: var(--warn); }
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .ring[data-state=listening], .ring[data-state=listening] .ring-core, .ring-dots i { animation: none !important; }
}

.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: 1.1rem; }
.controls button { min-height: 56px; font-size: 1.05rem; letter-spacing: .04em; }
.btn-start { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 8px 22px rgba(255, 122, 26, .3); }
.btn-start:hover:not(:disabled) { background: linear-gradient(135deg, #ffc27a, #ff8a33); box-shadow: var(--glow); border-color: transparent; }
.btn-pause { background: var(--surface-2); border-color: rgba(255, 181, 71, .45); color: var(--warn); }
.btn-stop { background: var(--surface-2); border-color: rgba(255, 90, 79, .5); color: var(--danger); }
.btn-stop:hover:not(:disabled) { background: var(--danger-soft); }

.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.source-opts { display: flex; flex-direction: column; gap: .45rem; }
.source-opts legend { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.source-opts > label { display: flex; gap: .6rem; align-items: flex-start; font-weight: 600; font-size: .95rem; color: var(--text); text-transform: none; letter-spacing: 0;
  padding: .65rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-2); }
.source-opts > label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.source-opts input { margin-top: 4px; accent-color: var(--accent); }
.source-opts small { display: block; color: var(--muted); font-weight: 400; font-size: .82rem; }
.source-opts > label.check { background: transparent; }
.notice-box { background: var(--bg-2); border: 1px dashed #3a3a43; border-radius: var(--radius-sm); padding: .75rem; font-size: .9rem; }
.panel-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-bottom: .35rem; }

.captions { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .65rem .85rem; max-height: 9.5rem; overflow-y: auto; font-size: .92rem; margin-top: 1rem; }
.captions .interim { color: var(--muted); }

/* ---------- note editor */
.title-input { font-size: 1.55rem; font-weight: 700; border-color: transparent; padding: .3rem .4rem; background: transparent; }
.title-input:hover { border-color: var(--border); }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.section h2 { font-size: .8rem; display: flex; align-items: center; gap: .5rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-2); }
.section h2::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.section h2 .count { font-size: .75rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.items { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.item { display: flex; gap: .4rem; align-items: flex-start; }
.item textarea { min-height: 2.5rem; padding: .45rem .7rem; resize: none; overflow: hidden; }
.item .owner { width: 8.5rem; flex: none; }
.item .done { width: 20px; height: 20px; margin-top: .6rem; flex: none; accent-color: var(--accent); }
.item.is-done textarea { text-decoration: line-through; color: var(--muted); }
.item-tools { display: flex; flex: none; }
.save-state { font-size: .8rem; color: var(--muted); }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
dialog .dlg-body { padding: 1.4rem; overflow-y: auto; max-height: calc(100vh - 140px); }
dialog .dlg-foot { padding: .85rem 1.4rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }
dialog h3 { margin-top: 1.1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); }
dialog ol, dialog ul { padding-left: 1.25rem; }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 16px 40px rgba(0,0,0,.5); min-width: 220px; padding: .35rem; z-index: 30; display: flex; flex-direction: column; }
.menu-list button, .menu-list a { justify-content: flex-start; border: 0; background: transparent; font-weight: 500; width: 100%; border-radius: 8px; }
.menu-list button:hover, .menu-list a:hover { background: var(--surface-3); }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--surface-3); color: var(--text); border: 1px solid #45454f; padding: .65rem 1.1rem; border-radius: 999px; font-size: .9rem; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* ---------- public pages */
.public { max-width: 1000px; margin: 0 auto; padding: 1rem 16px 3rem; }
.hero { padding: 3rem 0 2.2rem; display: grid; gap: 1.2rem; grid-template-columns: 1.2fr .8fr; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); max-width: 16ch; }
.hero h1 em { font-style: normal; color: var(--accent); text-shadow: 0 0 24px rgba(255, 122, 26, .4); }
.hero p { font-size: 1.08rem; color: var(--muted); max-width: 56ch; }
.hero .ring { width: min(260px, 70vw); justify-self: center; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem; }
.features h3 { font-size: 1rem; }
.features .icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.1rem; margin-bottom: .7rem; box-shadow: 0 0 16px rgba(255, 122, 26, .15); }
.public-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; }
.public h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-2); margin-bottom: .8rem; }
.footer { margin-top: 3rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 1rem; }
.shared-note h1 { font-size: 1.6rem; }
.shared-note h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-2); margin-top: 1.4rem; }
.shared-note ul { padding-left: 1.2rem; }

/* ---------- print (Export → Print or save as PDF) */
.print-only { display: none; }
@media print {
  body { background: #fff !important; color: #000; }
  body.app > *:not(.print-only), .no-print { display: none !important; }
  .print-only { display: block !important; padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; background: none; }
  .muted { color: #555; }
  .shared-note h2 { color: #000; }
}

/* ---------- responsive */
.only-mobile { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 60px 0 0 0; max-height: none; z-index: 15; transform: translateX(-100%); transition: transform .2s; border-right: 0; background: var(--bg); }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .main { padding: 1rem 16px; }
  .setup-grid, .meta-grid, .section-grid, .hero { grid-template-columns: 1fr; }
  .topbar .search { display: none; }
  .sidebar .mobile-search { display: block !important; }
  .hero .ring { order: -1; width: min(200px, 60vw); }
}
@media (max-width: 520px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .controls .btn-start { grid-column: 1 / -1; }
  .item { flex-wrap: wrap; }
  .item .owner { width: calc(100% - 4.5rem); margin-left: 1.8rem; }
  .brand span { display: none; }
  .topbar { gap: .4rem; }
  #helpBtn { padding: .25rem .5rem; }
}
