:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071018;
  color: #f5f7f8;
  --surface: #101c25;
  --surface-strong: #172733;
  --muted: #91a0aa;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #65e6ad;
  --accent-ink: #062116;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 85% -5%, rgba(62, 162, 126, 0.22), transparent 32%),
    #071018;
}

button, input, select { font: inherit; }

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(110px + var(--safe-bottom));
}

.topbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar { margin-bottom: 24px; }

.eyebrow,
.hero-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, p { text-wrap: balance; }
h1 { margin: 0; font-size: clamp(1.35rem, 6vw, 2rem); }
h2 { margin: 0; font-size: clamp(1.4rem, 7vw, 2.3rem); line-height: 1.08; }
h3 { margin: 0 0 8px; font-size: 1.08rem; }

.avatar {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(101, 230, 173, 0.35);
  border-radius: 50%;
  background: rgba(101, 230, 173, 0.12);
  color: var(--accent);
  font-weight: 900;
}

.hero {
  overflow: hidden;
  position: relative;
  padding: 26px 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(145deg, #183c35, #112029 68%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.hero::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -68px;
  width: 180px;
  height: 180px;
  border: 34px solid rgba(101, 230, 173, 0.09);
  border-radius: 50%;
}

.hero p:not(.hero-label) {
  max-width: 33rem;
  margin: 14px 0 22px;
  color: #c7d2d7;
  line-height: 1.5;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
  cursor: pointer;
}

.record-action {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
}
.record-dot { width: 13px; height: 13px; border-radius: 50%; background: #e43d51; box-shadow: 0 0 0 5px rgba(228,61,81,.16); }
#record-preview { position: relative; z-index: 1; width: 100%; margin: 12px 0; }
.muted { color: var(--muted); line-height: 1.45; }

.content { padding: 30px 2px 0; }
.app-view[hidden] { display: none; }
.section-heading { margin-bottom: 16px; }
.section-heading h2 { font-size: 1.35rem; }
.section-copy {
  margin: -4px 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.template-grid {
  display: grid;
  gap: 12px;
}

.template-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: linear-gradient(145deg, var(--surface-strong), var(--surface));
}

.template-card h3 { margin: 1px 0 5px; }
.template-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.template-emoji {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: rgba(101, 230, 173, 0.1);
  font-size: 1.35rem;
}

.field { display: grid; gap: 7px; color: var(--muted); font-size: .84rem; font-weight: 700; }
.field.compact { position: relative; z-index: 1; margin-bottom: 12px; }
.field input, .field select, .inline-form input {
  width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line);
  border-radius: 13px; background: #0b161e; color: #f5f7f8;
}
.field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; resize: vertical; background: rgba(255,255,255,.04); color: var(--text); box-sizing: border-box; font: inherit; }
.settings-card { display: grid; gap: 16px; margin-bottom: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.settings-card p { margin: 6px 0 0; }
.plan-list { display: grid; gap: 9px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.plan-row span { display: grid; gap: 3px; }
.plan-row small, .plan-disclaimer { color: var(--muted); font-size: .76rem; }
.plan-row b { max-width: 48%; color: #eaf4ef; font-size: .82rem; text-align: right; }
.plan-row.featured { border-color: rgba(101,230,173,.4); background: rgba(101,230,173,.07); }
.plan-row.featured strong { color: var(--accent); }
.plan-disclaimer { margin-top: 0 !important; }
.secondary-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid rgba(101,230,173,.35); border-radius: 13px; color: var(--accent); text-decoration: none; font-weight: 800; }
.file-action { width: 100%; cursor: pointer; box-sizing: border-box; }
.audio-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.audio-divider::before, .audio-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.folder-toolbar { display: grid; gap: 12px; margin-bottom: 18px; }
.folder-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 3px; }
.folder-chip { flex: 0 0 auto; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: #e8eef1; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.inline-form button { border: 0; border-radius: 13px; padding: 0 14px; background: var(--surface-strong); color: var(--accent); font-weight: 800; }
.card-list { display: grid; gap: 11px; }
.note-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.note-card h3 { margin: 0 0 6px; }
.note-card p { margin: 0; }
.note-preview { display: -webkit-box; overflow: hidden; color: var(--muted); line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.count { color: var(--accent); font-size: .78rem; white-space: nowrap; }

.empty-state,
.notice {
  padding: 26px 20px;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background: rgba(16, 28, 37, 0.7);
  text-align: center;
}

.empty-state p,
.notice {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-strong);
  color: var(--accent);
  font-size: 1.35rem;
}

.notice { border-style: solid; border-color: rgba(255, 145, 145, 0.25); }

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 9px 8px calc(9px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.93);
  backdrop-filter: blur(20px);
}

.nav-item {
  display: grid;
  gap: 5px;
  min-height: 58px;
  place-content: center;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 750;
}

.nav-item span:first-child { font-size: 1.15rem; }
.nav-item.is-active { background: rgba(101, 230, 173, 0.1); color: var(--accent); }
.nav-item:disabled { opacity: 0.6; }

@media (min-width: 640px) {
  .app-shell { padding-inline: 28px; }
  .bottom-nav {
    right: max(0px, calc((100vw - 720px) / 2));
    left: max(0px, calc((100vw - 720px) / 2));
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero { animation: enter 340ms ease-out both; }
  @keyframes enter {
    from { opacity: 0; transform: translateY(8px); }
  }
}
