:root {
  color-scheme: light;
  --ink: #2c1018;
  --muted: #7e665e;
  --line: rgba(74, 31, 46, 0.14);
  --paper: #fdf6f0;
  --panel: #ffffff;
  --burgundy: #4a1f2e;
  --burgundy-deep: #2c1018;
  --rose: #bb818b;
  --rose-soft: #ead1d6;
  --gold: #c4a35a;
  --gold-light: #d8be76;
  --blue: #2d5f7c;
  --red: #9a312c;
  --soft: #fbefe6;
  --green: var(--burgundy);
  --green-dark: var(--burgundy-deep);
  --shadow: 0 18px 44px rgba(74, 31, 46, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.76), rgba(253,246,240,1) 340px),
    radial-gradient(circle at 18% 0%, rgba(187, 129, 139, 0.18), transparent 360px),
    radial-gradient(circle at 88% 12%, rgba(196, 163, 90, 0.14), transparent 420px),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 7px;
  padding: 11px 15px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 7px 18px rgba(74, 31, 46, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(74, 31, 46, 0.24);
}

button.secondary {
  background: #f4e7dc;
  color: var(--ink);
  box-shadow: none;
}

button.warning {
  background: var(--gold);
}

a.navlink {
  display: inline-flex;
  align-items: center;
  border-radius: 7px;
  padding: 11px 15px;
  font-weight: 700;
  text-decoration: none;
  background: #f4e7dc;
  color: var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

a.navlink:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(74, 31, 46, 0.24);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.mini {
  width: fit-content;
  padding: 6px 9px;
  font-size: 12px;
  border-radius: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px 13px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.55;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(44, 16, 24, 0.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar .muted {
  color: rgba(253, 246, 240, 0.72);
}

.topbar .badge {
  background: rgba(253, 246, 240, 0.12);
  color: #fffaf6;
  border: 1px solid rgba(196, 163, 90, 0.24);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  color: #fffaf6;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  color: white;
  letter-spacing: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
}

.brand-logo.large {
  width: 70px;
  height: 70px;
  border-radius: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 350px;
  min-height: 0;
}

.sidebar,
.bot {
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 246, 0.90);
  padding: 20px;
}

.bot {
  border-right: 0;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bot-head {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffaf6, #f7ebe1);
  border: 1px solid rgba(74, 31, 46, 0.10);
}

.bot-head img {
  width: 64px;
  height: 58px;
  object-fit: contain;
}

.bot-head h3,
.bot-head p {
  margin: 0;
}

.main {
  padding: 28px;
  overflow: auto;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(44, 16, 24, 0.90), rgba(253, 246, 240, 0.88)),
    url("https://images.unsplash.com/photo-1503676260728-1c00da094a0b?auto=format&fit=crop&w=1800&q=75");
  background-size: cover;
  background-position: center;
}

.login-panel {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.login-copy,
.login-form {
  padding: 38px;
}

.login-copy {
  background:
    linear-gradient(180deg, rgba(74, 31, 46, 0.96), rgba(44, 16, 24, 0.98));
  color: white;
}

.login-copy h1 {
  font-size: 38px;
  line-height: 1.06;
  margin: 42px 0 16px;
}

.login-copy p {
  color: #d8e5de;
  font-size: 17px;
  line-height: 1.58;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.tabs button {
  flex: 1;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 0 rgba(74, 31, 46, 0.04), 0 12px 28px rgba(74, 31, 46, 0.07);
}

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

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

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(74, 31, 46, 0.96), rgba(44, 16, 24, 0.92)),
    url("https://images.unsplash.com/photo-1497633762265-9d179a990aa6?auto=format&fit=crop&w=1400&q=75");
  background-size: cover;
  background-position: center;
  color: white;
}

.hero-card p,
.hero-card .muted {
  color: rgba(255,255,255,0.82);
}

.hero-card .badge {
  background: rgba(255,255,255,0.14);
  color: white;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.10);
}

.metric strong {
  display: block;
  font-size: 24px;
}

.course-list {
  display: grid;
  gap: 11px;
}

.course-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  text-align: left;
  color: var(--ink);
  box-shadow: none;
}

.course-item.active {
  border-color: var(--green);
  background: #fffbf7;
  box-shadow: inset 4px 0 0 var(--gold), 0 8px 20px rgba(74, 31, 46, 0.10);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f1e1d8;
  color: var(--burgundy);
  font-size: 12px;
  font-weight: 700;
}

.badge.blue {
  background: #e6eef5;
  color: var(--blue);
}

.badge.gold {
  background: #f7ecd2;
  color: var(--gold);
}

.badge.red {
  background: #f7e1df;
  color: var(--red);
}

.progress {
  height: 9px;
  background: #dfe6e2;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--burgundy), var(--gold));
}

.lesson {
  display: grid;
  gap: 14px;
  line-height: 1.66;
}

.lesson p {
  font-size: 16px;
}

.lesson h2,
.lesson h3,
.card h2,
.card h3 {
  margin: 0;
}

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

.question {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: white;
}

.option input {
  width: auto;
  margin-top: 4px;
}

.bot-log {
  flex: 1;
  min-height: 260px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble {
  border-radius: 10px;
  padding: 11px;
  background: white;
  border: 1px solid var(--line);
  line-height: 1.45;
}

.bubble.me {
  background: #f0dde2;
  align-self: flex-end;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.alert {
  border-left: 4px solid var(--gold);
  background: #fff8e9;
  padding: 13px;
  border-radius: 8px;
  line-height: 1.5;
}

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

.section-title {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.course-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ipa-hero {
  background:
    linear-gradient(135deg, rgba(74, 31, 46, 0.96), rgba(44, 16, 24, 0.92)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1400&q=75");
  background-size: cover;
  background-position: center;
  color: white;
}

.ipa-hero p {
  color: rgba(253, 246, 240, 0.84);
}

.ipa-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.ipa-game-card {
  min-height: 380px;
  justify-content: center;
  background:
    linear-gradient(180deg, #fffaf6 0%, #f8ebe1 100%);
}

.ipa-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 108px;
  border-radius: 10px;
  padding: 18px;
  background: var(--burgundy-deep);
  color: var(--gold-light);
  font-size: 46px;
  font-family: Georgia, serif;
  text-align: center;
  line-height: 1.1;
}

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

.ipa-choice {
  min-height: 66px;
  font-size: 22px;
  background: #fff;
  color: var(--burgundy);
  border: 1px solid rgba(74, 31, 46, 0.12);
  box-shadow: 0 8px 18px rgba(74, 31, 46, 0.08);
}

.ipa-choice:hover:not(:disabled) {
  background: #fff8ee;
}

.ipa-feedback {
  min-height: 28px;
  color: var(--muted);
}

.ipa-bank {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.ipa-tile {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(74, 31, 46, 0.10);
  border-radius: 9px;
  background: #fffaf6;
}

.ipa-tile strong {
  color: var(--burgundy);
  font-size: 24px;
  font-family: Georgia, serif;
}

.ipa-tile small {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 260px 1fr;
  }

  .bot {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

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

  .ipa-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .login-panel,
  .layout,
  .grid,
  .split,
  .course-actions,
  .metric-row,
  .ipa-choice-grid {
    grid-template-columns: 1fr;
  }

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

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