/* Phones keep the sizes set here: no "font boosting" that made some text (the menu's sessions, the
   start page's label) much bigger than the rest. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* The StudyBuddy website's layout. Colours, buttons, cards, chat and tool screens come from the
   extension's stylesheet (styles/studybuddy.css, shared); this file only lays them out as a website:
   a top bar, the start page, and the workspace (menu | tool | chat). */

body.app {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------------------------------------------------------------- password */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #eaf4ff, #f4ecfb);
}

body[data-screen="gate"] .gate {
  display: grid;
}

body[data-screen="gate"] .app-bar,
body[data-screen="gate"] .landing,
body[data-screen="gate"] .lp-start,
body[data-screen="gate"] .workspace {
  visibility: hidden;
}

.gate-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 22px;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(31, 42, 55, 0.14);
  text-align: center;
}

.gate-title {
  margin: 0;
  font-size: 24px;
}

.gate-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #5a6f86;
}

.gate-label {
  justify-self: start;
  font-size: 13px;
  font-weight: 700;
  color: #2e4057;
}

.gate-input {
  width: 100%;
}

.gate-card .transform-btn,
.gate-card .file-notice {
  width: 100%;
}

.gate-lang {
  margin-top: 4px;
}

/* ---------------------------------------------------------------- top bar */

.app-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  z-index: 30;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  padding: 4px 6px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
}

.app-brand img {
  width: 34px;
  height: 34px;
}

.app-brand:hover {
  background: #f0f6ff;
}

.app-bar-space {
  flex: 1;
}

.app-bar-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.app-bar-btn:hover {
  background: #f0f6ff;
}

/* 💬 is for narrow screens; ☰ hides or shows the menu (on narrow screens it slides it in). */
.chat-toggle,
.chat-close {
  display: none;
}

body:not([data-screen="workspace"]) .nav-toggle {
  display: none;
}

/* ---------------------------------------------------------------- start page */

.landing {
  flex: 1;
  overflow-y: auto;
}

/* ---------------------------------------------------------------- workspace */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--nav-width, 250px) minmax(0, 1fr);
  position: relative;
}

.workspace.has-chat {
  grid-template-columns: var(--nav-width, 250px) minmax(0, 1fr) var(--chat-width, minmax(320px, 400px));
}

.workspace:not(.has-chat) .app-chat {
  display: none;
}

/* Menu hidden with ☰ (wide screens): the tool takes its room. */
@media (min-width: 901px) {
  .workspace.nav-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace.nav-hidden.has-chat {
    grid-template-columns: minmax(0, 1fr) var(--chat-width, minmax(320px, 400px));
  }

  .workspace.nav-hidden .app-nav {
    display: none;
  }
}

/* The document every tool uses, above the tool */
.doc-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px max(16px, calc((100% - 760px) / 2));
  background: #f6f9fe;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: #2e4057;
}

.doc-bar[hidden] {
  display: none;
}

.doc-bar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-bar-label {
  color: #5a6f86;
}

.doc-bar-change {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #2e4057;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.doc-bar-change:hover {
  background: #f0f6ff;
  border-color: #b6d2ee;
}

/* 🔄 Change document's menu: the files (✕ takes one out), add more, other files instead */
.doc-menu-wrap {
  position: relative;
}

.doc-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  width: min(320px, calc(100vw - 32px));
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(30, 50, 80, 0.16);
}

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

.doc-menu-title {
  font-weight: 700;
  color: #5a6f86;
  margin: 0 4px 6px;
}

.doc-menu-files {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.doc-menu-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  border-bottom: 1px solid #eef3f9;
}

.doc-menu-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-menu-remove {
  border: 0;
  background: transparent;
  color: #a33b3b;
  font: inherit;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.doc-menu-remove:hover {
  background: #fdecec;
}

.doc-menu-action {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #2e4057;
  font: inherit;
  font-weight: 700;
  padding: 8px 6px;
  border-radius: 10px;
  cursor: pointer;
}

.doc-menu-action:hover:not(:disabled) {
  background: #f0f6ff;
}

.doc-menu-action:disabled {
  opacity: 0.5;
  cursor: default;
}

/* The optional "how should it be" boxes (quiz, flashcards) and "Change all the cards at once" */
.wish-box {
  margin-top: 8px;
  font-size: 14px;
}

.fc-rework {
  margin: 4px 0 14px;
  padding: 12px;
  border: 1px dashed #b6d2ee;
  border-radius: 14px;
  background: #f8fbff;
}

.fc-rework-label {
  display: block;
  font-weight: 700;
  color: #2e4057;
}

.fc-rework-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.fc-rework-row .wish-box {
  flex: 1 1 220px;
}

.fc-rework-btn {
  width: auto;
  margin: 0;
  padding: 10px 16px;
}

/* 📌 Definitions: lit up while the box is open; how many there are. */
.doc-bar-defs[aria-pressed="true"] {
  background: #fff4cc;
  border-color: #e8c34a;
}

.doc-bar-defs-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 5px;
  border-radius: 999px;
  background: #ffe08a;
  color: #5c4500;
  font-size: 12px;
  text-align: center;
}

.doc-bar-defs-count[hidden] {
  display: none;
}

.doc-bar-error {
  flex-basis: 100%;
  color: #a33b3b;
  font-weight: 700;
}

/* With the Reader in the middle, the bar spans it edge to edge. */
.workspace-main[data-view="reader"] .doc-bar {
  padding-inline: 16px;
}

/* Menu */
.app-nav {
  overflow-y: auto;
  padding: 14px 10px 24px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 14px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group-title {
  margin: 0 8px 4px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5a6f86;
}

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

.nav-item:hover:not(:disabled) {
  background: #f0f6ff;
}

.nav-item.is-current {
  background: #e3f0ff;
  font-weight: 700;
}

.nav-item:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.nav-icon {
  flex: 0 0 22px;
  text-align: center;
}

.nav-label {
  flex: 1;
}

.nav-arrow:empty {
  display: none;
}

.nav-item .home-option-soon {
  font-size: 10px;
  padding: 2px 7px;
}

.nav-home {
  font-weight: 700;
}

/* The middle and the chat use the extension's panel styles, but fill their column. */
.workspace .panel {
  height: auto;
  min-height: 0;
  min-width: 0;
}

.workspace-main {
  background: #ffffff;
  padding: 0;
}

.workspace-main .panel-body {
  padding: 18px max(16px, calc((100% - 760px) / 2)) 32px;
}

.workspace-main .reformat {
  max-width: 760px;
}

.panel.right[data-view="reader"] .reader-view {
  display: block;
}

.workspace-main .reader-view {
  padding: 0;
  overflow: hidden;
  height: 100%;
}

.reader-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg);
}

/* Chat */
.app-chat {
  border-left: 1px solid var(--line);
}

.chat-panel-title {
  font-weight: 800;
  font-size: 15px;
  color: #2e4057;
}

.app-chat .panel-top {
  padding-right: 0;
}

/* Before a document is open, "Ask me anything" waits for it. */
.app-chat.chat-waiting .ask-pill,
.app-chat.chat-waiting .quick-actions {
  display: none;
}

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

