:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --panel-muted: #eef3f8;
  --text: #111827;
  --muted: #475569;
  --line: #d6dee8;
  --line-strong: #aab7c7;
  --accent: #123a63;
  --accent-strong: #082947;
  --accent-soft: #dbe7f3;
  --success: #116149;
  --success-soft: #dff5ec;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #8a4b0f;
  --warning-bg: #fff7e8;
  --focus: #f59e0b;
  --code-bg: #f9fbfd;
  --shadow-sm: 0 3px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 16px 36px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.78;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 40;
  transform: translateY(-140%);
  border-radius: 8px;
  background: var(--accent-strong);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.16s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #f8fafc;
  padding: 24px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: var(--shadow-sm);
}

.brand h1,
.brand p,
.content-header h2,
.content-header p,
.nav-title,
.file-title,
.prompt-title,
.modal h2,
.modal p {
  margin: 0;
}

.brand h1 {
  font-size: 1.18rem;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent-strong);
  padding: 0 13px;
  font-weight: 900;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.nav-toggle:hover,
.nav-toggle.is-open {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.nav-toggle-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-muted);
  transition: transform 0.18s ease;
}

.nav-toggle.is-open .nav-toggle-icon {
  transform: rotate(45deg);
}

.nav-panel {
  display: grid;
}

.search-label,
.nav-title {
  display: block;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.search-label {
  margin-bottom: 8px;
}

.search-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 13px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.search-input::placeholder {
  color: #64748b;
}

.search-input:hover {
  border-color: var(--accent);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.nav-title {
  margin-top: 24px;
  margin-bottom: 10px;
}

.sessions-nav {
  display: grid;
  gap: 8px;
}

.session-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.session-button:hover {
  border-color: var(--line-strong);
  background: #edf2f8;
}

.session-button.is-active {
  border-color: #b9c7d7;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.session-button:active {
  transform: translateY(1px);
}

.session-button strong {
  min-width: 0;
  font-size: 0.93rem;
  line-height: 1.25;
}

.session-count {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: #334155;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.content {
  width: 100%;
  min-width: 0;
  padding: 32px 42px 64px;
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content-header h2 {
  margin-top: 6px;
  max-width: 1100px;
  font-size: 2.18rem;
  line-height: 1.12;
  letter-spacing: 0;
}

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

.summary span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: #334155;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.course-content,
.session-section,
.prompt-list,
.file-panel {
  display: grid;
  gap: 18px;
}

.session-section {
  gap: 20px;
}

.file-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.file-group.is-open {
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.file-header {
  margin: 0;
}

.file-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 68px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 16px 18px;
  text-align: left;
  transition: background 0.16s ease;
}

.file-toggle:hover {
  background: var(--panel-soft);
}

.file-title-wrap {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.file-title {
  color: #111827;
  font-size: 1.16rem;
  font-weight: 900;
  line-height: 1.25;
}

.file-meta {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.file-toggle-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.file-toggle[aria-expanded="true"] .file-toggle-icon {
  transform: none;
  border-color: #c1ccd8;
  background: var(--accent-soft);
}

.file-panel {
  padding: 0 18px 18px;
  animation: panelIn 0.18s ease;
}

.file-panel[hidden] {
  display: none;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
  padding: 14px;
}


.auxiliary-list {
  display: grid;
  gap: 10px;
}

.auxiliary-block {
  display: grid;
  gap: 8px;
  border: 1px solid #d8c9a4;
  border-radius: 8px;
  background: #fffaf0;
  padding: 13px 14px;
}

.auxiliary-title {
  margin: 0;
  color: #6f420f;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auxiliary-text {
  color: #2f2414;
}
.prompt-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.prompt-card:hover,
.prompt-card:focus-within {
  border-color: #bdc9d8;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-heading {
  min-width: 0;
}

.prompt-title {
  color: #0f172a;
  font-size: 1.03rem;
  line-height: 1.35;
}

.prompt-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.copy-button,
.primary-button,
.secondary-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.copy-button,
.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 900;
}

.copy-button:hover,
.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(8, 41, 71, 0.22);
}

.copy-button.is-copied,
.primary-button.is-copied {
  border-color: var(--success);
  background: var(--success);
}

.copy-button.is-error,
.primary-button.is-error {
  border-color: var(--danger);
  background: var(--danger);
}

.copy-button:active,
.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.secondary-button,
.icon-button {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: 0 15px;
  font-weight: 900;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.6;
}

.prompt-text {
  max-height: 640px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-bg);
  color: #111827;
  padding: 16px;
}

.empty-state {
  margin: 28px 0 0;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 18px;
  font-size: 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.62);
  padding: 18px;
  animation: fadeIn 0.16s ease;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(640px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
  animation: modalIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.modal-header h2 {
  margin-top: 4px;
  font-size: 1.35rem;
  line-height: 1.2;
}

.placeholder-fields {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field input:hover {
  border-color: var(--accent);
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fffafa;
}

.modal-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.form-error,
.field-error {
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 800;
}

.form-error {
  border: 1px solid #f5b5b0;
  border-radius: 8px;
  background: var(--danger-soft);
  padding: 10px 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.badge.has-placeholders {
  border-color: #efcf9c;
  background: var(--warning-bg);
  color: var(--warning);
}

@media (min-width: 1500px) {
  .app-shell {
    grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  }

  .content {
    padding-left: 56px;
    padding-right: 56px;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .content {
    padding-left: 24px;
    padding-right: 24px;
  }

  .content-header h2 {
    font-size: 1.9rem;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 14px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-panel {
    display: none;
    padding-top: 14px;
  }

  .nav-panel.is-open {
    display: grid;
    animation: panelIn 0.18s ease;
  }

  .sessions-nav {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .content-header,
  .prompt-header {
    align-items: stretch;
    flex-direction: column;
  }

  .content-header h2 {
    font-size: 1.68rem;
  }

  .summary,
  .prompt-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .content {
    padding: 20px 12px 42px;
  }

  .sidebar {
    padding: 18px 12px;
  }

  .sessions-nav {
    grid-template-columns: 1fr;
  }

  .session-button {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .file-toggle,
  .prompt-card,
  .intro-block,
  .content-header,
  .file-panel {
    padding-left: 14px;
    padding-right: 14px;
  }

  .prompt-card,
  .intro-block,
  .content-header {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .prompt-actions {
    width: 100%;
  }

  .copy-button {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}