:root {
  --font-main: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #17211d;
  --muted: #62736b;
  --line: #dce4e0;
  --accent: #0f8b6f;
  --accent-dark: #096450;
  --warn: #b76e00;
  --danger: #b42318;
  --shadow: 0 16px 35px rgba(23, 33, 29, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  --page-x: clamp(18px, 5vw, 64px);
  --workspace-bg: #07110e;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
}

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

button {
  cursor: pointer;
}

.home-page {
  min-height: 100vh;
  padding: 24px var(--page-x);
  background: var(--workspace-bg);
  color: #f9fffc;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: clamp(28px, 5vw, 58px);
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 0;
}

.home-nav-actions {
  display: flex;
  align-items: center;
  gap: clamp(20px, 4vw, 42px);
  position: relative;
  padding-left: clamp(22px, 4vw, 36px);
}

.home-nav-actions::before {
  position: absolute;
  left: 0;
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.22);
  content: "";
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.site-nav-link {
  position: relative;
  color: #9fb8ae;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}

.site-nav-link::after {
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: #62d7b1;
  content: "";
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 160ms ease, transform 160ms ease;
}

.site-nav-link:hover {
  color: #c3f3df;
}

.site-nav-link[aria-current="page"] {
  color: #f9fffc;
}

.site-nav-link:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

.site-nav-link[aria-current="page"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-left: auto;
  padding: 5px 10px 5px 6px;
  border: 1px solid rgba(98, 215, 177, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(249, 255, 252, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.theme-toggle-icon {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #62d7b1;
}

.theme-toggle-icon::before {
  display: none;
}

.theme-toggle:hover {
  border-color: rgba(98, 215, 177, 0.34);
  color: #f9fffc;
}

.home-placeholder {
  display: grid;
  min-height: calc(100vh - 128px);
  place-items: center;
}

.home-video-panel {
  position: relative;
  width: min(100%, 980px);
  overflow: hidden;
  padding: 10px;
  border: 1px solid rgba(98, 215, 177, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

.home-video-panel video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: calc(var(--radius) - 4px);
  object-fit: cover;
}

.home-video-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 18px;
  row-gap: 4px;
  align-items: center;
  padding: 16px 6px 4px;
}

.home-video-copy span {
  color: #62d7b1;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-video-copy h1,
.home-video-copy p {
  margin: 0;
}

.home-video-copy h1 {
  margin-top: 0;
  color: #f9fffc;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.12;
}

.home-video-copy p {
  grid-column: 2;
  color: rgba(249, 255, 252, 0.68);
  line-height: 1.6;
}

.coming-soon-panel {
  width: min(100%, 520px);
  padding: 30px;
  border: 1px solid rgba(98, 215, 177, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.coming-soon-panel span {
  color: #62d7b1;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.coming-soon-panel h1,
.coming-soon-panel p {
  margin: 0;
}

.coming-soon-panel h1 {
  margin-top: 12px;
  color: #f9fffc;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.12;
}

.coming-soon-panel p {
  margin-top: 12px;
  color: rgba(249, 255, 252, 0.58);
  line-height: 1.7;
}

.auth-dialog {
  width: min(calc(100% - 32px), 420px);
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: transparent;
  color: #f9fffc;
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

.auth-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(98, 215, 177, 0.22);
  border-radius: var(--radius);
  background: #0b1814;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.auth-card h2,
.auth-card p {
  margin: 0;
}

.auth-kicker {
  color: #62d7b1;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-card h2 {
  margin-top: 6px;
  font-size: 26px;
}

.auth-card label {
  color: rgba(249, 255, 252, 0.72);
}

.auth-card input {
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f9fffc;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.auth-error {
  min-height: 20px;
  color: #ffb4ab;
  font-size: 13px;
  font-weight: 700;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.template-library {
  display: grid;
  gap: 14px;
}

.template-library article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.template-library p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.templates-page {
  min-height: 100vh;
  padding: 24px var(--page-x);
  background: var(--workspace-bg);
  color: #f9fffc;
}

.tools-page {
  min-height: 100vh;
  padding: 24px var(--page-x);
  background: var(--workspace-bg);
  color: #f9fffc;
  font-size: 15px;
}

.templates-topbar,
.templates-shell,
.tools-shell {
  margin: 0 auto;
}

.templates-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1240px;
  padding: 8px 0;
}

.templates-shell,
.tools-shell {
  max-width: 1180px;
}

.templates-shell,
.tools-shell {
  padding: clamp(34px, 6vw, 62px) 0;
}

.tools-shell {
  max-width: min(100%, 1480px);
  padding-top: clamp(24px, 4vw, 42px);
}

.templates-shell {
  max-width: min(100%, 1480px);
  padding-top: clamp(24px, 4vw, 42px);
}

.templates-head,
.tools-head {
  max-width: 680px;
  margin-bottom: 24px;
}

.templates-head h1,
.templates-head p,
.tools-head h1,
.tools-head p,
.template-library h2,
.template-library p {
  margin: 0;
}

.templates-head h1,
.tools-head h1 {
  margin-top: 8px;
  color: #f9fffc;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
}

.templates-head p,
.tools-head p {
  margin-top: 12px;
  color: rgba(249, 255, 252, 0.58);
  line-height: 1.7;
}

.templates-page .eyebrow,
.templates-page .template-library span,
.tools-page .eyebrow {
  color: #62d7b1;
}

.templates-page .template-library article {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
}

.templates-page .template-library h2 {
  color: #f9fffc;
}

.templates-page .template-library p {
  color: rgba(249, 255, 252, 0.58);
}

.template-library {
  grid-template-columns: 1fr;
  height: 100%;
}

.template-library article {
  min-height: 0;
  overflow: hidden;
}

.template-library article[hidden] {
  display: none;
}

.template-library span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.template-library h2 {
  margin-top: 16px;
  font-size: 22px;
}

.template-copy-card {
  grid-column: 1 / -1;
  height: 100%;
  min-height: 0;
}

.templates-page .template-library .template-copy-card {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.template-copy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.template-copy-head h2 {
  margin-top: 0;
}

.template-copy-card textarea {
  width: 100%;
  height: calc(var(--tool-panel-height) - 110px);
  max-height: calc(var(--tool-panel-height) - 110px);
  min-height: 0;
  margin-top: 12px;
  border: 1px solid rgba(98, 215, 177, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-sizing: border-box;
  color: rgba(249, 255, 252, 0.82);
  font: inherit;
  line-height: 1.6;
  overflow: auto;
  padding: 16px;
  resize: none;
}

.template-workspace .tool-panel {
  height: var(--tool-panel-height);
  min-height: 0;
  overflow: hidden;
}

.template-panel .tool-panel-head h1 {
  margin: 6px 0 0;
  color: #f9fffc;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.1;
}

.template-menu .tool-option {
  text-decoration: none;
}

.tools-workspace {
  --tool-content-height: clamp(300px, 36vh, 380px);
  --tool-panel-height: clamp(678px, 78vh, 720px);
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tools-menu,
.tool-panel,
.tool-output {
  border: 1px solid rgba(98, 215, 177, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
}

.tools-menu {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.tool-option {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
  background: transparent;
  color: rgba(249, 255, 252, 0.72);
  text-align: left;
}

.tool-option.active,
.tool-option:hover {
  border-color: rgba(98, 215, 177, 0.26);
  background: rgba(98, 215, 177, 0.08);
  color: #f9fffc;
}

.tool-option span,
.tool-panel .eyebrow {
  color: #62d7b1;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.tool-panel .eyebrow {
  margin: 0;
}

.tool-option strong {
  font-size: 16px;
}

.tool-panel {
  height: var(--tool-panel-height);
  min-height: 0;
  overflow: hidden;
  padding: 22px;
}

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

.tool-panel-head,
.tool-output-head,
.tool-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tool-panel-head {
  margin-bottom: 18px;
}

.tool-description {
  max-width: 520px;
  margin: 8px 0 0;
  color: rgba(249, 255, 252, 0.58);
  line-height: 1.6;
}

.tool-panel-head h2,
.tool-output h3 {
  margin: 0;
  color: #f9fffc;
}

.tool-panel-head h2 {
  margin-top: 6px;
  font-size: clamp(24px, 3.4vw, 34px);
}

.tool-panel-head > span {
  border: 1px solid rgba(98, 215, 177, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  color: #62d7b1;
  font-size: 12px;
  font-weight: 900;
}

.tool-form {
  display: grid;
  gap: 14px;
}

#text-diff {
  display: flex;
  flex-direction: column;
}

#text-diff[hidden] {
  display: none;
}

#text-diff .tool-form {
  flex: 1;
  min-height: 0;
}

.tool-form label {
  display: grid;
  gap: 8px;
  color: rgba(249, 255, 252, 0.72);
  font-weight: 800;
}

.tool-form textarea,
.tool-form input,
.tool-form select {
  width: 100%;
  border: 1px solid rgba(98, 215, 177, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: #f9fffc;
  padding: 12px;
}

.tool-form input {
  min-height: 44px;
}

.tool-form input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.tool-form input[type="number"]::-webkit-outer-spin-button,
.tool-form input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.tool-form textarea {
  min-height: 140px;
  resize: vertical;
}

.tool-form textarea::placeholder {
  color: rgba(249, 255, 252, 0.42);
}

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

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

.diff-input-grid label {
  min-height: 0;
  overflow: hidden;
}

.diff-editor {
  height: calc(var(--tool-panel-height) - 180px);
  max-height: calc(var(--tool-panel-height) - 180px);
  min-height: 0;
  border: 1px solid rgba(98, 215, 177, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(249, 255, 252, 0.72);
  overflow: auto;
  padding: 12px;
  font-family: var(--font-main);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  caret-color: #f9fffc;
  outline: none;
}

.diff-editor:empty::before {
  color: rgba(249, 255, 252, 0.42);
  content: attr(data-placeholder);
}

.tool-actions {
  justify-content: flex-start;
}

.tool-output {
  margin-top: 18px;
  padding: 16px;
}

.tool-output textarea {
  width: 100%;
  height: var(--tool-content-height);
  min-height: 0;
  margin: 14px 0 0;
  border: 0;
  background: transparent;
  white-space: pre-wrap;
  color: rgba(249, 255, 252, 0.72);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  overflow: auto;
  resize: none;
}

.diff-line {
  display: block;
  min-height: 1.6em;
  margin: 0 -4px;
  border-radius: 4px;
  padding: 0 4px;
  white-space: pre;
}

.diff-line.added {
  border: 1px solid rgba(98, 215, 177, 0.18);
  background: rgba(98, 215, 177, 0.14);
  color: #d7fff0;
}

.diff-line.removed {
  border: 1px solid rgba(255, 180, 171, 0.18);
  background: rgba(255, 180, 171, 0.14);
  color: #ffd6d1;
}

.diff-line.unchanged {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.035);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: #10231d;
  color: #f9fffc;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: inherit;
  text-decoration: none;
}

.brand:hover h1 {
  color: #c3f3df;
}

.brand-logo {
  display: block;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  object-fit: cover;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(23, 33, 29, 0.16);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p {
  color: #b8c9c2;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #f9fffc;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav strong {
  color: #e6c15a;
  font-size: 12px;
}

.ghost-btn,
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 9px 12px;
  text-decoration: none;
}

.ghost-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: #f9fffc;
  text-align: center;
}

.primary-btn {
  background: var(--accent);
  color: #ffffff;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.nav-link {
  white-space: nowrap;
}

.app-shell {
  margin-left: 292px;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
}

.search-wrap {
  flex: 1;
  max-width: 460px;
}

.search-wrap input,
select,
form input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.search-wrap input,
select,
form input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 170px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 111, 0.14);
}

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

.stats-grid article {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stats-grid strong {
  display: block;
  font-size: 30px;
}

.stats-grid span {
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mode-btn {
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 6px 16px rgba(23, 33, 29, 0.08);
}

.toolbar select {
  width: 210px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(315px, 1fr));
  gap: 16px;
}

.note-card,
.flashcard,
.quiz-panel,
.editor-view form,
.paste-panel,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.note-card {
  display: flex;
  min-height: 278px;
  flex-direction: column;
  padding: 18px;
}

.note-card.review {
  border-color: rgba(183, 110, 0, 0.45);
}

.note-card.done {
  border-color: rgba(15, 139, 111, 0.5);
}

.card-meta,
.flashcard-head,
.quiz-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-meta span,
.flashcard-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.note-card h3 {
  margin: 14px 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.note-card p,
.answer-body,
.quiz-panel p,
.paste-panel p {
  color: #3c4d45;
  line-height: 1.6;
}

.answer-body p {
  margin: 0 0 10px;
}

.answer-body ul,
.answer-body ol {
  margin: 0 0 10px 20px;
  padding: 0;
}

.answer-body li {
  margin: 5px 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

.card-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  padding: 6px 10px;
}

.card-actions button.selected {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.card-actions button[data-action="delete"] {
  margin-left: auto;
  color: var(--danger);
}

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 139, 111, 0.28);
  border-radius: var(--radius);
  background: rgba(15, 139, 111, 0.08);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.edit-banner button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 4px 9px;
}

.study-view {
  max-width: 900px;
}

.flashcard,
.quiz-panel {
  padding: 24px;
}

.flashcard h3,
.quiz-panel h3 {
  margin: 24px 0 14px;
  font-size: 26px;
  line-height: 1.25;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.quiz-head {
  align-items: start;
}

.quiz-head h3 {
  margin-top: 4px;
}

.quiz-head strong {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-2);
}

details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfcfc;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

.editor-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 16px;
}

.editor-view form,
.paste-panel {
  padding: 18px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.paste-panel h3 {
  margin: 0 0 8px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.study-hub-page {
  --workspace-rail: max(var(--page-x), calc((100vw - 1240px) / 2));
  min-height: 100vh;
  padding: 24px var(--page-x);
  background: var(--workspace-bg);
  color: #f9fffc;
}

.study-hub-page .home-nav {
  margin-bottom: 24px;
}

.study-hub-page .sidebar {
  inset: 116px auto 0 var(--workspace-rail);
  width: 260px;
  padding: 0 22px 24px 0;
  background: transparent;
  border-right: 1px solid rgba(98, 215, 177, 0.12);
}

.study-hub-page .app-shell {
  max-width: calc(1240px - 292px);
  margin-left: calc(var(--workspace-rail) + 292px - var(--page-x));
  padding: 0 0 28px 28px;
}

.study-hub-page .topbar {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(98, 215, 177, 0.12);
}

.study-hub-page .topbar h2,
.study-hub-page .note-card h3,
.study-hub-page .flashcard h3,
.study-hub-page .quiz-panel h3,
.study-hub-page .paste-panel h3 {
  color: #f9fffc;
}

.study-hub-page .nav button {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(249, 255, 252, 0.78);
}

.study-hub-page .nav button:hover,
.study-hub-page .nav button.active {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #f9fffc;
}

.study-hub-page .nav strong,
.study-hub-page .eyebrow {
  color: #62d7b1;
}

.study-hub-page .stats-grid article,
.study-hub-page .note-card,
.study-hub-page .flashcard,
.study-hub-page .quiz-panel,
.study-hub-page .editor-view form,
.study-hub-page .paste-panel,
.study-hub-page .empty-state {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
}

.study-hub-page .search-wrap input,
.study-hub-page select,
.study-hub-page form input,
.study-hub-page textarea {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #f9fffc;
}

.study-hub-page input::placeholder,
.study-hub-page textarea::placeholder {
  color: rgba(249, 255, 252, 0.38);
}

.study-hub-page .stats-grid span,
.study-hub-page .card-meta span,
.study-hub-page .flashcard-head span,
.study-hub-page label,
.study-hub-page .mode-btn,
.study-hub-page .empty-state {
  color: rgba(249, 255, 252, 0.58);
}

.study-hub-page .note-card p,
.study-hub-page .answer-body,
.study-hub-page .quiz-panel p,
.study-hub-page .paste-panel p {
  color: rgba(249, 255, 252, 0.72);
}

.study-hub-page .segmented {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

.study-hub-page .mode-btn.active {
  background: rgba(98, 215, 177, 0.1);
  color: #f9fffc;
  box-shadow: none;
}

.study-hub-page .secondary-btn,
.study-hub-page .card-actions button,
.study-hub-page .edit-banner button {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #f9fffc;
}

.study-hub-page .primary-btn,
.study-hub-page .card-actions button.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.study-hub-page .primary-btn:hover {
  background: var(--accent-dark);
}

.study-hub-page .card-actions button[data-action="delete"] {
  color: #ffb4ab;
}

.study-hub-page .note-card.review {
  border-color: rgba(183, 110, 0, 0.55);
}

.study-hub-page .note-card.done {
  border-color: rgba(98, 215, 177, 0.45);
}

.study-hub-page .edit-banner {
  border-color: rgba(98, 215, 177, 0.22);
  background: rgba(98, 215, 177, 0.08);
  color: #c3f3df;
}

.study-hub-page .quiz-head strong,
.study-hub-page details {
  border-color: rgba(98, 215, 177, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: #f9fffc;
}

.back-to-top {
  position: fixed;
  right: clamp(18px, 4vw, 42px);
  bottom: clamp(18px, 4vw, 36px);
  z-index: 30;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(98, 215, 177, 0.22);
  border-radius: 50%;
  background: rgba(11, 24, 20, 0.92);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.back-to-top::before {
  width: 11px;
  height: 11px;
  border-top: 3px solid #62d7b1;
  border-left: 3px solid #62d7b1;
  content: "";
  transform: translateY(3px) rotate(45deg);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: rgba(98, 215, 177, 0.42);
  background: #0f231d;
}

html[data-theme="light"] body {
  --workspace-bg: #f4f7f2;
  --surface: #ffffff;
  --surface-2: #e9f1ec;
  --text: #17211d;
  --muted: #65746d;
  --line: #d8e3dd;
  --shadow: 0 18px 46px rgba(23, 33, 29, 0.08);
}

html[data-theme="light"] .home-page,
html[data-theme="light"] .templates-page,
html[data-theme="light"] .tools-page,
html[data-theme="light"] .study-hub-page {
  color: #17211d;
}

html[data-theme="light"] .home-nav-actions::before {
  background: rgba(23, 33, 29, 0.18);
}

html[data-theme="light"] .site-nav-link {
  color: #65746d;
}

html[data-theme="light"] .site-nav-link:hover,
html[data-theme="light"] .site-nav-link[aria-current="page"],
html[data-theme="light"] .home-brand,
html[data-theme="light"] .coming-soon-panel h1,
html[data-theme="light"] .templates-head h1,
html[data-theme="light"] .template-panel .tool-panel-head h1,
html[data-theme="light"] .templates-page .template-library h2,
html[data-theme="light"] .tools-head h1,
html[data-theme="light"] .study-hub-page .topbar h2,
html[data-theme="light"] .study-hub-page .note-card h3,
html[data-theme="light"] .study-hub-page .flashcard h3,
html[data-theme="light"] .study-hub-page .quiz-panel h3,
html[data-theme="light"] .study-hub-page .paste-panel h3 {
  color: #17211d;
}

html[data-theme="light"] .templates-head p,
html[data-theme="light"] .templates-page .template-library p,
html[data-theme="light"] .tools-head p,
html[data-theme="light"] .tool-description,
html[data-theme="light"] .tool-option,
html[data-theme="light"] .tool-option small,
html[data-theme="light"] .tool-form label,
html[data-theme="light"] .tool-output textarea,
html[data-theme="light"] .coming-soon-panel p,
html[data-theme="light"] .study-hub-page .stats-grid span,
html[data-theme="light"] .study-hub-page .card-meta span,
html[data-theme="light"] .study-hub-page .flashcard-head span,
html[data-theme="light"] .study-hub-page label,
html[data-theme="light"] .study-hub-page .mode-btn,
html[data-theme="light"] .study-hub-page .empty-state,
html[data-theme="light"] .study-hub-page .note-card p,
html[data-theme="light"] .study-hub-page .answer-body,
html[data-theme="light"] .study-hub-page .quiz-panel p,
html[data-theme="light"] .study-hub-page .paste-panel p {
  color: #65746d;
}

html[data-theme="light"] .study-hub-page input::placeholder,
html[data-theme="light"] .study-hub-page textarea::placeholder {
  color: rgba(101, 116, 109, 0.72);
}

html[data-theme="light"] .coming-soon-panel,
html[data-theme="light"] .home-video-panel,
html[data-theme="light"] .templates-page .template-library article,
html[data-theme="light"] .tools-menu,
html[data-theme="light"] .tool-panel,
html[data-theme="light"] .tool-output,
html[data-theme="light"] .study-hub-page .stats-grid article,
html[data-theme="light"] .study-hub-page .note-card,
html[data-theme="light"] .study-hub-page .flashcard,
html[data-theme="light"] .study-hub-page .quiz-panel,
html[data-theme="light"] .study-hub-page .editor-view form,
html[data-theme="light"] .study-hub-page .paste-panel,
html[data-theme="light"] .study-hub-page .empty-state {
  border-color: #d8e3dd;
  background: #ffffff;
  box-shadow: var(--shadow);
}

html[data-theme="light"] .home-video-copy {
  background: transparent;
}

html[data-theme="light"] .home-video-copy h1 {
  color: #17211d;
}

html[data-theme="light"] .home-video-copy p {
  color: #65746d;
}

html[data-theme="light"] .theme-toggle,
html[data-theme="light"] .tool-form textarea,
html[data-theme="light"] .tool-form input,
html[data-theme="light"] .tool-form select,
html[data-theme="light"] .template-copy-card textarea,
html[data-theme="light"] .study-hub-page .nav button,
html[data-theme="light"] .study-hub-page .segmented,
html[data-theme="light"] .study-hub-page .secondary-btn,
html[data-theme="light"] .study-hub-page .card-actions button,
html[data-theme="light"] .study-hub-page .edit-banner button,
html[data-theme="light"] .study-hub-page .quiz-head strong,
html[data-theme="light"] .study-hub-page details,
html[data-theme="light"] .study-hub-page .search-wrap input,
html[data-theme="light"] .study-hub-page select,
html[data-theme="light"] .study-hub-page form input,
html[data-theme="light"] .study-hub-page textarea {
  border-color: #d8e3dd;
  background: rgba(255, 255, 255, 0.78);
  color: #17211d;
}

html[data-theme="light"] .study-hub-page .nav button:hover,
html[data-theme="light"] .study-hub-page .nav button.active,
html[data-theme="light"] .study-hub-page .mode-btn.active {
  border-color: rgba(15, 139, 111, 0.24);
  background: #e9f1ec;
  color: #17211d;
}

html[data-theme="light"] .tool-option.active,
html[data-theme="light"] .tool-option:hover {
  border-color: rgba(15, 139, 111, 0.24);
  background: #e9f1ec;
  color: #17211d;
}

html[data-theme="light"] .tool-panel-head h2,
html[data-theme="light"] .tool-output h3 {
  color: #17211d;
}

html[data-theme="light"] .tool-form textarea::placeholder {
  color: rgba(101, 116, 109, 0.62);
}

html[data-theme="light"] .diff-editor {
  border-color: #d8e3dd;
  background: rgba(255, 255, 255, 0.78);
  color: #17211d;
  caret-color: #17211d;
}

html[data-theme="light"] .diff-editor:empty::before {
  color: rgba(101, 116, 109, 0.62);
}

html[data-theme="light"] .diff-line.added {
  border-color: rgba(15, 139, 111, 0.14);
  background: rgba(15, 139, 111, 0.1);
  color: #145746;
}

html[data-theme="light"] .diff-line.removed {
  border-color: rgba(180, 35, 24, 0.12);
  background: rgba(180, 35, 24, 0.08);
  color: #8f2018;
}

html[data-theme="light"] .diff-line.unchanged {
  background: rgba(23, 33, 29, 0.04);
}

html[data-theme="light"] .theme-toggle-icon {
  background: #f0c95b;
}

html[data-theme="light"] .auth-dialog {
  color: #17211d;
}

html[data-theme="light"] .auth-dialog::backdrop {
  background: rgba(23, 33, 29, 0.38);
}

html[data-theme="light"] .auth-card {
  border-color: #d8e3dd;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(23, 33, 29, 0.16);
}

html[data-theme="light"] .auth-card h2 {
  color: #17211d;
}

html[data-theme="light"] .auth-card label {
  color: #65746d;
}

html[data-theme="light"] .auth-card input {
  border-color: #d8e3dd;
  background: #f9fffc;
  color: #17211d;
}

html[data-theme="light"] .auth-error {
  color: #b42318;
}

html[data-theme="light"] .back-to-top {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 46px rgba(23, 33, 29, 0.12);
}

.hidden {
  display: none !important;
}

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

  .tools-workspace {
    grid-template-columns: 1fr;
  }

  .tool-panel {
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: static;
    width: auto;
    max-height: none;
  }

  .app-shell {
    margin-left: 0;
    padding: 18px;
  }

  .study-hub-page .sidebar {
    position: static;
    width: auto;
    padding: 0 0 18px;
    border-right: 0;
  }

  .study-hub-page .app-shell {
    margin-left: 0;
    padding: 0;
  }

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

  .search-wrap,
  .toolbar select {
    max-width: none;
    width: 100%;
  }

  .stats-grid,
  .editor-view,
  .form-row,
  .tool-form-row,
  .diff-input-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .home-page,
  .templates-page,
  .tools-page,
  .study-hub-page {
    padding: 18px;
  }

  .study-hub-page {
    --workspace-rail: 18px;
  }

  .study-hub-page .sidebar {
    padding: 26px 18px 24px var(--workspace-rail);
  }

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

  .home-nav {
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
  }

  .home-nav-actions {
    flex-wrap: wrap;
    gap: 18px;
  }

  .home-placeholder {
    min-height: auto;
    padding-top: 36px;
    place-items: start stretch;
  }

  .home-video-panel {
    padding: 8px;
  }

  .home-video-copy {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 6px 4px;
  }

  .home-video-copy h1,
  .home-video-copy p {
    grid-column: auto;
  }

  .home-video-copy h1 {
    font-size: 20px;
  }

  .home-video-copy p {
    font-size: 14px;
    line-height: 1.45;
  }

  .templates-topbar .secondary-btn {
    width: 100%;
  }

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

  .stats-grid {
    gap: 10px;
  }

  .topbar h2,
  .flashcard h3,
  .quiz-panel h3 {
    font-size: 22px;
  }

  .card-actions button {
    flex: 1 1 auto;
  }

  .card-actions button[data-action="delete"] {
    margin-left: 0;
  }
}