/* 🐞 over the whole page */
.app-overlay {
  position: fixed;
  z-index: 200;
}

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 1180px) {
  .workspace.has-chat {
    grid-template-columns: var(--nav-width, 220px) minmax(0, 1fr) var(--chat-width, minmax(300px, 340px));
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .workspace.nav-hidden.has-chat {
    grid-template-columns: minmax(0, 1fr) var(--chat-width, minmax(300px, 340px));
  }
}

/* Below 900px: the menu (☰) and the chat (💬) slide in over the tool. */
@media (max-width: 900px) {
  .workspace,
  .workspace.has-chat {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-nav,
  .app-chat {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 20;
    width: min(320px, 88vw);
    box-shadow: 0 10px 30px rgba(31, 42, 55, 0.18);
    transition: transform 0.2s ease;
  }

  .app-nav {
    left: 0;
    transform: translateX(-105%);
  }

  .app-chat {
    right: 0;
    width: min(420px, 100vw);
    transform: translateX(105%);
  }

  .workspace.nav-open .app-nav,
  .workspace.chat-open .app-chat {
    transform: none;
  }

  .workspace.has-chat .chat-close {
    display: grid;
  }

}

body.chat-available .chat-toggle {
  display: none;
}

@media (max-width: 900px) {
  body.chat-available .chat-toggle {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-nav,
  .app-chat {
    transition: none;
  }
}

/* » hides the chat on a wide screen; the « 💬 tab on the right edge brings it back. */




@media (min-width: 901px) {
  .workspace.has-chat.chat-hidden {
    grid-template-columns: var(--nav-width, 250px) minmax(0, 1fr);
  }

  .workspace.nav-hidden.has-chat.chat-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace.chat-hidden .app-chat {
    display: none;
  }

  .workspace.has-chat.chat-hidden .chat-show {
    display: flex;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .workspace.has-chat.chat-hidden {
    grid-template-columns: var(--nav-width, 220px) minmax(0, 1fr);
  }
}


/* ---------------------------------------------------------------- first-time tour (web/tour.js) */

.tour {
  position: fixed;
  inset: 0;
  z-index: 400;
  font-family: "Nunito", system-ui, sans-serif;
}

/* Clicks outside the card don't reach the page while the tour is on. */
.tour-block {
  position: absolute;
  inset: 0;
}

/* The lit-up part: everything around it is darker. */
.tour-hole {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 200vmax rgba(18, 24, 38, 0.58), 0 0 0 4px #d39be0, 0 0 22px 6px rgba(211, 155, 224, 0.55);
  pointer-events: none;
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.tour-card {
  position: fixed;
  width: min(340px, calc(100vw - 24px));
  padding: 16px 18px 14px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(18, 24, 38, 0.28);
  color: #1f2a37;
  transition: left 0.3s ease, top 0.3s ease;
}

.tour-card.is-in {
  animation: tour-in 0.3s ease;
}

@keyframes tour-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.tour-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.tour-count {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #a774d2;
}

.tour-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #5a6f86;
  cursor: pointer;
  padding: 0 2px;
}

.tour-close:hover {
  color: #1f2a37;
}

.tour-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.tour-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #44566c;
}

.tour-text mark {
  background: var(--tour-mark, #e2abe280);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.tour-text u {
  text-decoration-thickness: max(1px, 0.07em);
  text-underline-offset: 0.22em;
  text-decoration-color: #000000;
}

.tour-text strong {
  font-weight: 800;
  color: #000000;
}

.tour-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.tour-space {
  flex: 1;
}

.tour-skip {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #5a6f86;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.tour-back,
.tour-next {
  border-radius: 12px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.tour-back {
  border: 1px solid #d6e0ea;
  background: #ffffff;
  color: #1f2a37;
}

.tour-next {
  border: none;
  color: #ffffff;
  background: linear-gradient(90deg, #5aa6e8, #b07cd8);
  box-shadow: 0 6px 14px rgba(122, 130, 220, 0.3);
}

.tour-back:hover,
.tour-next:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .tour-hole,
  .tour-card {
    transition: none;
  }

  .tour-card.is-in {
    animation: none;
  }
}

/* Exam practice quiz → only some chapters */
.quiz-parts {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

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

.quiz-part {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  font-size: 14px;
}

.quiz-part:hover {
  border-color: #b6d2ee;
}

.quiz-part input {
  width: 18px;
  height: 18px;
  accent-color: #a774d2;
  flex: 0 0 auto;
}

.quiz-part-title {
  flex: 1;
  min-width: 0;
}

.quiz-part small {
  color: #7c8794;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- what's new (after an update) */

.news-overlay {
  position: fixed;
  z-index: 250;
}

.news-dialog {
  max-width: 860px;
  max-height: calc(100vh - 32px);
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 24px 24px 20px;
}

.news-dialog .owl-medium {
  justify-self: center;
  width: 56px;
  height: auto;
}

.news-dialog .reformat-title {
  justify-self: stretch;
  text-align: center;
}

.news-dialog .reformat-sub {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #2e4057;
}

.news-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

/* A wide screen: the changes in two columns, so the popup isn't a long phone-like strip. */
@media (min-width: 760px) {
  .news-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* A big screen: three columns, in a wider popup. */
@media (min-width: 1150px) {
  .news-dialog {
    max-width: 1080px;
  }

  .news-list {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.news-list li {
  padding: 8px 12px;
  border-radius: 12px;
  background: #f4f8fd;
  line-height: 1.45;
}

.news-thanks {
  margin: 4px 0 0;
  line-height: 1.5;
}

.news-actions {
  justify-self: stretch;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.news-actions .transform-btn {
  width: 100%;
}

.news-ext {
  justify-self: stretch;
  font-size: 14px;
  display: grid;
  gap: 8px;
  line-height: 1.45;
}

.news-ext p {
  margin: 0;
}

.news-ext-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.news-ext-links a {
  font-weight: 800;
  color: #2e4057;
}

/* ---------------------------------------------------------------- flashcards in sets (long documents) */

.fc-sets {
  display: grid;
  gap: 8px;
  margin: 4px 0 6px;
}

.fc-set-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fc-set-tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  background: #ffffff;
  color: #2e4057;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

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

.fc-set-now {
  font-weight: 800;
  color: #2e4057;
}

.fc-next {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f4f0fb;
  border: 1px solid #e2d6f3;
}

.fc-next-text {
  margin: 0;
  line-height: 1.45;
}

#fcLoadingText {
  white-space: pre-line;
}

/* The extension on an iPad, a phone, Safari or Firefox (lib/device.js) */
.ext-device-note {
  margin: 10px 0 0;
  max-width: 560px;
  line-height: 1.45;
}

/* ---------------------------------------------------------------- exam practice quiz: extras */

/* Chips that can be ticked together (question types, maths questions) */
.option-chip--check[aria-pressed="true"]::before {
  content: "✓ ";
}

.drop-zone--small {
  padding: 14px;
  min-height: 0;
}

.quiz-fresh-hint {
  margin: 8px 0 0;
  text-align: center;
}

/* Read aloud, text size, font, highlights: above a question and above the results */
.quiz-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.quiz-tool {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  background: #ffffff;
  color: #2e4057;
  font: 700 13px/1.2 "Nunito", system-ui, sans-serif;
  cursor: pointer;
}

.quiz-tool:hover:not(:disabled) {
  background: #f0f6ff;
}

.quiz-tool:disabled {
  opacity: 0.45;
  cursor: default;
}

.quiz-tool.is-on,
.quiz-tool-larf[aria-pressed="true"] {
  background: #eaf4ff;
  border-color: #5aa6e8;
}

/* The reading tools (lib/studyLook.js): 🔊 Read aloud, and "Aa" with a panel of named sections */
.look-bar {
  position: relative;
  align-items: center;
}

.look-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* A dot with the highlight colour in use */
.look-open::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--look-dot, transparent);
  border: 1px solid #9fb3c8;
}

.look-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: min(340px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(30, 50, 80, 0.18);
  font: 14px/1.4 "Nunito", system-ui, sans-serif;
  color: #2e4057;
}

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

.look-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.look-close {
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: #5a6f86;
}

.look-close:hover {
  background: #f0f6ff;
}

.look-section {
  display: grid;
  gap: 6px;
}

.look-section[hidden] {
  display: none;
}

.look-label {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6f86;
}

.look-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.look-step {
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #ffffff;
  font: 800 15px/1.2 "Nunito", system-ui, sans-serif;
  cursor: pointer;
}

.look-step:disabled {
  opacity: 0.4;
  cursor: default;
}

.look-size {
  min-width: 52px;
  text-align: center;
  font-weight: 800;
}

/* Spacing's value is a word (Normal, Wide…) */
.look-spacing {
  min-width: 84px;
}

/* With "More fonts" open the panel can get long: it scrolls */
.look-panel {
  max-height: min(72vh, 620px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.look-chip {
  font-size: 13px;
  padding: 5px 11px;
}

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

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

.look-voice {
  width: 100%;
  max-width: none;
}

/* The chosen text size and font, on the question and the answers (not on the buttons above) */
.quiz-styled .quiz-question,
.quiz-styled .quiz-options,
.quiz-styled .quiz-written,
.quiz-styled .quiz-feedback,
.quiz-styled .quiz-score-card,
.quiz-styled .quiz-review {
  zoom: var(--quiz-scale, 1);
}

/* The spacing between letters (− and + in the panel) */
.quiz-styled .quiz-question,
.quiz-styled .quiz-options,
.quiz-styled .quiz-written,
.quiz-styled .quiz-feedback,
.quiz-styled .quiz-review,
.quiz-styled .fc-face-text {
  letter-spacing: var(--quiz-letter, normal);
}

.quiz-own-font .quiz-question,
.quiz-own-font .quiz-options,
.quiz-own-font .quiz-options *,
.quiz-own-font .quiz-answer,
.quiz-own-font .quiz-feedback,
.quiz-own-font .quiz-feedback *,
.quiz-own-font .quiz-review,
.quiz-own-font .quiz-review * {
  font-family: var(--quiz-font) !important;
}

/* Smart highlights in the questions and answers (switch: .quiz-plain hides them) */
.quiz-styled mark {
  background-color: var(--quiz-mark, #e2abe24d) !important;
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.quiz-styled strong {
  font-weight: 800;
  color: #000000;
}

.quiz-styled u {
  text-decoration: underline;
  text-decoration-color: #000000;
  text-decoration-thickness: max(1px, 0.07em);
  text-underline-offset: 0.22em;
}

.quiz-plain mark {
  background: none !important;
  padding: 0;
}

.quiz-plain strong {
  font-weight: inherit;
  color: inherit;
}

.quiz-plain u {
  text-decoration: none;
}

.quiz-feedback-title {
  display: block;
}

/* 🤔 Why? and 📖 Define the concepts under a wrong answer */
.quiz-help {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.quiz-help-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiz-help-btn {
  border: 1px solid #cfe3fb;
  border-radius: 999px;
  padding: 6px 14px;
  background: #ffffff;
  color: #2e4057;
  font: 800 14px/1.2 "Nunito", system-ui, sans-serif;
  cursor: pointer;
}

.quiz-help-btn:hover:not(:disabled) {
  background: #eaf4ff;
}

.quiz-help-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

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

.quiz-help-answer {
  padding: 10px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e3eaf3;
  line-height: 1.5;
  color: #1f2a37;
}

.quiz-help-answer p,
.quiz-help-answer ul {
  margin: 0 0 6px;
}

.quiz-help-answer ul {
  padding-left: 20px;
}

.quiz-help-answer--define {
  background: #fbf8ff;
  border-color: #e2d6f3;
}

.quiz-help-later {
  margin: 0;
  font-size: 13px;
  color: #5b6b7d;
}

/* Read aloud on the quiz: the word being said (as in the Reader) */
::highlight(studybuddy-tts-word) {
  background-color: var(--tts-word, #ffd84d);
}

::highlight(studybuddy-tts-sentence) {
  background-color: var(--tts-sentence, rgba(90, 166, 232, 0.18));
}

::highlight(studybuddy-tts-sentence-only) {
  background-color: var(--tts-sentence-only, rgba(255, 216, 77, 0.75));
}

/* The chat's left edge: drag it (or use the arrow keys) to make the chat wider or narrower. (Only on
   wide screens: on a phone the chat slides in over the tool, positioned by the rules above.) */
@media (min-width: 901px) {
  .app-chat {
    position: relative;
  }
}

.chat-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 10px;
  z-index: 5;
  cursor: col-resize;
  touch-action: none;
}

.chat-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 4px;
  height: 44px;
  margin-top: -22px;
  border-radius: 4px;
  background: #c9d6e6;
  opacity: 0;
  transition: opacity 0.15s;
}

.app-chat:hover .chat-resizer::after,
.chat-resizer:focus-visible::after,
body.chat-resizing .chat-resizer::after {
  opacity: 1;
  background: #5aa6e8;
}

/* While dragging, the Reader frame mustn't catch the mouse */
body.chat-resizing {
  cursor: col-resize;
  user-select: none;
}

body.chat-resizing iframe {
  pointer-events: none;
}

@media (max-width: 900px) {
  .chat-resizer {
    display: none;
  }
}

/* "What's new", compact: short lines, small owl */
.news-dialog {
  max-width: 760px;
  gap: 8px;
  padding: 18px 22px 16px;
}

.news-dialog .owl-medium {
  width: 40px;
}

.news-dialog .reformat-title {
  margin: 0;
  font-size: 19px;
}

.news-list {
  gap: 6px;
}

.news-list li {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}

@media (min-width: 760px) {
  .news-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1150px) {
  .news-dialog {
    max-width: 920px;
  }

  .news-list {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.news-ext {
  padding: 8px 12px;
  font-size: 13px;
}

.news-thanks {
  margin: 0;
  font-size: 14px;
}

.news-actions .transform-btn {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Exam practice quiz: the number of questions, typed */
.quiz-count-own {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
  color: #2e4057;
}

.quiz-count-own input {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
}

.quiz-count-own input:focus {
  outline: 2px solid #5aa6e8;
  outline-offset: 1px;
}

.quiz-tool-voice {
  max-width: 220px;
}

/* The chat's hide / show tab: on the line between the tool and the chat, at mid-height; when the chat
   is hidden, the same tab sits at the right edge, at the same height. */
.chat-edge-tab {
  position: absolute;
  top: 50%;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 28px;
  height: 64px;
  margin: 0;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: #2e4057;
  font: 800 16px/1 "Nunito", system-ui, sans-serif;
  writing-mode: horizontal-tb;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.12);
  cursor: pointer;
}

.chat-edge-tab:hover {
  background: #f0f6ff;
}

.chat-edge-tab.chat-hide {
  display: none;
  right: calc(var(--chat-now, 400px) - 14px);
}

@media (min-width: 901px) {
  .workspace.has-chat:not(.chat-hidden) .chat-edge-tab.chat-hide {
    display: flex;
  }
}

.chat-edge-tab.chat-show {
  display: none; /* only while the chat is hidden (see .chat-hidden above) */
  right: 6px;
}

.chat-edge-tab.chat-show span {
  writing-mode: horizontal-tb;
  font-size: 14px;
}

@media (max-width: 900px) {
  .chat-edge-tab.chat-hide {
    display: none;
  }
}

/* The update popup: small, one message */
.news-dialog.news-dialog--small {
  max-width: 440px;
  justify-items: stretch;
  text-align: center;
}

.news-dialog--small .news-ext {
  text-align: left;
}

.news-date {
  margin: -4px 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #5b6b7d;
}

.news-see {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* The chapter or part a quiz question tests ("📍 From: Chapter 3") */
.quiz-kind-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.quiz-kind-row .quiz-kind {
  margin-bottom: 0;
}

.quiz-part-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef6ee;
  border: 1px solid #cfe6cf;
  color: #2f5d34;
  font-size: 12px;
  font-weight: 800;
}

.quiz-kind-row + .quiz-question {
  margin-top: 10px;
}

/* A maths question of the results: ask the chat, or solve it step by step */
.quiz-math-row {
  margin-top: 8px;
}

/* ---------------------------------------------------------------- phones */
@media (max-width: 480px) {
  .app-bar {
    gap: 6px;
    padding: 0 10px;
  }

  /* The owl stays; the name goes, so every button fits */
  body[data-screen="workspace"] .app-brand span {
    display: none;
  }

  .app-brand {
    font-size: 16px;
    gap: 6px;
  }

  /* The quiz's reading tools: smaller, the voice menu narrower */
  .quiz-tool {
    padding: 5px 10px;
    font-size: 12px;
  }

  .quiz-tool-voice {
    max-width: 150px;
  }
}

/* Phones: the menu and the chat wait outside the screen until they slide in; the page must not scroll
   sideways to them. */
@media (max-width: 900px) {
  .workspace {
    overflow: clip;
  }
}

/* ---------------------------------------------------------------- Make a diagram */

.panel.right[data-view="diagram"] .diagram-view {
  display: block;
}

/* The diagram above, the document underneath (when a box is clicked) */
.panel.right[data-view="diagram-result"] .diagram-result-view {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.doc-bar-back {
  border: 1px solid #c07bdc;
  background: #f7ecfb;
  color: #6b2f8a;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.doc-bar-back:hover {
  background: #f2d8f3;
}

/* Step 1: the kinds, as big cards with a small example */
.dg-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.dg-type {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 4px;
  padding: 10px 10px 12px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dg-type:hover {
  border-color: #b6d2ee;
  box-shadow: var(--shadow);
}

.dg-type[aria-checked="true"] {
  border-color: #c07bdc;
  background: #fcf6fe;
  box-shadow: 0 0 0 3px #f2d8f3;
}

.dg-type-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 112px;
  overflow: hidden;
  border-radius: 12px;
  background: #f6f9fc;
  font-size: 6.5px;
  pointer-events: none;
}

.dg-type-name {
  margin-top: 4px;
  font-weight: 800;
  font-size: 15px;
}

.dg-type-icon {
  display: inline-block;
  min-width: 1.4em;
  color: #a774d2;
  font-weight: 900;
}

.dg-type-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

/* Step 1: the parts, chapters with their sections */
.dg-parts {
  max-height: 340px;
}

.dg-chapter {
  display: grid;
  gap: 6px;
}

.dg-chapter-toggle {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #f6f9fc;
  border-radius: 999px;
  padding: 2px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #35618f;
  cursor: pointer;
}

.dg-chapter-toggle::after {
  content: " ▾";
}

.dg-chapter-toggle[aria-expanded="true"]::after {
  content: " ▴";
}

.dg-sections {
  display: grid;
  gap: 6px;
  margin-left: 26px;
}

.dg-part--section {
  font-size: 13.5px;
  padding-block: 6px;
}

.dg-part input:disabled + .quiz-part-title {
  color: var(--muted);
}

.dg-hint-warn {
  color: #a5641b;
  font-weight: 700;
}

/* Step 2 */
.dg-result {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px max(16px, calc((100% - 1100px) / 2)) 32px;
}

.dg-head {
  margin: 10px 0 8px;
}

.dg-title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.dg-from {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
}

.dg-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
}

.dg-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.dg-zoom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.dg-zoom button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-radius: 999px;
  background: #f0f6ff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.dg-zoom button:hover {
  background: #d6ecff;
}

.dg-zoom span {
  min-width: 44px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.dg-click-hint {
  margin: 4px 0 8px;
}

.dg-stage {
  display: flex;
  justify-content: safe center;
  align-items: flex-start;
  overflow: auto;
  min-height: 260px;
  padding: 24px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfdff;
}

/* The drawing (lib/diagramDraw.js): sizes in em, so the zoom is the font size */
.dg-canvas {
  position: relative;
  flex: 0 0 auto;
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1em;
  line-height: 1.3;
}

.dg-canvas--outline,
.dg-canvas--timeline {
  flex: 1 1 auto;
  max-width: 50em;
}

.dg-lines {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}

.dg-line {
  fill: none;
  stroke: #9db7d3;
  stroke-width: var(--dg-stroke, 2px);
}

.dg-line--cross {
  stroke: #a774d2;
  stroke-dasharray: 6 5;
}

.dg-brace {
  stroke: #5aa6e8;
  stroke-width: calc(var(--dg-stroke, 2px) * 1.25);
  stroke-linecap: round;
}

.dg-head {
  fill: #8aa6c4;
}

.dg-node {
  position: relative;
  z-index: 1;
  max-width: 15em;
  padding: 0.45em 0.8em;
  border: 2px solid #9db7d3;
  border-radius: 0.8em;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 1em;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(44, 62, 80, 0.06);
  transition: transform 0.12s, box-shadow 0.12s;
}

.dg-node:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.14);
}

.dg-node:focus-visible {
  outline: 3px solid #5aa6e8;
  outline-offset: 2px;
}

.dg-node.is-picked {
  outline: 3px solid #ffcf3f;
  outline-offset: 2px;
}

.dg-depth-0 {
  border-color: #3d8fd6;
  background: #5aa6e8;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.15em;
}

.dg-depth-1 {
  border-color: #5aa6e8;
  background: #e8f2fd;
  font-weight: 800;
}

.dg-depth-2 {
  border-color: #c07bdc;
  background: #f7ecfb;
}

.dg-depth-3 {
  border-color: #5fb47f;
  background: #ecf7f0;
}

.dg-depth-4 {
  border-color: #dba54a;
  background: #fdf5e6;
}

/* Boxes inside a list or table: just the words */
.dg-node--plain {
  max-width: none;
  padding: 0.15em 0.35em;
  border: none;
  border-radius: 0.4em;
  background: transparent;
  color: inherit;
  font-weight: inherit;
  font-size: 1em;
  text-align: left;
  box-shadow: none;
}

.dg-node--plain:hover {
  transform: none;
  background: #eef5fd;
  box-shadow: none;
}

.dg-link {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 11em;
  margin-bottom: 0.35em;
  padding: 0 0.3em;
  background: #fbfdff;
  color: #6b7785;
  font-size: 0.8em;
  font-style: italic;
  text-align: center;
}

.dg-cross-label {
  position: absolute;
  z-index: 2;
  margin: 0;
  color: #8a4fb3;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

/* Concept map: from the top down */
.dg-v-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dg-v-kids {
  display: flex;
  align-items: flex-start;
  gap: 1.3em;
  margin-top: 2.4em;
}

/* The last ideas of a branch, one under the other, with the line down their left side */
.dg-v-kids--stack {
  flex-direction: column;
  gap: 0.6em;
  margin-top: 1.6em;
  padding-left: 1.3em;
}

.dg-v-kids--stack > .dg-v-branch {
  flex-direction: row;
  align-items: center;
  gap: 0.4em;
}

.dg-v-kids--stack > .dg-v-branch > .dg-link {
  margin: 0;
  text-align: left;
}

.dg-v-kids--stack .dg-node {
  max-width: 12em;
  text-align: left;
}

/* Braces and arrows: from left to right */
.dg-h-branch {
  display: flex;
  align-items: center;
}

.dg-h-branch > .dg-node {
  flex: 0 0 auto;
  text-align: left;
}

.dg-h-join {
  flex: 0 0 auto;
  align-self: stretch;
  width: 2em;
}

.dg-canvas--arrows .dg-h-join {
  width: 3.2em;
}

.dg-h-kids {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55em;
  padding: 0.3em 0;
}

/* Numbered outline */
.dg-outline-title {
  margin-bottom: 0.6em;
}

.dg-outline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dg-outline-list .dg-outline-list {
  padding-left: 1.8em;
}

.dg-outline-row {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  padding: 0.12em 0;
}

.dg-outline-num {
  flex: 0 0 auto;
  min-width: 2.2em;
  color: #3d8fd6;
  font-weight: 900;
}

.dg-outline-1 > .dg-outline-item > .dg-outline-row {
  margin-top: 0.5em;
  font-size: 1.08em;
  font-weight: 800;
}

.dg-outline-1 > .dg-outline-item > .dg-outline-row .dg-outline-num {
  color: #a774d2;
}

/* Comparison table */
.dg-table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #d5e2ef;
  border-radius: 0.8em;
  overflow: hidden;
  background: #ffffff;
}

.dg-table th,
.dg-table td {
  min-width: 8em;
  max-width: 18em;
  padding: 0.45em 0.6em;
  border-bottom: 1px solid #e3e9f0;
  border-right: 1px solid #e3e9f0;
  text-align: left;
  vertical-align: top;
}

.dg-table thead th {
  background: #5aa6e8;
  color: #ffffff;
  font-weight: 900;
}

.dg-table tbody th {
  background: #f7ecfb;
  font-weight: 800;
}

.dg-table tr > :last-child {
  border-right: none;
}

.dg-table tbody tr:last-child > * {
  border-bottom: none;
}

/* Timeline: one under the other */
.dg-timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dg-timeline::before {
  content: "";
  position: absolute;
  top: 0.4em;
  bottom: 0.4em;
  left: 7.15em;
  width: 3px;
  border-radius: 3px;
  background: #d6ecff;
}

.dg-event {
  position: relative;
  display: grid;
  grid-template-columns: 6.4em minmax(0, 1fr);
  align-items: center;
  gap: 1.6em;
  margin: 0.55em 0;
}

.dg-event::before {
  content: "";
  position: absolute;
  left: 6.85em;
  top: 50%;
  width: 0.8em;
  height: 0.8em;
  margin-top: -0.4em;
  border: 3px solid #5aa6e8;
  border-radius: 50%;
  background: #ffffff;
  z-index: 1;
}

.dg-event-date {
  color: #8a4fb3;
  font-weight: 900;
  text-align: right;
  overflow-wrap: anywhere;
}

.dg-event .dg-node {
  justify-self: start;
  max-width: 28em;
  text-align: left;
}

/* Make a diagram: the document is a column on the right; the chat floats (web/app.js) */
.dg-peek {
  position: relative;
  display: none;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #ffffff;
  border-left: 1px solid var(--line);
}

.workspace.dg-doc-open .dg-peek {
  display: flex;
}

.dg-peek .dg-peek-resizer {
  z-index: 6;
}

.dg-peek:hover .dg-peek-resizer::after,
.dg-peek-resizer:focus-visible::after {
  opacity: 1;
  background: #5aa6e8;
}

@media (min-width: 901px) {
  /* The diagram alone, or with the document as the right column (half and half; its edge resizes it) */
  .workspace.dg-float,
  .workspace.dg-float.has-chat,
  .workspace.dg-float.has-chat.chat-hidden {
    grid-template-columns: var(--nav-width, 250px) minmax(0, 1fr);
  }

  .workspace.dg-float.nav-hidden,
  .workspace.dg-float.nav-hidden.has-chat,
  .workspace.dg-float.nav-hidden.has-chat.chat-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace.dg-float.dg-doc-open,
  .workspace.dg-float.has-chat.dg-doc-open,
  .workspace.dg-float.has-chat.chat-hidden.dg-doc-open {
    grid-template-columns: var(--nav-width, 250px) minmax(0, 1fr) var(--dg-doc-width, minmax(0, 1fr));
  }

  .workspace.dg-float.nav-hidden.dg-doc-open,
  .workspace.dg-float.nav-hidden.has-chat.dg-doc-open,
  .workspace.dg-float.nav-hidden.has-chat.chat-hidden.dg-doc-open {
    grid-template-columns: minmax(0, 1fr) var(--dg-doc-width, minmax(0, 1fr));
  }

  /* The chat: a window over the page, moved by its top bar, resized by its corner */
  .workspace.dg-float .app-chat,
  .workspace.dg-float.chat-hidden .app-chat {
    position: fixed;
    z-index: 60;
    display: flex;
    min-width: 300px;
    min-height: 280px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border: 1px solid #cfdcea;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(31, 42, 55, 0.25);
    resize: both;
    overflow: hidden;
  }

  .workspace.dg-float.float-chat-closed .app-chat {
    display: none !important;
  }

  .workspace.dg-float .app-chat .right-top {
    cursor: move;
    user-select: none;
    touch-action: none;
  }

  .workspace.dg-float .chat-close {
    display: grid;
  }

  .workspace.dg-float .chat-edge-tab,
  .workspace.dg-float .app-chat .chat-resizer {
    display: none !important;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .workspace.dg-float,
  .workspace.dg-float.has-chat,
  .workspace.dg-float.has-chat.chat-hidden {
    grid-template-columns: var(--nav-width, 220px) minmax(0, 1fr);
  }

  .workspace.dg-float.dg-doc-open,
  .workspace.dg-float.has-chat.dg-doc-open,
  .workspace.dg-float.has-chat.chat-hidden.dg-doc-open {
    grid-template-columns: var(--nav-width, 220px) minmax(0, 1fr) var(--dg-doc-width, minmax(0, 1fr));
  }
}

/* Narrow screens: the document slides in from the right (the chat slides over it, as usual) */
@media (max-width: 900px) {
  .workspace.dg-doc-open .dg-peek {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 19;
    width: min(420px, 100vw);
    box-shadow: 0 10px 30px rgba(31, 42, 55, 0.18);
  }

  .dg-peek .dg-peek-resizer {
    display: none;
  }
}

/* "💬 Chat with Whalia" at the bottom of the diagram, when the floating chat is closed */
.dg-chat-bubble {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(120deg, #5aa6e8, #a774d2);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(44, 62, 80, 0.25);
  cursor: pointer;
}

.dg-chat-bubble:hover {
  filter: brightness(1.05);
}

.dg-peek-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f9fc;
  font-size: 14px;
}

.dg-peek-title {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dg-peek-note {
  flex-basis: 100%;
  order: 3;
  color: #a5641b;
  font-weight: 700;
  font-size: 13px;
}

.dg-peek-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  /* Under the title and ×, so the title isn't cut short */
  flex-basis: 100%;
  order: 2;
}

.dg-peek-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 999px;
  padding: 4px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #2e4057;
  cursor: pointer;
}

.dg-peek-btn:hover {
  background: #f0f6ff;
  border-color: #b6d2ee;
}

.dg-peek-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #e3e9f0;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.dg-peek-close:hover {
  background: #d3dce6;
}


/* ⛶ Full screen: the diagram over everything */
.dg-full-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: #2e4057;
  cursor: pointer;
}

.dg-full-btn:hover {
  background: #f0f6ff;
  border-color: #b6d2ee;
}

/* 📝 Explanations: On / Off */
.dg-onoff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.dg-onoff-label {
  margin-right: 2px;
  font-size: 14px;
  font-weight: 800;
  color: #2e4057;
  white-space: nowrap;
}

.dg-onoff .option-chip {
  margin: 0;
  padding: 4px 12px;
}

/* A box: its words, then (with the explanations shown) its explanation in small letters */
.dg-node-text {
  display: block;
}

.dg-key {
  font-size: 0.85em;
}

.dg-note {
  display: block;
  margin-top: 0.3em;
  padding-top: 0.3em;
  border-top: 1px dashed rgba(44, 62, 80, 0.18);
  color: #3f4b58;
  font-size: 0.9em;
  font-weight: 500;
  line-height: 1.35;
}

.dg-depth-0 .dg-note {
  color: #eef6ff;
  border-top-color: rgba(255, 255, 255, 0.45);
}

.dg-node--plain .dg-note {
  margin-top: 0.1em;
  padding-top: 0;
  border-top: none;
}

/* With explanations, the boxes are a little wider */
.dg-canvas--notes .dg-node {
  max-width: 18em;
}

.dg-canvas--notes .dg-v-kids--stack .dg-node {
  max-width: 15em;
}

.dg-peek-explain {
  flex-basis: 100%;
  order: 4;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff8db;
  border: 1px solid #f3e1a0;
  font-size: 14px;
  line-height: 1.4;
}

.dg-full {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  background: #fbfdff;
}

.dg-full[hidden] {
  display: none;
}

.dg-full-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.dg-full-title {
  flex: 1 1 160px;
  min-width: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dg-full-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #e3e9f0;
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.dg-full-close:hover {
  background: #d3dce6;
}

.dg-full-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.dg-full-body .dg-stage {
  flex: 1 1 auto;
  min-height: 0;
  border: none;
  border-radius: 0;
}

body.dg-full-open {
  overflow: hidden;
}

.dg-peek-body {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 560px) {
  .dg-types {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dg-type {
    padding: 8px;
  }

  .dg-type-preview {
    height: 84px;
    font-size: 4.8px;
  }

  .dg-type-name {
    font-size: 14px;
  }

  .dg-type-hint {
    font-size: 12px;
  }

  .dg-title {
    font-size: 20px;
  }

  .dg-stage {
    padding: 16px 10px;
  }

  .dg-peek-btn {
    padding: 4px 9px;
    font-size: 12.5px;
  }
}

/* 🖨️ Print or save as PDF: only the diagram */
@media screen {
  #dgPrint {
    display: none;
  }
}

@media print {
  html,
  body {
    height: auto !important;
    overflow: visible !important;
    background: #ffffff !important;
  }

  body > *:not(#dgPrint) {
    display: none !important;
  }

  #dgPrint {
    display: block;
    font-family: "Nunito", system-ui, sans-serif;
    color: #1f2a37;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #dgPrint h1 {
    margin: 0 0 2px;
    font-size: 22px;
  }

  #dgPrint p {
    margin: 0 0 14px;
    color: #7c8794;
    font-size: 12px;
  }

  #dgPrint .dg-node {
    box-shadow: none;
  }
}

/* A new feature someone asked for (web/app.js) */
.feature-text {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.55;
  text-align: left;
}

/* What 📌 means, over the diagram */
.dg-pin-hint {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff8db;
  border: 1px solid #f3e1a0;
  font-size: 14px;
  line-height: 1.45;
}

/* Under a diagram, at the top of the chat: back to the document */
.chat-to-doc {
  flex: 0 0 auto;
  border: 1px solid #b6d2ee;
  background: #f0f6ff;
  color: #2e4057;
  border-radius: 999px;
  padding: 4px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.chat-to-doc:hover {
  background: #d6ecff;
}

/* Over the Reader: only "← Back to the diagram" or an error (Change document is in the Reader's ⋯ More). */
.doc-bar--slim :is(.doc-bar-icon, .doc-bar-text, .doc-bar-change) {
  display: none;
}

/* The extension's install page, at the bottom of the menu */
a.nav-item.nav-ext {
  text-decoration: none;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* A tool's document step once there is a document: "Using: name  [Change]" */
.file-using {
  color: #5a6f86;
  font-weight: 600;
}

.file-info .file-change {
  width: auto;
  height: auto;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

/* Quiz: with a file already in, the upload box is one line ("+ Add another file") */
.drop-zone.is-compact {
  padding: 10px 14px;
  min-height: 0;
}

.drop-zone.is-compact > :not(.drop-text) {
  display: none;
}

.drop-zone.is-compact .drop-text {
  font-size: 14px;
}

/* Leaving a tool for the start page: "Stay here" is the big button; leaving is the quieter one. */
.leave-go {
  border: 1px solid #e4b4b4;
  background: #fff;
  color: #a12a2a;
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
}

.leave-go:hover,
.leave-go:focus-visible {
  background: #fdf0f0;
}

/* 💬 Feedback: the "Can you help?" popup's quieter choices, and the questions. */
.fb-later,
.fb-never {
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 999px;
}

.fb-later {
  font-weight: 600;
}

.fb-never {
  color: var(--muted);
  font-size: 14px;
}

.fb-later:hover,
.fb-never:hover {
  background: var(--bg);
}

.fb-dialog {
  max-width: 600px;
  max-height: calc(100vh - 32px);
}

.fb-dialog #feedbackForm {
  display: grid;
  gap: 14px;
}

.fb-dialog #feedbackForm[hidden] {
  display: none;
}

.fb-q {
  border: 0;
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  min-width: 0;
}

.fb-q legend {
  padding: 0;
  float: left;
  width: 100%;
  font-weight: 700;
  line-height: 1.35;
}

.fb-q legend + * {
  clear: both;
}

.fb-q legend small {
  font-weight: 400;
  color: var(--muted);
}

.fb-chips,
.fb-scale-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fb-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.fb-chip:hover {
  border-color: var(--accent);
}

.fb-chip[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 700;
}

.fb-chip--num {
  min-width: 40px;
  text-align: center;
  padding: 7px 0;
}

.fb-scale-row--11 .fb-chip--num {
  min-width: 34px;
  flex: 1 1 0;
}

.fb-scale-ends {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.fb-text {
  width: 100%;
  min-height: 0;
}

.fb-explain {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

/* Chat start: what selecting text in the document does, with a small picture of the menu. */
.select-tip {
  margin-top: 14px;
  width: 100%;
  border: 1px dashed #cfe3fb;
  background: #f7fbff;
  border-radius: 14px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  color: #2e4057;
}

.select-tip-title {
  font-weight: 700;
  font-size: 14px;
}

.select-tip-demo {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.select-tip-text mark {
  background: #b9dcff;
  border-radius: 3px;
  padding: 1px 2px;
}

.select-tip-menu {
  display: inline-grid;
  gap: 4px;
  background: #fff;
  border: 1px solid #cfe3fb;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.12);
}

.select-tip-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe7f7;
  background: #f7fbff;
  border-radius: 9px;
  padding: 3px 8px;
  font-size: 12px;
}

.select-tip-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #d4e4f7;
  font-size: 10px;
  color: #7d6fd0;
}

.select-tip-sub {
  color: #5b6b7d;
}

.select-tip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.select-tip-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.select-tip-list .select-tip-icon {
  flex: none;
  width: 22px;
  height: 22px;
  font-size: 12px;
}

/* Flashcards: the tab between term and definition in the "looks like this" example. */
.fc-tab {
  display: inline-block;
  margin: 0 8px;
  color: #8a96a3;
}

/* Diagrams: ✏️ Edit text on, and the box being typed in. */
.dg-edit-btn[aria-pressed='true'] {
  background: #fff4cc;
  border-color: #e8c34a;
}

.dg-node--editable {
  cursor: text;
  outline: 1px dashed #e8c34a;
  outline-offset: 2px;
}

.dg-edit {
  display: block;
  width: 12em;
  max-width: 100%;
  min-height: 1.6em;
  resize: none;
  overflow: hidden;
  font: inherit;
  font-size: 1em;
  line-height: 1.3;
  text-align: center;
  color: inherit;
  background: #fff;
  border: 1px solid #e8c34a;
  border-radius: 6px;
  padding: 2px 4px;
}

.dg-edit-hint {
  color: #8a6d00;
}

/* 📝 Summary at the top right of the chat (Read a document). */
.chat-summary-btn {
  flex: 0 0 auto;
  margin-left: auto;
  border: 1px solid #b6d2ee;
  background: #f0f6ff;
  color: #2e4057;
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.chat-summary-btn:hover {
  background: #d6ecff;
}

.chat-summary-btn[hidden] {
  display: none;
}

/* 🍅 Study timer: the switch in the menu, the 🍅 in the top bar and its card (lib/timer.js). */
.nav-switch {
  cursor: pointer;
}

.nav-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-switch-track {
  margin-left: auto;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d5dde6;
  position: relative;
  transition: background 0.15s ease;
}

.nav-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.nav-switch input:checked + .nav-switch-track {
  background: #e05a4f;
}

.nav-switch input:checked + .nav-switch-track .nav-switch-thumb {
  transform: translateX(14px);
}

.nav-switch input:focus-visible + .nav-switch-track {
  outline: 2px solid #5aa6e8;
  outline-offset: 2px;
}

.timer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  min-width: 38px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.timer-btn[hidden],
.timer-btn-time[hidden] {
  display: none;
}

.timer-btn--running {
  background: #fdecea;
  border-color: #f2b8b2;
  color: #a5352b;
}

.timer-btn--running.timer-btn--break {
  background: #e8f6ee;
  border-color: #b5e0c6;
  color: #23784a;
}

.timer-card {
  position: fixed;
  z-index: 1500;
  width: 350px;
  max-width: calc(100vw - 16px);
  background: #c95b52;
  color: #fff;
  border-radius: 18px;
  padding: 12px 14px 14px;
  box-shadow: 0 16px 36px rgba(31, 42, 55, 0.28);
  display: grid;
  gap: 10px;
  font-family: 'Nunito', system-ui, sans-serif;
}

.timer-card[data-mode='short'] {
  background: #3f8f8a;
}

.timer-card[data-mode='long'] {
  background: #3d7aa8;
}

.timer-card[hidden] {
  display: none;
}

.timer-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-modes {
  display: flex;
  gap: 2px;
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
}

.timer-mode {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.85;
}

.timer-mode[aria-selected='true'] {
  background: rgba(0, 0, 0, 0.18);
  opacity: 1;
}

.timer-close {
  border: 0;
  background: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.timer-time {
  text-align: center;
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.timer-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.timer-go {
  border: 0;
  background: #fff;
  color: #c95b52;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 8px 28px;
  border-radius: 10px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.timer-card[data-mode='short'] .timer-go {
  color: #3f8f8a;
}

.timer-card[data-mode='long'] .timer-go {
  color: #3d7aa8;
}

.timer-go:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.timer-reset {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.timer-reset[hidden] {
  display: none;
}

.timer-message {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.timer-message[hidden] {
  display: none;
}

/* The message has its own start button: the big one waits. */
.timer-message:not([hidden]) + .timer-actions {
  display: none;
}

.timer-message p {
  margin: 0;
  font-weight: 700;
}

.timer-message-go {
  border: 0;
  background: #fff;
  color: #1f2a37;
  font: inherit;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.timer-today {
  text-align: center;
  font-size: 13px;
  opacity: 0.95;
}

.timer-settings summary {
  cursor: pointer;
  font-size: 13px;
  opacity: 0.9;
  text-align: center;
}

.timer-minutes {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.timer-minute {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.timer-minute input {
  width: 64px;
  font: inherit;
  font-weight: 700;
  color: #1f2a37;
  background: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 3px 6px;
  text-align: center;
}

/* Phones: while the timer shows its time, the owl stands for StudyBuddy (its name makes room). */
@media (max-width: 480px) {
  body:has(#timerBtnTime:not([hidden])) .app-brand span {
    display: none;
  }
}

/* The 🍅 (and its card) only inside the tools, not on the start page or the "your document" screen. */
body:not([data-screen='workspace']) #timerBtn,
body:not([data-screen='workspace']) #timerCard {
  display: none;
}

/* ---------------------------------------------------------------- flashcards: study them here */

.panel.right[data-view="flashcards-study"] .flashcards-study-view {
  display: block;
}

/* The cards' list: ☆ above the × */
.fc-card-side {
  display: grid;
  gap: 4px;
  justify-items: center;
}

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

.fc-list-star:hover {
  background: #fff8db;
}

.fc-study-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 10px;
}

.fc-study-choice .transform-btn {
  margin: 0;
}

.fc-study-btn {
  background: linear-gradient(135deg, #7b5cd6, #5aa6e8);
}

.fc-study-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.fc-study-top .back-btn {
  margin: 0;
}

.fc-study-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.fc-study-saved {
  margin: 0 0 10px;
}

/* The two ways, and all / starred: two-part switches */
.fc-study-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.fc-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: #f4f8fd;
}

.fc-seg button {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: transparent;
  color: #2e4057;
  font: 700 14px/1.2 "Nunito", system-ui, sans-serif;
  cursor: pointer;
}

.fc-seg button[aria-pressed="true"] {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(30, 50, 80, 0.15);
  color: #1d3a5c;
}

.fc-study-progress {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  color: #5a6f86;
  margin: 4px 0 6px;
}

.fc-study-status {
  margin: 8px 0 0;
  color: #5a6f86;
  font-size: 13px;
}

/* The card: it turns up or down (rotateX), like the arrow keys */
.fc-stage {
  position: relative;
  margin: 16px 0 14px;
}

.fc-flip {
  perspective: 1400px;
  cursor: pointer;
  outline: none;
  border-radius: 22px;
}

.fc-flip:focus-visible {
  box-shadow: 0 0 0 3px #8ec5ff;
}

/* Big, like Quizlet's: the study column is wider than the other tools', and every card has the same
   size (16:10, about 880 × 550 on a computer), with an image or without. */
.workspace-main .flashcards-study-view {
  padding-left: max(16px, calc((100% - 880px) / 2));
  padding-right: max(16px, calc((100% - 880px) / 2));
}

.workspace-main .fc-study {
  max-width: 880px;
}

.fc-flip-inner {
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 300px;
  max-height: max(320px, calc(100vh - 420px)); /* the buttons under it stay in sight on a laptop */
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.fc-flip-inner.no-anim {
  transition: none;
}

.fc-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 28px 28px;
  border-radius: 22px;
  border: 1px solid #d6e2f0;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(30, 50, 80, 0.12);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: center;
  overflow: auto;
}

.fc-back {
  transform: rotateX(180deg);
  background: #fbfaff;
}

.fc-face-tag {
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a9bb0;
}

.fc-face-text {
  font-size: 24px;
  line-height: 1.5;
  color: #1d2b3a;
  zoom: var(--quiz-scale, 1);
  max-width: 34em;
}

.fc-back .fc-face-text {
  font-size: 21px;
}

/* A phone: taller than wide would leave little room for the text, so a fixed height instead */
@media (max-width: 600px) {
  .fc-flip-inner {
    aspect-ratio: auto;
    height: 420px;
  }
}

/* The card's image on top, whole (its own shape, never stretched or cut), as big as the card leaves
   room for; the question under it. */
.fc-face.has-image {
  justify-content: flex-start;
  padding-top: 40px;
  overflow: hidden;
}

.fc-face-image {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.fc-face.has-image .fc-face-text {
  flex: 0 1 auto;
  max-height: 45%;
  overflow: auto;
  font-size: 21px;
}

/* 🖼 on a card being changed: "Add image", or the image small with Change / Remove */
.fc-image-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.fc-image-thumb {
  width: 96px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #d6e2f0;
  border-radius: 8px;
  background: #f6f9fc;
}

.fc-image-remove {
  color: #b4234a;
}

.fc-text-only {
  margin-top: 10px;
}

.quiz-own-font .fc-face-text,
.quiz-own-font .fc-face-text * {
  font-family: var(--quiz-font) !important;
}

.fc-star {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #c9a227;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.fc-star:hover {
  background: #fff8db;
}

/* ✏️ next to the star: change this card */
.fc-edit {
  position: absolute;
  top: 8px;
  right: 54px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.fc-edit:hover {
  background: #eaf4ff;
}

.fc-edit:focus-visible,
.fc-star:focus-visible {
  outline: 3px solid #8ec5ff;
}

/* Changing a card (or a new one): the editor in place of the card */
.fc-stage.is-editing .fc-flip,
.fc-stage.is-editing .fc-star,
.fc-stage.is-editing .fc-edit {
  display: none;
}

.fc-study-play:has(.fc-stage.is-editing) .fc-study-controls,
.fc-study-play:has(.fc-stage.is-editing) .fc-study-below {
  display: none;
}

.fc-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  border: 2px solid #8ec5ff;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(30, 50, 80, 0.1);
}

.fc-editor[hidden] {
  display: none;
}

.fc-editor-title {
  margin: 0;
  font-size: 17px;
  color: #2e4057;
}

.fc-editor .fc-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 17px;
  resize: vertical;
}

.fc-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.fc-editor-actions .transform-btn {
  width: auto;
  margin: 0;
  padding-inline: 26px;
}

.fc-editor-delete {
  margin-left: auto;
  color: #b3261e;
}

/* "All the cards" under the card: closed at first */
.fc-study-all {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #e3ebf5;
}

.fc-all-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d6e2f0;
  border-radius: 14px;
  background: #f6f9fe;
  color: #2e4057;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.fc-all-toggle:hover {
  background: #eaf4ff;
  border-color: #5aa6e8;
}

.fc-all-caret {
  width: 1em;
  color: #5aa6e8;
}

.fc-all-box {
  margin-top: 12px;
}

/* Moving on: a short slide, green or red in "Know it or not" */
.fc-go-next .fc-flip { animation: fc-in-right 0.25s ease-out; }
.fc-go-prev .fc-flip { animation: fc-in-left 0.25s ease-out; }
.fc-go-know .fc-flip { animation: fc-in-right 0.3s ease-out, fc-glow-yes 0.6s ease-out; }
.fc-go-learning .fc-flip { animation: fc-in-left 0.3s ease-out, fc-glow-no 0.6s ease-out; }

@keyframes fc-in-right {
  from { transform: translateX(40px); opacity: 0.3; }
  to { transform: none; opacity: 1; }
}

@keyframes fc-in-left {
  from { transform: translateX(-40px); opacity: 0.3; }
  to { transform: none; opacity: 1; }
}

@keyframes fc-glow-yes {
  from { box-shadow: 0 0 0 4px #3fb37f; }
  to { box-shadow: 0 0 0 0 transparent; }
}

@keyframes fc-glow-no {
  from { box-shadow: 0 0 0 4px #e0795f; }
  to { box-shadow: 0 0 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .fc-flip-inner { transition: none; }
  .fc-go-next .fc-flip,
  .fc-go-prev .fc-flip,
  .fc-go-know .fc-flip,
  .fc-go-learning .fc-flip { animation: none; }
}

.fc-study-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
}

.fc-ctrl {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  background: #ffffff;
  color: #2e4057;
  font: 800 15px/1.2 "Nunito", system-ui, sans-serif;
  cursor: pointer;
}

.fc-ctrl:hover:not(:disabled) {
  background: #f0f6ff;
}

.fc-ctrl:disabled {
  opacity: 0.4;
  cursor: default;
}

.fc-ctrl-turn {
  padding-inline: 18px;
}

.fc-ctrl-yes {
  border-color: #9fdcbf;
  background: #effaf4;
  color: #1f6b47;
}

.fc-ctrl-yes:hover:not(:disabled) {
  background: #dff4e9;
}

.fc-ctrl-no {
  border-color: #f0c1b4;
  background: #fdf3ef;
  color: #9b3b22;
}

.fc-ctrl-no:hover:not(:disabled) {
  background: #fbe5dd;
}

.fc-study-below {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.fc-study-keys {
  margin-left: auto;
  font-size: 13px;
  color: #6b7d92;
}

.fc-study-end {
  text-align: center;
  padding: 20px 8px;
}

.fc-end-owl {
  font-size: 44px;
}

.fc-end-actions {
  display: grid;
  gap: 10px;
  max-width: 420px;
  margin: 16px auto 0;
}

.fc-end-actions .transform-btn {
  margin: 0;
}

.fc-end-all {
  background: #ffffff;
  color: #2e4057;
  border: 1px solid var(--line);
}

.fc-study-empty {
  text-align: center;
  color: #5a6f86;
  padding: 30px 10px;
}

@media (max-width: 600px) {
  .fc-flip-inner { min-height: 220px; }
  .fc-face-text { font-size: 20px; }
  .fc-back .fc-face-text { font-size: 18px; }
  .fc-seg button { padding: 6px 10px; font-size: 13px; }
  .fc-study-keys { display: none; }
}

/* The 🔄 Change document menu floats next to whichever "Change" opened it (app.js places it) */
.doc-menu.doc-menu--floating {
  position: fixed;
  right: auto;
  z-index: 1000;
  font-size: 13px;
  color: #2e4057;
}

/* "Aa Text & highlights ▾": the arrow turns up while its panel is open */
.look-caret {
  order: 3;
  font-size: 15px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.look-open[aria-expanded="true"] {
  background: #eaf4ff;
  border-color: #5aa6e8;
}

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

/* Under ⬇ Download the cards: what the file is for (lit up once downloaded) */
.fc-saved-hint {
  margin: 8px 0 0;
}

.fc-saved-hint.is-done {
  padding: 8px 12px;
  border-radius: 12px;
  background: #effaf4;
  border: 1px solid #9fdcbf;
  color: #1f6b47;
}


/* Whalia, with its slogan under the name (only where there's room) */
.app-brand-name {
  display: inline-grid;
  line-height: 1.05;
  text-align: left;
}

.app-brand-slogan {
  font-size: 11px;
  font-weight: 700;
  color: #7d8ea3;
  letter-spacing: 0.01em;
}

/* Always there (one line), smaller on phones; only the narrowest screens leave it out. */
.app-brand-slogan {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .app-brand-slogan {
    font-size: 10px;
  }
}

/* Phones: the slogan on two short lines under the name. */
@media (max-width: 520px) {
  .app-brand-slogan {
    white-space: normal;
    max-width: 128px;
    font-size: 9.5px;
    line-height: 1.2;
  }
}

@media (max-width: 359px) {
  .app-brand-slogan {
    display: none;
  }
}

/* "Chat with Whalia", and under it "your Study Buddy" */
.chat-panel-title {
  display: inline-grid;
  line-height: 1.15;
}

.chat-panel-title small,
.lp-chat-name small {
  font-size: 11px;
  font-weight: 700;
  color: #7d8ea3;
}

.lp-chat-name {
  display: inline-grid;
  line-height: 1.15;
}

/* 🖼 Pictures in the chat: the button next to Send, the previews above the box, and in a sent question */
.chat-attach-btn {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d6e2f2;
  border-radius: 10px;
  background: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.chat-attach-btn:hover {
  background: #eef4ff;
  border-color: #b9cdee;
}
.chat-attach-btn:focus-visible {
  outline: 3px solid #b4c8f0;
  outline-offset: 2px;
}
.chat-attach-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 10px 0;
}
.chat-attach-strip[hidden] {
  display: none;
}
.chat-attach-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #d6e2f2;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(44, 62, 80, 0.08);
}
.chat-attach-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.chat-attach-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 42, 55, 0.72);
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.chat-attach-note {
  font-size: 12px;
  color: #a54949;
}
.chat-msg-pictures {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chat-msg-pictures img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  object-fit: cover;
}

/* pdf.js measures text on a canvas it adds to the page; its own stylesheet (not used here) hides it,
   otherwise it shows as a black box. */
.hiddenCanvasElement {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  display: none;
}

/* A settings label with the yellow ⓘ right after it (Reformat a file: Highlight colour) */
.option-label--info {
  display: flex;
  align-items: center;
  gap: 8px;
}
