@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&display=swap");

/* Reading fonts are bundled with the extension (same files the web pages use). */
@font-face {
  font-family: "StudyBuddy Lexend";
  font-weight: 400;
  src: url("../fonts/lexend-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "StudyBuddy Lexend";
  font-weight: 700;
  src: url("../fonts/lexend-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "StudyBuddy OpenDyslexic";
  font-weight: 400;
  src: url("../fonts/opendyslexic-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "StudyBuddy OpenDyslexic";
  font-weight: 700;
  src: url("../fonts/opendyslexic-latin-700-normal.woff2") format("woff2");
}

:root {
  --bg: #eaf1f7;
  --panel: #ffffff;
  --ink: #1f2a37;
  --muted: #7c8794;
  --accent: #5aa6e8;
  --accent-soft: #d6ecff;
  --line: #e3e9f0;
  --shadow: 0 8px 24px rgba(44, 62, 80, 0.08);
  --global-font-family: 'StudyBuddy Lexend', sans-serif;
  --global-font-size: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: var(--panel);
  overflow: hidden;
}

button,
input,
select {
  font-family: inherit;
  color: inherit;
}

/* The scrolling screens below carry most of the side spacing themselves (--hover-room), so buttons
   that grow on hover stay fully visible instead of being cut off at the panel's edge. */
.panel {
  --hover-room: 10px;
  background: var(--panel);
  padding: 14px calc(16px - var(--hover-room));
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.panel-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 var(--hover-room) 14px;
  padding-right: 46px; /* room for the 🐞 button */
  flex-wrap: nowrap;
}

.right-top {
  justify-content: flex-start;
}



.larf-status {
  margin-left: auto;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2e6fb;
  border: 1px solid #d6c7eb;
  color: #5d4a6b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

.larf-status.is-clickable {
  cursor: pointer;
}

.larf-status.is-error {
  background: #fff1f0;
  border-color: #f2c4c0;
  color: #9b2c22;
  cursor: pointer;
}

.settings-toggle {
  border: 1px solid #c9d8ea;
  background: #f0f6ff;
  color: #35618f;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.settings-toggle.icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: #f6e4f5;
  border-color: #e1c1e8;
  color: #5d4a6b;
  flex: 0 0 auto;
}

.settings-icon {
  line-height: 1;
}

/* Takes the space left in the panel (and scrolls), so a long chat never squeezes the top bar, the
   "Now reading" strip or the chat bar. */
.panel-body {
  overflow: auto;
  flex: 1 1 0;
  min-height: 0;
  padding: 4px var(--hover-room);
}

/* One screen at a time: the panel's data-view says which. */
.view {
  display: none;
}

.panel.right[data-view="menu-study"] .menu-study-view,
.panel.right[data-view="menu-docs"] .menu-docs-view,
.panel.right[data-view="menu-other"] .menu-other-view,
.panel.right[data-view="setup"] .setup-view,
.panel.right[data-view="apikey"] .apikey-view,
.panel.right[data-view="reformat"] .reformat-view,
.panel.right[data-view="flashcards"] .flashcards-view,
.panel.right[data-view="flashcards-result"] .flashcards-result-view,
.panel.right[data-view="podcast"] .podcast-view,
.panel.right[data-view="video"] .video-view,
.panel.right[data-view="media-result"] .media-result-view,
.panel.right[data-view="welcome"] .welcome-view,
.panel.right[data-view="tutor"] .tutor-view,
.panel.right[data-view="quiz"] .quiz-view,
.panel.right[data-view="quiz-run"] .quiz-run-view,
.panel.right[data-view="quiz-result"] .quiz-result-view,
.panel.right[data-view="chat"] .chat-view {
  display: block;
}

.panel.right:not([data-view="chat"]) .chat-bar {
  display: none;
}

/* The selected-text bubble sits just above the chat bar: keep the last message clear of it. */
.panel.right[data-view="chat"]:has(.chat-context-bubble:not([hidden])) .chat-view {
  padding-bottom: 48px;
}

/* ⚙ only belongs to the chat screens (websites, documents and Exercise help); the other screens link to
   Settings → API themselves when the key is missing. */
.panel.right:not([data-view="welcome"]):not([data-view="tutor"]):not([data-view="chat"]) [data-settings="toggle"] {
  display: none;
}

/* ✨ goes back to the style screen, so it isn't needed on that screen itself. */
.panel.right[data-view="setup"] .style-btn {
  display: none;
}

/* 🌐 the website: a link that looks like the buttons next to it */
a.website-btn {
  text-decoration: none;
}

a.website-btn[hidden] {
  display: none;
}

.website-btn span {
  font-size: 16px;
  line-height: 1;
}

.style-btn span {
  font-size: 16px;
  line-height: 1;
}

/* The start screen's heading: Sabi, "Read this website" and the 🔑 pill. */
.setup-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setup-head .reformat-title {
  flex: 1;
  margin: 0;
}

.setup-owl {
  width: 40px;
  height: 40px;
}

.setup-head .key-pill {
  position: static;
  flex: 0 0 auto;
}

.setup-website {
  margin-top: 16px;
}

/* Home */

.home {
  display: grid;
  align-content: center;
  gap: 22px;
  min-height: 100%;
  /* Room at the top for the API key pill, so it never covers Sabi on short panels. */
  padding: 48px 0 40px;
}

.home-hero {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.owl-halo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  background:
    radial-gradient(circle at 30% 30%, #ffffff 0%, transparent 55%),
    radial-gradient(circle at 70% 75%, #f2d8f3 0%, transparent 60%),
    radial-gradient(circle at 25% 80%, #d6ecff 0%, transparent 55%),
    #f4f0fb;
  box-shadow: inset 0 0 0 6px #ffffff, 0 12px 30px rgba(120, 90, 160, 0.16);
}

.owl-big {
  width: 126px;
  height: auto;
  animation: owl-float 4s ease-in-out infinite;
  filter: drop-shadow(0 8px 10px rgba(60, 40, 90, 0.18));
}

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

@media (prefers-reduced-motion: reduce) {
  .owl-big {
    animation: none;
  }
}

.welcome-title {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 3px;
  background: linear-gradient(90deg, #5aa6e8, #b07cd8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome-sub {
  font-size: 18px;
  color: #2e4057;
}

.home-options {
  display: grid;
  gap: 10px;
}

.home-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(44, 62, 80, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.home-option:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 22px rgba(44, 62, 80, 0.1);
}

.home-option:focus-visible {
  outline: 3px solid #8ec5ff;
  outline-offset: 2px;
}

.home-option--web:hover {
  border-color: #b6d2ee;
}

.home-option--file:hover {
  border-color: #d6c7eb;
}

.home-option-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.home-option--web .home-option-icon {
  background: linear-gradient(135deg, #d6ecff, #eaf4ff);
}

.home-option--file .home-option-icon {
  background: linear-gradient(135deg, #f2d8f3, #f7ecfb);
}

.home-option--study:hover {
  border-color: #f3d29b;
}

.home-option--study .home-option-icon {
  background: linear-gradient(135deg, #fde9c8, #fff5e6);
}

.home-option--docs:hover {
  border-color: #b7e4c7;
}

.home-option--docs .home-option-icon {
  background: linear-gradient(135deg, #d9f2e4, #effaf4);
}

.home-option--cards:hover {
  border-color: #b7e4c7;
}

.home-option--cards .home-option-icon {
  background: linear-gradient(135deg, #d4f3e1, #ecf9f1);
}

.home-option-text {
  display: grid;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.home-option-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f2a37;
}

.home-option-desc {
  font-size: 12.5px;
  line-height: 1.4;
  color: #5a6f86;
}

.home-option-arrow {
  font-size: 26px;
  line-height: 1;
  color: #9aabbd;
}

/* Preview on the "Read this website" screen */

.style-preview {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.6;
  color: #1f2a37;
  --preview-highlight: #e2abe24d;
}

.style-preview p {
  margin: 0;
}

.style-preview mark {
  background-color: var(--preview-highlight);
  color: inherit;
  border-radius: 2px;
}

.style-preview u {
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Chat start (after transforming the website) */

.welcome {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-top: 20px;
}

.owl-medium {
  width: 84px;
  height: auto;
  margin-bottom: 4px;
}

.ready-title {
  font-weight: 800;
  font-size: 20px;
  color: #1f2a37;
}

.ready-sub {
  max-width: 300px;
  font-size: 13px;
  line-height: 1.5;
  color: #5a6f86;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: inherit;
  font-weight: 700;
  color: #35618f;
  text-decoration: underline;
  cursor: pointer;
}

/* "Ask me anything!": type the first question right here; sending it opens the chat. */
.ask-pill {
  margin: 22px auto 16px;
  padding: 10px 10px 10px 16px;
  border-radius: 16px;
  border: 1px solid #b6d2ee;
  background: #eaf4ff;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  width: 100%;
  max-width: 360px;
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ask-pill-input {
  align-self: center;
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 15px;
  outline: none;
  color: #1f2a37;
}

.ask-pill-input::placeholder {
  color: #4b6683;
}

.ask-pill-send {
  flex: 0 0 auto;
  border: 1px solid #2f5f8f;
  background: #ffffff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ask-pill img {
  width: 28px;
  height: 28px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 320px;
  margin: 12px auto 0;
}

.action-card {
  border: 1px solid #d6c7eb;
  background: #f2e6fb;
  border-radius: 10px;
  padding: 16px 12px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  min-height: 56px;
}

.card-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #d2bce8;
  display: grid;
  place-items: center;
  font-size: 12px;
}

/* Chat */

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 4px 4px 12px;
  font-size: var(--global-font-size, 16px);
  font-family: var(--global-font-family, 'StudyBuddy Lexend', sans-serif);
  line-height: var(--chat-line-height, 1.6);
  letter-spacing: var(--chat-letter-spacing, normal);
  word-break: break-word;
  --chat-highlight-color: #e2abe24d;
}

.chat-empty {
  color: #6a7d93;
  font-size: 13px;
  padding: 12px 8px;
}

.chat-context-bubble {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #eaf4ff;
  border: 1px solid #cfe3fb;
  border-radius: 14px;
  padding: 6px 10px;
  font-size: 12px;
  color: #2a4d6f;
}

.chat-context-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-context-close {
  border: none;
  background: #ffffff;
  color: #2a4d6f;
  border-radius: 999px;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

.chat-message {
  max-width: 92%;
  padding: 0;
  border: none;
  background: transparent;
}

.chat-message.user {
  align-self: flex-end;
  background: #eaf4ff;
  border: 1px solid #cfe3fb;
  padding: 10px 12px;
  border-radius: 16px;
}

.chat-message.assistant {
  align-self: stretch; /* full width from the left, also for a short answer */
  max-width: 100%;
  text-align: left;
}

.chat-message.chat-info-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  align-self: center;
  max-width: 100%;
  background: #fff6cc;
  border: 1px solid #ecd98a;
  border-radius: 12px;
  padding: 10px 12px;
}

.chat-message.chat-info-note::before {
  content: '';
  width: 24px;
  height: 24px;
  background: #fffdf0 url("../icons/owl-48.png") center / cover no-repeat;
  display: inline-flex;
  flex: 0 0 24px;
  margin-top: 1px;
}

.chat-message.chat-info-note p {
  margin: 0;
}

.chat-message.loading {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.chat-loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #c7d9ec;
  border-top-color: #2f5f8f;
  animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-spin {
  to {
    transform: rotate(360deg);
  }
}

.chat-message p {
  margin: 0 0 8px;
}

.chat-message p:last-child {
  margin-bottom: 0;
}

.chat-message ul,
.chat-message ol {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.chat-message mark {
  background-color: var(--chat-highlight-color) !important;
}

/* Sabi's bold words: black bold type, like on the page. */
.chat-message.assistant .msg-text strong {
  color: #000000;
}

.chat-ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 5px;
  vertical-align: middle;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  font-family: "Nunito", system-ui, sans-serif;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

.chat-ref:hover {
  background: #3a8fd0;
}

.citation-popup {
  position: fixed;
  z-index: 200;
  width: 340px;
  max-width: calc(100vw - 16px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(44, 62, 80, 0.15);
  padding: 12px 14px 14px;
}

.citation-popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

.citation-popup-close:hover {
  color: var(--ink);
}

.citation-popup-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-right: 20px;
}

.citation-popup-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.citation-popup-text {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
  font-style: italic;
  background: #fffde7;
  border-left: 3px solid #f9c74f;
  border-radius: 6px;
  padding: 8px 10px;
}

/* Chat bar: below the chat in the panel's column (not on top of it), so the chat's scrollbar and
   last message end where the bar begins. */

.chat-bar {
  position: relative;
  flex: 0 0 auto;
  margin: 8px var(--hover-room) 0;
  background: #eaf4ff;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-end; /* the owl and buttons stay at the bottom when the question grows */
  gap: 8px;
  border: 1px solid #cfe3fb;
  z-index: 2;
}

.chat-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 13px;
  outline: none;
  align-self: center;
}

/* Question boxes grow with the text, up to about 5 lines, then scroll. */
.grow-input {
  resize: none;
  font-family: inherit;
  line-height: 1.45;
  padding: 4px 0;
  max-height: calc(1.45em * 5 + 8px);
  overflow-y: auto;
  field-sizing: content;
}

.send {
  border: 1px solid #2f5f8f;
  background: #ffffff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.owl-mini {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
}

.owl-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Settings */

.settings-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 58px;
  max-width: 340px;
  background: #f6e4f5;
  border-radius: 14px;
  border: 1px solid #e1c1e8;
  padding: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 4;
}

.settings-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e6c4ef;
  padding: 4px;
  margin-bottom: 10px;
}

.settings-tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 10px;
  cursor: pointer;
}

.settings-tab.active {
  background: #f2d8f3;
  border-color: #e2bfe6;
}

.settings-body {
  background: #f9e9f8;
  border: 1px solid #e8c6ee;
  border-radius: 12px;
  padding: 12px;
  display: none;
  gap: 10px;
}

.settings-body.active {
  display: grid;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.setting-row label {
  color: #2e4057;
}

.setting-select {
  border: 1px solid #e5c9ec;
  background: #ffffff;
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 11px;
  color: #6b5c74;
}

.setting-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #c07bdc;
}

.setting-hint {
  margin: 0;
  font-size: 11px;
  color: #6b5c74;
  line-height: 1.4;
}

/* Reformat a file */

.reformat {
  display: grid;
  gap: 14px;
  padding-bottom: 24px;
}

.back-btn {
  justify-self: start;
  border: none;
  background: none;
  padding: 0;
  font-size: 13px;
  color: #35618f;
  cursor: pointer;
}

.reformat-title {
  margin: 0;
  font-size: 20px;
}

.reformat-sub {
  margin: -6px 0 0;
  font-size: 13px;
  color: #5a6f86;
  line-height: 1.5;
}

.reformat-step {
  display: grid;
  gap: 12px;
  background: #f9fbfe;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f2e6fb;
  border: 1px solid #d6c7eb;
  font-size: 12px;
}

.option-block {
  display: grid;
  gap: 6px;
}

.option-block.is-disabled {
  opacity: 0.45;
}

.option-label {
  font-size: 12px;
  color: #5a6f86;
}

.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.option-chip {
  border: 1px solid #d6c7eb;
  background: #ffffff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #2e4057;
}

.option-chip[aria-pressed="true"] {
  background: #f2d8f3;
  border-color: #c07bdc;
  font-weight: 700;
}

.option-chip:disabled,
.swatch:disabled {
  cursor: not-allowed;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #d4dce6;
  cursor: pointer;
}

.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #5d4a6b;
}

.drop-zone {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  border: 2px dashed #b6d2ee;
  background: #f4f9ff;
  border-radius: 14px;
  padding: 18px 12px;
  cursor: pointer;
}

.drop-zone.is-dragging {
  background: #e3f0ff;
  border-color: var(--accent);
}

.drop-icon {
  font-size: 26px;
}

.drop-text {
  font-weight: 700;
  font-size: 14px;
}

.drop-hint {
  font-size: 11px;
  color: #5a6f86;
  line-height: 1.4;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cfe3fb;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
}

.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.file-type {
  font-size: 11px;
  color: #5a6f86;
  white-space: nowrap;
}

.file-remove {
  border: none;
  background: #eaf4ff;
  border-radius: 999px;
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.file-notice,
.reformat-result {
  font-size: 13px;
  line-height: 1.5;
  border-radius: 12px;
  padding: 10px 12px;
}

.file-notice--warning {
  background: #fff6cc;
  border: 1px solid #ecd98a;
}

.file-notice--info {
  background: #eaf4ff;
  border: 1px solid #cfe3fb;
}

.file-notice--error,
.reformat-result--error {
  background: #fff1f0;
  border: 1px solid #f2c4c0;
  color: #9b2c22;
}

.file-notice mark {
  background-color: #e2abe24d;
}

.transform-btn {
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #5aa6e8, #b07cd8);
  cursor: pointer;
}

.transform-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.reformat-progress {
  display: grid;
  gap: 6px;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #eaf1f7;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #5aa6e8, #b07cd8);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: #5a6f86;
}

.reformat-result--success {
  background: #ecf9f1;
  border: 1px solid #b7e4c7;
}

.reformat-result p {
  margin: 0 0 8px;
}

.download-again {
  border: 1px solid #2f8f5b;
  background: #ffffff;
  color: #2f6f4b;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Hover: options grow a little when the pointer is on them, like the cards on Home. */
.action-card,
.option-chip,
.swatch,
.transform-btn,
.drop-zone,
.download-again {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.action-card:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 22px rgba(44, 62, 80, 0.12);
}

.action-card:hover {
  background: #ecd9f8;
  border-color: #c9a9e6;
}

.ask-pill:hover {
  border-color: #8ec5ff;
}

.ask-pill:focus-within {
  border-color: #5aa6e8;
  box-shadow: 0 0 0 3px rgba(90, 166, 232, 0.25);
}

.option-chip:not(:disabled):hover {
  transform: scale(1.08);
  border-color: #c07bdc;
  box-shadow: 0 4px 10px rgba(93, 74, 107, 0.12);
}

.swatch:not(:disabled):hover {
  transform: scale(1.15);
}

.transform-btn:not(:disabled):hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 10px 22px rgba(120, 100, 200, 0.28);
}

.drop-zone:hover {
  transform: scale(1.02);
  border-color: var(--accent);
}

.download-again:hover {
  transform: scale(1.05);
}

.action-card:active,
.option-chip:not(:disabled):active,
.swatch:not(:disabled):active,
.transform-btn:not(:disabled):active,
.home-option:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .action-card,
  .option-chip,
  .swatch,
  .transform-btn,
  .drop-zone,
  .download-again,
  .home-option {
    transition: none;
  }

  .action-card:hover,
  .option-chip:hover,
  .swatch:hover,
  .transform-btn:hover,
  .drop-zone:hover,
  .download-again:hover,
  .home-option:hover {
    transform: none;
  }
}

/* Create flashcards */

.progress-bar--busy .progress-fill {
  width: 35%;
  animation: progress-slide 1.4s ease-in-out infinite;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(290%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar--busy .progress-fill {
    width: 100%;
    animation: none;
  }
}

.fc-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

.fc-link {
  border: none;
  background: none;
  padding: 2px 0;
  font-size: 13px;
  font-weight: 700;
  color: #35618f;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.fc-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #ecf9f1;
  border: 1px solid #cfeedd;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #2e4057;
}

.fc-info-icon {
  font-size: 18px;
  line-height: 1.2;
}

.fc-detail-hint {
  font-size: 12px;
  color: #5a6f86;
  line-height: 1.4;
}

.fc-loading {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 40px 8px;
}

.fc-loading .progress-bar {
  width: 100%;
  max-width: 280px;
}

.fc-loading-owl {
  animation: owl-float 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .fc-loading-owl {
    animation: none;
  }
}

.fc-error,
.fc-result-screen {
  display: grid;
  gap: 14px;
}

.fc-error[hidden],
.fc-result-screen[hidden],
.fc-loading[hidden] {
  display: none;
}

.fc-cards {
  display: grid;
  gap: 10px;
}

.fc-card {
  display: grid;
  grid-template-columns: 24px 1fr 26px;
  gap: 8px;
  align-items: start;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.04);
}

.fc-card:focus-within {
  border-color: #8ec5ff;
  box-shadow: 0 0 0 3px rgba(142, 197, 255, 0.25);
}

.fc-card-num {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ecf9f1;
  color: #2f6f4b;
  font-size: 11px;
  font-weight: 700;
}

.fc-card-fields {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.fc-field {
  display: grid;
  gap: 2px;
}

.fc-field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a9bb0;
}

.fc-input {
  width: 100%;
  /* Grow with the text. The min-height keeps one line visible even where that isn't supported. */
  field-sizing: content;
  min-height: calc(1.45em + 10px);
  resize: none;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 6px;
  margin-left: -6px;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  color: #1f2a37;
  background: transparent;
}

.fc-input:hover {
  background: #f6f9fd;
}

.fc-input:focus {
  outline: none;
  border-color: #cfe3fb;
  background: #f4f9ff;
}

.fc-term {
  font-weight: 700;
}

.fc-definition {
  color: #4a5d72;
}

.fc-delete {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #9aabbd;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.fc-delete:hover {
  background: #fff1f0;
  color: #9b2c22;
}

.fc-show-all {
  justify-self: center;
  border: 1px solid #cfe3fb;
  background: #eaf4ff;
  color: #35618f;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.fc-show-all:hover {
  transform: scale(1.05);
  border-color: #8ec5ff;
}

.fc-add {
  border: 2px dashed #cfeedd;
  background: #f4fbf7;
  color: #2f6f4b;
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.fc-add:hover {
  transform: scale(1.02);
  border-color: #8fd3ad;
}

.fc-export {
  background: #f4fbf7;
  border-color: #cfeedd;
}

.fc-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #2e4057;
}

.fc-format {
  background: #ffffff;
  border: 1px dashed #c9d8ea;
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.fc-format-label {
  font-size: 11px;
  color: #5a6f86;
}

.fc-format code {
  font-size: 12px;
  color: #1f2a37;
  line-height: 1.6;
}

/* API key */

.home-view {
  position: relative;
}

.key-pill {
  position: absolute;
  top: 8px;
  right: calc(var(--hover-room) + 46px); /* left of the 🐞 button */
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #2e4057;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.key-pill:hover {
  transform: scale(1.06);
  border-color: #b6d2ee;
  box-shadow: 0 6px 14px rgba(44, 62, 80, 0.1);
}

.key-pill:focus-visible {
  outline: 3px solid #8ec5ff;
  outline-offset: 2px;
}

/* No key yet: yellow and a gentle pulse so it gets noticed. */
.key-pill.is-missing {
  background: #fff6cc;
  border-color: #e6c65a;
  color: #7a5d00;
  animation: key-pulse 2.2s ease-in-out infinite;
}

@keyframes key-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(230, 198, 90, 0.45);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(230, 198, 90, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .key-pill.is-missing {
    animation: none;
  }

  .key-pill:hover {
    transform: none;
  }
}

/* Language picker (Home, top left): the current flag; clicking it lists every language. */

.lang-picker {
  position: relative;
  flex: 0 0 auto;
}

/* On Home it sits in the top-left corner (the key pill is top right). */
.lang-picker--corner {
  position: absolute;
  top: 8px;
  left: var(--hover-room);
  z-index: 2;
}

/* Near the right edge (the popup): the menu opens leftwards. */
.lang-picker--end .lang-menu {
  left: auto;
  right: 0;
}

.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #2e4057;
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.lang-current:hover {
  transform: scale(1.06);
  border-color: #b6d2ee;
  box-shadow: 0 6px 14px rgba(44, 62, 80, 0.1);
}

.lang-current:focus-visible,
.lang-option:focus-visible {
  outline: 3px solid #8ec5ff;
  outline-offset: 2px;
}

.lang-flag {
  width: 24px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(31, 42, 55, 0.12);
  flex: 0 0 auto;
}

.lang-caret {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.lang-current[aria-expanded="true"] .lang-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.lang-menu[hidden] {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.lang-option:hover {
  background: #f0f6ff;
}

.lang-option[aria-checked="true"] {
  background: var(--accent-soft);
  font-weight: 700;
}

.lang-option-check {
  margin-left: auto;
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .lang-current,
  .lang-caret {
    transition: none;
  }

  .lang-current:hover {
    transform: none;
  }
}

.key-status {
  justify-self: start;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

.key-status--ok {
  background: #ecf9f1;
  border: 1px solid #b7e4c7;
  color: #2f6f4b;
}

.key-status--missing {
  background: #fff6cc;
  border: 1px solid #ecd98a;
  color: #7a5d00;
}

.key-field {
  display: flex;
  gap: 6px;
}

.key-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 1px solid #cfe3fb;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: #1f2a37;
}

.key-input:focus {
  outline: none;
  border-color: #8ec5ff;
  box-shadow: 0 0 0 3px rgba(142, 197, 255, 0.25);
}

.key-toggle {
  flex: 0 0 42px;
  border: 1px solid #cfe3fb;
  background: #f4f9ff;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
}

.key-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 20px;
}

.key-saved {
  font-size: 13px;
  font-weight: 700;
  color: #2f6f4b;
}

.key-remove {
  color: #9b2c22;
}

.key-link {
  color: #35618f;
  font-weight: 700;
}

.key-advanced summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #5a6f86;
}

.key-model {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.key-privacy {
  text-align: center;
}

/* AI podcast and AI video */

.home-option--podcast:hover {
  border-color: #f2c4a0;
}

.home-option--podcast .home-option-icon {
  background: linear-gradient(135deg, #ffe3cc, #fff3e8);
}

.home-option--video:hover {
  border-color: #c9b8f0;
}

.home-option--video .home-option-icon {
  background: linear-gradient(135deg, #e3dcfb, #f1edfd);
}

.media-info {
  background: #f6f2fc;
  border-color: #e3d6f5;
}

.media-loading .progress-bar {
  width: 100%;
  max-width: 300px;
}

.media-stages {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
  font-size: 13px;
  width: 100%;
  max-width: 300px;
}

.media-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9aabbd;
}

.media-stage--active {
  color: #1f2a37;
  font-weight: 700;
}

.media-stage--done {
  color: #2f6f4b;
}

.media-stage-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.media-stage--done .media-stage-icon {
  background: #ecf9f1;
}

.media-stage--active .media-stage-icon {
  border: 2px solid #cfe3fb;
  border-top-color: #5aa6e8;
  animation: chat-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .media-stage--active .media-stage-icon {
    animation: none;
  }
}

.media-player audio {
  width: 100%;
}

.media-player video {
  width: 100%;
  border-radius: 12px;
  background: #1f2a37;
  box-shadow: 0 6px 18px rgba(44, 62, 80, 0.15);
}

.media-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #35618f;
}

.media-script {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: #2e4057;
}

.media-line {
  margin: 0;
}

.media-line p {
  margin: 2px 0 0;
}

/* Report a problem (🐞) */

.bug-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.06);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.bug-btn:hover {
  transform: scale(1.1);
  border-color: #f2c4c0;
}

.bug-btn:focus-visible {
  outline: 3px solid #8ec5ff;
  outline-offset: 2px;
}

.bug-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(31, 42, 55, 0.35);
}

.bug-dialog {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 100%;
  overflow: auto;
  background: #ffffff;
  border-radius: 18px;
  padding: 20px 18px 18px;
  box-shadow: 0 18px 40px rgba(31, 42, 55, 0.25);
}

.bug-dialog #bugForm,
.bug-thanks {
  display: grid;
  gap: 10px;
}

.bug-dialog #bugForm[hidden],
.bug-thanks[hidden] {
  display: none;
}

.bug-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #8a9bb0;
  cursor: pointer;
}

.bug-where {
  font-size: 13px;
  background: #f4f9ff;
  border: 1px solid #cfe3fb;
  border-radius: 10px;
  padding: 8px 10px;
  color: #2e4057;
}

.bug-text {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  border: 1px solid #cfe3fb;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2a37;
}

.bug-text:focus {
  outline: none;
  border-color: #8ec5ff;
  box-shadow: 0 0 0 3px rgba(142, 197, 255, 0.25);
}

.bug-count {
  margin-top: -6px;
  text-align: right;
  font-size: 11px;
  color: #8a9bb0;
}

.bug-thanks {
  justify-items: center;
  text-align: center;
  padding-top: 6px;
}

/* "📄 Now reading: …" above the chat */

.now-reading {
  display: none;
  margin: -6px var(--hover-room) 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #f4f9ff;
  border: 1px solid #cfe3fb;
  font-size: 12px;
  color: #2e4057;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel.right[data-view="welcome"] .now-reading,
.panel.right[data-view="chat"] .now-reading {
  display: flex;
}

.now-reading {
  align-items: center;
  gap: 8px;
}

.now-reading-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-reading-action {
  flex: 0 0 auto;
  border: none;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #5aa6e8, #b07cd8);
  cursor: pointer;
}

.home-option--reader:hover {
  border-color: #b6e0f0;
}

.home-option--reader .home-option-icon {
  background: linear-gradient(135deg, #d4eef7, #eaf7fb);
}

/* Chat messages: selection chip, copy / edit tools, editor */

.msg-context {
  margin-bottom: 6px;
  font-size: 12px;
  color: #35618f;
}

.msg-context summary {
  cursor: pointer;
  font-weight: 700;
}

.msg-context blockquote {
  margin: 6px 0 0;
  padding: 6px 8px;
  border-left: 3px solid #8ec5ff;
  background: #ffffff;
  border-radius: 6px;
  color: #2e4057;
  font-style: italic;
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
}

/* Copy / edit icons: always under replies; under the user's own messages (outside the bubble,
   aligned right) only while hovering over the message. */
.msg-tools {
  display: flex;
  gap: 2px;
  margin-top: 6px;
}

.chat-message.user {
  position: relative;
}

.chat-message.user .msg-tools {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0;
  padding-top: 3px; /* no gap, so moving the mouse onto the icons keeps them visible */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.chat-message.user:hover .msg-tools,
.chat-message.user .msg-tools:focus-within {
  opacity: 1;
  visibility: visible;
}

.msg-tool {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #8a9bb0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.msg-tool:hover {
  background: #eaf1f7;
  color: #2e4057;
}

.msg-tool:focus-visible {
  outline: 2px solid #8ec5ff;
  outline-offset: 1px;
}

.chat-message.is-editing .msg-text,
.chat-message.is-editing .msg-tools {
  display: none;
}

.msg-editor {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.msg-edit-input {
  width: 100%;
  resize: vertical;
  border: 1px solid #8ec5ff;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}

.msg-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.msg-edit-cancel,
.msg-edit-send {
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.msg-edit-cancel {
  border: 1px solid #cfe3fb;
  background: #ffffff;
  color: #35618f;
}

.msg-edit-send {
  border: none;
  background: linear-gradient(135deg, #5aa6e8, #b07cd8);
  color: #ffffff;
}

/* Home options that aren't available yet (AI podcast and AI video, see MEDIA_ENABLED) */
.home-option:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(1);
  box-shadow: none;
  background: #f6f8fb;
}

.home-option:disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}

.home-option-soon {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e7ecf2;
  color: #5a6f86;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* Study tools: Exercise help and Exam practice quiz */

.home-option--exercise:hover {
  border-color: #c9b8f0;
}

.home-option--exercise .home-option-icon {
  background: linear-gradient(135deg, #e6dcfb, #f4effd);
}

.home-option--quiz:hover {
  border-color: #f2c4c0;
}

.home-option--quiz .home-option-icon {
  background: linear-gradient(135deg, #fde0dc, #fff0ee);
}

/* Exercise help: the tutor's start screen and the 💡 "full solution" button in the chat bar */

.tutor-start {
  width: 100%;
  max-width: 360px;
  margin-top: 18px;
}

.tutor-view .ask-pill {
  margin-top: 12px;
}

.tutor-solution {
  font-size: 13px;
}

.chat-solution {
  flex: 0 0 auto;
  border: 1px solid #e6c65a;
  background: #fff6cc;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
}

.chat-solution:hover {
  background: #ffefa6;
}

/* ⌗ Summarize the whole page or document */
.chat-solution.chat-summary {
  border-color: #d6c7eb;
  background: #f4ecfb;
  font-weight: 800;
  color: #6b4a8f;
}

.chat-solution.chat-summary:hover {
  background: #ead9f7;
}

/* Exam practice quiz */

.quiz-files {
  display: grid;
  gap: 6px;
}

.quiz-files:empty {
  display: none;
}

.quiz-files .file-info {
  margin: 0;
}

.quiz-question-screen {
  display: grid;
  gap: 12px;
}

.quiz-progress {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #5a6f86;
}

.quiz-kind {
  justify-self: start;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f2e6fb;
  color: #5d4a6b;
  font-size: 12px;
  font-weight: 700;
}

.quiz-question {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
}

.quiz-options {
  display: grid;
  gap: 8px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.quiz-option:not(:disabled):hover {
  border-color: #b6d2ee;
  background: #f5faff;
}

.quiz-option-letter {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef3f9;
  font-size: 13px;
  font-weight: 800;
  color: #35618f;
}

.quiz-option[aria-pressed="true"] {
  border-color: #5aa6e8;
  background: #eaf4ff;
}

.quiz-option.is-right {
  border-color: #4caf7d;
  background: #e8f7ef;
}

.quiz-option.is-right .quiz-option-letter {
  background: #4caf7d;
  color: #ffffff;
}

.quiz-option.is-wrong {
  border-color: #e07a72;
  background: #fff1f0;
}

.quiz-option.is-wrong .quiz-option-letter {
  background: #e07a72;
  color: #ffffff;
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-answer {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c9d8ea;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}

.quiz-answer:focus {
  outline: 3px solid #8ec5ff;
  outline-offset: 1px;
}

.quiz-written .setting-hint {
  margin: 6px 2px 0;
}

.quiz-feedback {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--line);
}

.quiz-feedback[hidden] {
  display: none;
}

.quiz-feedback strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.quiz-feedback p {
  margin: 4px 0 0;
}

.quiz-feedback--correct {
  background: #e8f7ef;
  border-color: #a8dcc0;
  color: #1f5a3a;
}

.quiz-feedback--partly {
  background: #fff6cc;
  border-color: #e6c65a;
  color: #5c4600;
}

.quiz-feedback--wrong,
.quiz-feedback--skipped {
  background: #fff1f0;
  border-color: #f2c4c0;
  color: #7a2a22;
}

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

.quiz-next {
  flex: 1;
  max-width: 240px;
  margin-left: auto;
}

.quiz-score-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 22px 16px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eaf4ff, #f4ecfb);
  text-align: center;
}

.quiz-score {
  font-size: 40px;
  font-weight: 800;
  background: linear-gradient(90deg, #5aa6e8, #b07cd8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.quiz-score-msg {
  font-size: 15px;
  color: #2e4057;
}

.quiz-review-title {
  margin: 22px 0 10px;
  font-size: 16px;
}

.quiz-review {
  display: grid;
  gap: 10px;
}

.quiz-review-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  background: #ffffff;
  font-size: 14px;
  line-height: 1.5;
}

.quiz-review-item.is-correct {
  border-left-color: #4caf7d;
}

.quiz-review-item.is-partly {
  border-left-color: #e6c65a;
}

.quiz-review-item.is-wrong,
.quiz-review-item.is-skipped {
  border-left-color: #e07a72;
}

.quiz-review-q {
  font-weight: 700;
}

.quiz-review-line {
  color: #44566c;
}

.quiz-review-line strong {
  color: #2e4057;
}

@media (prefers-reduced-motion: reduce) {
  .quiz-option {
    transition: none;
  }
}

/* Exercise help: choosing the exercise, the strip saying which one is on, and "continue?" */

.panel.right[data-view="tutor"] .now-reading {
  display: flex;
}

.tutor-open-hint {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff6cc;
  border: 1px solid #e6c65a;
  color: #5c4600;
  font-size: 13px;
}

.tutor-open-hint[hidden],
.tutor-loading[hidden],
.tutor-choices[hidden],
.tutor-single[hidden] {
  display: none;
}

.tutor-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 14px;
  color: #5a6f86;
}

.tutor-single {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
}

.tutor-choices {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin-top: 16px;
  text-align: left;
}

.tutor-choices-title {
  font-size: 14px;
  font-weight: 700;
  color: #2e4057;
  text-align: center;
  margin-bottom: 2px;
}

.tutor-list {
  display: grid;
  gap: 8px;
}

.tutor-exercise,
.tutor-all {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tutor-exercise:hover,
.tutor-all:hover {
  border-color: #c9b8f0;
  background: #faf7ff;
}

.tutor-exercise strong {
  font-size: 14px;
}

.tutor-exercise small,
.tutor-all small {
  font-size: 12px;
  color: #5a6f86;
}

.tutor-exercise.is-done {
  background: #f1faf5;
  border-color: #b7e4c7;
}

.tutor-all {
  margin-top: 4px;
  background: #f4effd;
  border-color: #d6c7eb;
  font-weight: 700;
  font-size: 14px;
}

.tutor-all small {
  font-weight: 400;
}

.exercise-strip {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px var(--hover-room) 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #f4effd;
  border: 1px solid #d6c7eb;
  font-size: 12px;
  color: #3f3356;
}

.panel.right[data-view="chat"] .exercise-strip:not([hidden]) {
  display: flex;
}

.exercise-strip-text {
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-strip .link-btn {
  flex: 0 0 auto;
  font-size: 12px;
}

/* "📍 Exercise 2" at the start of each exercise in the chat */
.exercise-divider {
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f4effd;
  border: 1px solid #d6c7eb;
  color: #3f3356;
  font-size: 12px;
  font-weight: 700;
  font-family: "Nunito", system-ui, sans-serif;
}

/* "Continue with Exercise 3? Yes / No" */
.tutor-next {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f1faf5;
  border: 1px solid #b7e4c7;
}

.tutor-next p {
  margin: 0;
  font-weight: 700;
}

.tutor-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tutor-next-actions button {
  border: 1px solid #2f5f8f;
  background: #ffffff;
  border-radius: 10px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.tutor-next-actions .tutor-yes {
  background: linear-gradient(135deg, #5aa6e8, #b07cd8);
  border-color: transparent;
  color: #ffffff;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .tutor-exercise,
  .tutor-all {
    transition: none;
  }
}

/* Quiz results: "Ask Sabi about my answers" */
.quiz-ask {
  margin-top: 10px;
  background: #ffffff;
  color: #35618f;
  border: 1px solid #b6d2ee;
  box-shadow: none;
}

.quiz-ask-hint {
  margin: 6px 2px 0;
}

.bug-where-detail {
  margin: -4px 0 10px;
  font-size: 12px;
  color: #5a6f86;
  overflow-wrap: anywhere;
}

.bug-where-detail[hidden] {
  display: none;
}

.home-option--other:hover {
  border-color: #d4dce6;
}

.home-option--other .home-option-icon {
  background: linear-gradient(135deg, #e7ecf2, #f4f6f9);
}

/* Home options that are links (the website) */
a.home-option {
  color: inherit;
  text-decoration: none;
}

/* 🐞 A screenshot with the report */
.bug-shot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 6px 0 4px;
}

.bug-shot-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c9d8ea;
  background: #f0f6ff;
  color: #35618f;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bug-shot-btn:hover {
  background: #e3f0ff;
}

.bug-shot-hint {
  font-size: 12px;
  color: #7c8794;
}

.bug-shot-preview {
  position: relative;
  flex-basis: 100%;
}

.bug-shot-preview[hidden] {
  display: none;
}

.bug-shot-preview img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.bug-shot-remove {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(31, 42, 55, 0.75);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* ⚙ Page → 🧹 Remove highlights from this website */
.clear-page-btn {
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  font-size: 13px;
  background: #ffffff;
  color: #2e4057;
  border: 1px solid #d6c7eb;
  box-shadow: none;
}

.clear-page-btn:hover {
  background: #f4ecfb;
}

/* 🔑 in the top bar: yellow and pulsing while there's no API key */
.key-btn.is-missing {
  background: #fff6cc;
  border-color: #e6c65a;
  animation: key-pulse 2.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .key-btn.is-missing {
    animation: none;
  }
}

/* "I need an API key": the button to add it, right in the chat */
.chat-key-btn {
  margin-top: 8px;
  width: auto;
  padding: 8px 16px;
}
