:root {
  color-scheme: dark;
  --ink: #f7f5ff;
  --muted: #aaa4ba;
  --line: rgba(255, 255, 255, 0.12);
  --panel: rgba(22, 20, 29, 0.76);
  --panel-strong: rgba(30, 27, 39, 0.9);
  --page: #08080b;
  --brand: #ff3fd4;
  --brand-2: #7f5cff;
  --brand-3: #40e2ff;
  --soft: rgba(255, 63, 212, 0.14);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(127, 92, 255, 0.28), transparent 35%),
    radial-gradient(circle at 88% 10%, rgba(255, 63, 212, 0.28), transparent 34%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    var(--page);
  background-size: auto, auto, 72px 72px, 72px 72px, auto;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 63, 212, 0.35) 1px, transparent 1.5px);
  background-position: 0 0, 34px 46px;
  background-size: 140px 140px, 180px 180px;
  opacity: 0.18;
}

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

input[type="url"],
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  outline: none;
}

input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 63, 212, 0.65);
  box-shadow: 0 0 0 4px rgba(255, 63, 212, 0.1);
}

input[type="url"],
select {
  min-height: 42px;
  padding: 0 12px;
}

select {
  color: var(--ink);
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  min-height: 76px;
  margin: 24px auto 0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 10, 14, 0.78);
  position: sticky;
  top: 16px;
  z-index: 5;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 1.15rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 28px rgba(255, 63, 212, 0.42);
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vw, 34px);
  font-size: 0.82rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero-copy {
  width: min(980px, calc(100% - 32px));
  margin: 54px auto 30px;
  text-align: center;
}

.hero-copy h1 {
  max-width: 920px;
  margin: 18px auto 14px;
  font-size: clamp(2.35rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  max-width: 650px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.7;
}

.hero-badge {
  width: fit-content;
  margin: 0 auto;
  padding: 8px 14px;
  border: 1px solid rgba(255, 63, 212, 0.45);
  border-radius: 999px;
  background: rgba(255, 63, 212, 0.08);
  color: var(--ink);
  box-shadow: 0 0 28px rgba(255, 63, 212, 0.22);
  font-size: 0.8rem;
  font-weight: 800;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.15;
}

h3 {
  font-size: 0.98rem;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 7px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(340px, 0.82fr);
  gap: 18px;
}

.workspace {
  display: grid;
  grid-template-rows: minmax(430px, 1.1fr) minmax(310px, 0.9fr);
  gap: 18px;
}

.panel,
.output-section {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel::before,
.output-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 63, 212, 0.16), transparent 28%, rgba(64, 226, 255, 0.08));
  opacity: 0.75;
}

.panel > *,
.output-section > * {
  position: relative;
  z-index: 1;
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.record-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button,
.file-control {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  box-shadow: 0 0 30px rgba(255, 63, 212, 0.38);
}

.primary:hover {
  filter: brightness(1.08);
}

.ghost,
.icon-button,
.file-control {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--ink);
}

.ghost:hover,
.icon-button:hover,
.file-control:hover {
  border-color: rgba(255, 63, 212, 0.55);
}

.wide {
  width: 100%;
  margin: 14px 0 10px;
}

.status {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin-bottom: 10px;
}

.backend-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px auto auto;
  gap: 8px;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  padding: 14px;
  line-height: 1.65;
}

textarea::placeholder,
input::placeholder {
  color: rgba(247, 245, 255, 0.44);
}

.recorder textarea {
  min-height: 340px;
}

.references textarea {
  min-height: 190px;
}

.file-control input {
  display: none;
}

.file-list {
  min-height: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.file-pill {
  max-width: 100%;
  padding: 6px 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 63, 212, 0.28);
  border-radius: 999px;
  background: var(--soft);
  color: #ffd6f7;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  font-weight: 800;
}

.study-pack {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-width: 0;
}

.output {
  display: grid;
  gap: 14px;
}

.output-section {
  min-width: 0;
  padding: 16px;
}

.output-section h3 {
  margin-bottom: 10px;
}

ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin: 8px 0;
  color: #d8d2e6;
  line-height: 1.5;
}

.lesson-notes {
  display: grid;
  gap: 12px;
}

.note-block {
  border-left: 3px solid var(--brand);
  padding-left: 10px;
  color: #d8d2e6;
  line-height: 1.55;
}

.muted {
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .record-actions,
  .backend-row,
  button,
  .file-control {
    width: 100%;
  }

  .backend-row {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    margin-top: 36px;
  }

  .hero-copy h1 {
    font-size: 2.4rem;
  }
}

@media print {
  body {
    background: white;
    color: #111;
  }

  .topbar,
  .hero-copy,
  .workspace,
  .generate-panel {
    display: none;
  }

  .app-shell {
    display: block;
    width: 100%;
    margin: 0;
  }

  .study-pack {
    display: block;
  }

  .output-section {
    box-shadow: none;
    page-break-inside: avoid;
    margin-bottom: 14px;
    color: #111;
  }
}
