:root {
  --bg: #0f0a19;
  --bg-accent: #1b122c;
  --surface: rgba(22, 16, 36, 0.82);
  --surface-strong: rgba(26, 18, 42, 0.96);
  --surface-soft: rgba(36, 25, 58, 0.76);
  --text: #f3eeff;
  --muted: #b6acd2;
  --line: rgba(183, 153, 238, 0.16);
  --primary: #af95ec;
  --primary-deep: #8c6ddd;
  --secondary: #d3c0ff;
  --secondary-deep: #b99cf2;
  --bot-bubble: rgba(44, 31, 71, 0.88);
  --user-bubble: linear-gradient(135deg, #ae94ef, #7d5fd1);
  --shadow: 0 28px 80px rgba(5, 2, 14, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(186, 155, 247, 0.18), transparent 24%),
    radial-gradient(circle at 80% 20%, rgba(145, 116, 221, 0.14), transparent 26%),
    radial-gradient(circle at bottom right, rgba(103, 79, 165, 0.18), transparent 28%),
    linear-gradient(145deg, #0b0813, var(--bg) 38%, var(--bg-accent) 76%, #0d0917);
}

body {
  padding: 24px;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar,
.app-card {
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 28px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(36, 24, 58, 0.96), rgba(24, 17, 41, 0.96) 52%, rgba(16, 11, 28, 0.98));
  color: #fcfbff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(209, 188, 255, 0.18);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #a788e3;
}

.eyebrow,
.panel-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 700;
}

.sidebar h1,
.hero h2 {
  font-family: "Space Grotesk", sans-serif;
  margin: 4px 0 0;
  line-height: 1;
}

.sidebar h1 {
  font-size: 2rem;
}

.sidebar-copy,
.panel-copy {
  color: rgba(238, 233, 250, 0.78);
  line-height: 1.45;
}

.panel {
  margin-top: 24px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(213, 191, 255, 0.1);
}

.topic-list {
  margin: 12px 0 0;
  padding-left: 18px;
  line-height: 1.8;
}

.app-card {
  display: grid;
  grid-template-rows: auto auto minmax(420px, 1fr);
  min-height: calc(100vh - 48px);
  border-radius: 32px;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(175, 149, 236, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(24, 17, 39, 0.9), rgba(16, 11, 27, 0.94));
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}

.hero h2 {
  max-width: 720px;
  font-size: clamp(2rem, 4vw, 3.9rem);
  line-height: 0.95;
}

.hero-badge {
  align-self: start;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(183, 153, 238, 0.08);
  border: 1px solid rgba(183, 153, 238, 0.18);
  color: #e8ddff;
  font-weight: 700;
  white-space: nowrap;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.lesson-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.lesson-card {
  display: grid;
  gap: 6px;
  min-height: 122px;
  padding: 16px 16px 15px;
  border: 1px solid rgba(183, 153, 238, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(28, 20, 46, 0.74), rgba(20, 15, 33, 0.88));
  text-align: left;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.lesson-card:hover,
.lesson-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(183, 153, 238, 0.18);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.18);
  outline: none;
}

.lesson-card span {
  color: var(--muted);
}

.lesson-card strong {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.lesson-card span:last-child {
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(228, 220, 245, 0.72);
}

.lesson-kicker {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(214, 196, 250, 0.58);
}

.config-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  margin-bottom: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(24, 17, 39, 0.78);
}

.config-text,
.api-status {
  margin: 6px 0 0;
  color: var(--muted);
}

.premium-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  margin-bottom: 20px;
  border-radius: 28px;
  border: 1px solid rgba(183, 153, 238, 0.18);
  background:
    radial-gradient(circle at top right, rgba(173, 147, 235, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(27, 19, 45, 0.94), rgba(18, 12, 31, 0.96));
}

.premium-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.premium-header h3,
.tool-workspace-header h4 {
  margin: 6px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.premium-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a98bed, #7b5fd0);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.premium-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.premium-card {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid rgba(183, 153, 238, 0.18);
  border-radius: 24px;
  background: rgba(37, 26, 60, 0.78);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.premium-card:hover,
.premium-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(183, 153, 238, 0.32);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
  outline: none;
}

.premium-card span {
  color: var(--muted);
}

.premium-tag {
  background: rgba(183, 153, 238, 0.14);
  color: #eadfff;
}

.tool-workspace {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(183, 153, 238, 0.14);
  background: rgba(20, 14, 33, 0.8);
}

.tool-workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.tool-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tool-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.tool-form input {
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(183, 153, 238, 0.16);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  color: var(--text);
}

.tool-submit {
  grid-column: 1 / -1;
  border: none;
  border-radius: 18px;
  min-height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tool-result {
  padding: 18px;
  border-radius: 20px;
  background: rgba(42, 30, 67, 0.86);
  border: 1px solid rgba(183, 153, 238, 0.16);
  white-space: pre-wrap;
  line-height: 1.55;
}

.hidden {
  display: none;
}

.starter {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(33, 24, 53, 0.86), rgba(22, 16, 36, 0.9));
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.starter:hover,
.starter:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(183, 153, 238, 0.28);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
  outline: none;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(16, 11, 28, 0.78);
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(21, 15, 35, 0.94);
}

.chat-hint {
  margin: 0;
  color: var(--muted);
}

.toolbar-button {
  border: 1px solid rgba(183, 153, 238, 0.16);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.chat-log {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: min(720px, 88%);
  padding: 16px 18px;
  border-radius: 22px;
  line-height: 1.5;
  animation: rise 220ms ease;
}

.message.bot {
  background: var(--bot-bubble);
  border-top-left-radius: 8px;
  border: 1px solid rgba(183, 153, 238, 0.1);
}

.message.user {
  margin-left: auto;
  background: var(--user-bubble);
  color: #fff;
  border-top-right-radius: 8px;
  box-shadow: 0 16px 34px rgba(76, 49, 138, 0.28);
}

.message-heading {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.message-paragraph {
  margin: 0;
}

.message-paragraph + .message-paragraph {
  margin-top: 10px;
}

.message-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.message-list-clean {
  padding-left: 0;
  list-style: none;
}

.message-label {
  font-weight: 700;
  color: #ddd0ff;
}

.tool-result .message-heading {
  color: #efe7ff;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
}

.composer textarea {
  resize: none;
  max-height: 180px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(183, 153, 238, 0.16);
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.composer textarea:focus,
.composer button:focus-visible {
  outline: 2px solid rgba(124, 92, 196, 0.22);
  outline-offset: 2px;
}

.composer button {
  border: none;
  border-radius: 18px;
  min-width: 104px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

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

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

  .starter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-strip {
    grid-template-columns: 1fr;
  }

  .premium-grid,
  .tool-form {
    grid-template-columns: 1fr;
  }

  .app-card {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  body {
    padding: 14px;
  }

  .sidebar,
  .app-card {
    border-radius: 24px;
    padding: 20px;
  }

  .hero {
    flex-direction: column;
    align-items: start;
  }

  .starter-grid {
    grid-template-columns: 1fr;
  }

  .chat-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .premium-header,
  .tool-workspace-header {
    flex-direction: column;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer button {
    min-height: 50px;
  }

  .message {
    max-width: 100%;
  }
}
