:root {
  --bg: #0b1220;
  --fg: #e5e7eb;
  --muted: rgba(229, 231, 235, 0.75);
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.14);
  --primary: #60a5fa;
  --primary2: #38bdf8;
  --shadow: rgba(0, 0, 0, 0.35);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  color: var(--fg);
  background: radial-gradient(1000px 600px at 20% 10%, rgba(96, 165, 250, 0.25), transparent 55%),
    radial-gradient(900px 700px at 70% 35%, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(900px 700px at 40% 80%, rgba(99, 102, 241, 0.12), transparent 55%), var(--bg);
}

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

.deck {
  position: relative;
  padding: 18px 18px 18px;
  display: grid;
  place-items: center;
}

.slide {
  width: min(1500px, calc(100vw - 36px));
  height: min(820px, calc(100vh - 110px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
  box-shadow: 0 18px 40px var(--shadow);
  overflow: hidden;
  display: none;
}

.slide.active {
  display: block;
  animation: slideIn 180ms ease-out;
}

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

.slide-inner {
  height: 100%;
  padding: 56px 64px;
  display: grid;
  align-content: start;
  gap: 18px;
}

h1 {
  font-size: 56px;
  letter-spacing: -0.02em;
  margin: 0;
}

h2 {
  font-size: 40px;
  letter-spacing: -0.02em;
  margin: 0;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 20px;
}

.hint {
  margin-top: auto;
  color: rgba(229, 231, 235, 0.55);
  font-size: 14px;
}

.list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 22px;
  display: grid;
  gap: 10px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  padding: 16px 18px;
  width: min(720px, 100%);
}

.card-title {
  font-weight: 650;
  margin-bottom: 6px;
}

.card-body {
  color: var(--muted);
  line-height: 1.45;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(720px, 100%);
  margin-top: 10px;
}

.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  text-align: center;
  font-size: 18px;
  color: rgba(229, 231, 235, 0.9);
}

.toolbar {
  padding: 14px 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  padding: 10px 14px;
  cursor: pointer;
  min-width: 96px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: rgba(96, 165, 250, 0.45);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.25), rgba(56, 189, 248, 0.12));
}

.status {
  min-width: 320px;
  display: inline-flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  color: rgba(229, 231, 235, 0.88);
}

.status .title {
  font-weight: 650;
}

.status .sep {
  opacity: 0.6;
}

.status .pos {
  color: rgba(229, 231, 235, 0.7);
}

.fragment {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(0.2px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.fragment.visible {
  opacity: 1;
  transform: translateY(0);
}

.teacher-avatar {
  position: fixed;
  right: 18px;
  top: 50%;
  width: 84px;
  height: 84px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  z-index: 70;
  pointer-events: auto;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  animation: teacherFloat 3.6s ease-in-out infinite;
  backdrop-filter: blur(8px);
}

.teacher-avatar:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.85);
  outline-offset: 3px;
}

.assistant-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  width: min(570px, calc(100vw - 36px));
  height: min(640px, calc(100vh - 36px));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.62);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  z-index: 60;
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  backdrop-filter: blur(12px);
  font-size: 28px;
}

.assistant-panel.open {
  display: grid;
}

.assistant-header {
  padding: 12px 12px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.assistant-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.assistant-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(229, 231, 235, 0.92);
  cursor: pointer;
}

.assistant-close:hover {
  background: rgba(255, 255, 255, 0.07);
}

.assistant-messages {
  padding: 12px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.assistant-msg {
  display: grid;
  gap: 6px;
  max-width: 100%;
}

.assistant-msg.user {
  justify-items: end;
}

.assistant-msg.assistant {
  justify-items: start;
}

.assistant-bubble {
  max-width: 92%;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.assistant-bubble h1,
.assistant-bubble h2,
.assistant-bubble h3,
.assistant-bubble h4,
.assistant-bubble h5,
.assistant-bubble h6 {
  margin: 0 0 8px;
  font-size: 16px;
}

.assistant-bubble p {
  margin: 0 0 8px;
}

.assistant-bubble p:last-child {
  margin-bottom: 0;
}

.assistant-bubble ul,
.assistant-bubble ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.assistant-bubble li {
  margin: 4px 0;
}

.assistant-bubble a {
  color: rgba(147, 197, 253, 0.95);
  text-decoration: underline;
}

.assistant-bubble pre {
  margin: 8px 0 0;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  overflow: auto;
  white-space: pre;
}

.assistant-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}

.assistant-bubble code.md-inline {
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
}

.assistant-msg.user .assistant-bubble {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(96, 165, 250, 0.12);
}

.assistant-meta {
  font-size: 12px;
  color: rgba(229, 231, 235, 0.68);
}

.assistant-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 10px;
}

.assistant-toggles {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.assistant-speak {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(229, 231, 235, 0.82);
  font-size: 13px;
  user-select: none;
}

.assistant-input-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: end;
}

.assistant-input {
  resize: none;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(229, 231, 235, 0.92);
  padding: 10px 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
}

.assistant-input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
}

.assistant-mic,
.assistant-clear,
.assistant-send {
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(229, 231, 235, 0.92);
  cursor: pointer;
  min-width: 64px;
}

.assistant-clear {
  color: rgba(229, 231, 235, 0.78);
}

.assistant-send {
  border-color: rgba(96, 165, 250, 0.35);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.22), rgba(56, 189, 248, 0.10));
}

.assistant-mic:hover,
.assistant-clear:hover,
.assistant-send:hover {
  background: rgba(255, 255, 255, 0.07);
}

.assistant-mic[aria-pressed="true"] {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.16);
}

.teacher-avatar svg {
  width: 66px;
  height: 66px;
}

@keyframes teacherFloat {
  0%,
  100% {
    transform: translateY(-50%) translateY(0);
  }
  50% {
    transform: translateY(-50%) translateY(-6px);
  }
}

@media (max-width: 720px) {
  .slide-inner {
    padding: 34px 26px;
  }
  h1 {
    font-size: 40px;
  }
  h2 {
    font-size: 30px;
  }
  .list {
    font-size: 18px;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status {
    min-width: 180px;
  }
  .teacher-avatar {
    right: 10px;
    width: 64px;
    height: 64px;
  }
  .teacher-avatar svg {
    width: 50px;
    height: 50px;
  }
}
