@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #e7f6ef;
  --bg-deep: #cfe9dc;
  --card: #f7fffb;
  --ink: #1c3a32;
  --muted: #3f675c;
  --line: #b7d4c8;
  --accent: #1f7a63;
  --accent-2: #2b6cb0;
  --warn: #8a3d55;
  --warn-bg: #f4d7e0;
  --btn: #2f8f78;
  --btn-ink: #f4fffa;
  --shadow: 0 16px 40px rgba(28, 58, 50, 0.12);
  --radius: 1.25rem;
  --font: Inter, "Segoe UI", Roboto, sans-serif;
  --display: "Plus Jakarta Sans", Inter, sans-serif;
  --app-width: 28rem;
  --dock: 6.25rem;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, #ffffff 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }

.app {
  min-height: 100%;
  display: flex;
  justify-content: center;
  padding: 0.75rem;
}

.shell {
  width: 100%;
  max-width: var(--app-width);
  min-height: calc(100vh - 1.5rem);
  background: var(--card);
  border: 1px solid rgba(31, 122, 99, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
}

.logo {
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  display: block;
}

.brand { min-width: 0; }
.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}
.tagline {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.log {
  margin: 0 1.15rem 0.5rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #d9efe6;
  color: var(--ink);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.feed {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0.5rem 1.15rem calc(var(--dock) + 0.75rem);
}

.intro {
  text-align: center;
  padding: 2.5rem 0.5rem 1rem;
}
.intro p {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.segment {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.85rem 0.9rem;
  margin: 0 0 0.8rem;
  min-height: 6.5rem;
}
.segment[data-status="empty"] { display: none; }
.segment[data-status="error"] {
  min-height: 0;
  opacity: 0.85;
}
.segment[data-status="error"] .keywords,
.segment[data-status="error"] .excerpt,
.segment[data-status="error"] .transcript,
.segment[data-status="error"] .segment-actions,
.segment[data-status="error"] .illustration {
  display: none;
}

.status { margin: 0 7.5rem 0.15rem 0; font-weight: 600; }
.keywords {
  margin: 0 7.5rem 0.35rem 0;
  font-weight: 600;
  color: var(--accent);
}
.excerpt, .transcript {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.excerpt[hidden], .transcript[hidden] { display: none; }

.illustration {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 6.5rem;
  height: 6.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  overflow: hidden;
  background: #c5ddd3;
  cursor: pointer;
}
.illustration img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.illustration.busy img { filter: blur(4px); }
.illustration:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segment-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.6rem;
}
.icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 0.55rem;
  background: var(--btn);
  color: var(--btn-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { filter: brightness(1.05); }
.icon-btn.ghost {
  background: #e1f0ea;
  color: var(--accent);
}
.icon-btn svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }
.icon-btn[hidden] { display: none; }

.dock {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  background: linear-gradient(180deg, rgba(247,255,251,0) 0%, var(--card) 28%);
  padding: 0.75rem 1rem 1rem;
}
.dock-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.circle {
  width: 3.35rem;
  height: 3.35rem;
  border: 0;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31, 122, 99, 0.28);
}
.circle svg { width: 1.45rem; height: 1.45rem; fill: currentColor; }
.circle:hover { filter: brightness(1.05); }
.circle:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}
.circle[hidden] { display: none; }
.circle:focus-visible, .icon-btn:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

dialog {
  width: min(26rem, calc(100vw - 2rem));
  max-height: min(36rem, calc(100vh - 2rem));
  border: 0;
  border-radius: 1.1rem;
  padding: 0;
  background: #f7fffb;
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: rgba(16, 36, 30, 0.45);
}
.dialog-head, .dialog-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
}
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-foot { border-top: 1px solid var(--line); }
.dialog-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
}
.dialog-body { padding: 1rem; overflow: auto; }

.field {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.9rem;
}
.field:last-child { margin-bottom: 0; }
.field label { color: var(--accent); }
.field svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.field input[type="text"], .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.45rem 0.6rem;
  background: #fff;
}
.field input[type="range"] { width: 100%; accent-color: var(--btn); }
.help-link { color: var(--accent-2); display: inline-flex; }
.help-link svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.range-value { min-width: 2.4rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.field-note {
  margin: -0.2rem 0 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.download-progress {
  margin: 0 1.1rem 0.4rem;
  padding: 0.35rem 0 0;
}
.download-progress progress,
.device-download progress {
  width: 100%;
  height: 0.55rem;
  accent-color: var(--btn);
}
.download-progress p,
.device-status {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}
.device-download {
  margin: 0 0 0.4rem;
}
.device-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.device-download-actions .btn {
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
}
.device-status[data-state="ready"] { color: var(--accent); }
.device-status[data-state="error"],
.device-status[data-state="missing"] { color: var(--warn); }
#deviceStorageUsed { margin: 0.45rem 0 0; }
#downloadConfirm p { margin: 0; }

.btn {
  border: 0;
  border-radius: 0.65rem;
  padding: 0.45rem 0.75rem;
  background: var(--btn);
  color: var(--btn-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
}
.btn svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.btn.secondary { background: #d7ebe3; color: var(--ink); }
.btn.danger { background: var(--warn-bg); color: var(--warn); }
.dialog-foot .btn:first-child { margin-right: auto; }

.summary-art {
  display: block;
  width: 8rem;
  margin: 0 auto 0.9rem;
  border-radius: 0.75rem;
}
.summary .keywords { margin: 0 0 0.75rem; color: var(--accent); }
.summary .excerpts,
.summary .transcripts {
  margin: 0;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 420px) {
  .app { padding: 0; }
  .shell {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
