:root {
  --body-bg: #f8f6f4;
  --body-bg-warm: #f5f2ef;
  --body-bg-cool: #f2f4f6;
  --body-bg-lilac: #f4f2f5;
  --text-primary: #2d2a33;
  --text-secondary: #5e5868;
  --text-tertiary: #918a9a;
  --learn-base: #fdf5f3;
  --learn-mid: #f0ccc6;
  --learn-deep: #dba8a0;
  --learn-text: #5a3835;
  --review-base: #f3f7fb;
  --review-mid: #c8e0f0;
  --review-deep: #66a5ed;
  --review-text: #2a4055;
  --accent: #7758a3;
  --accent-hover: #5a4080;
  --card-bg: rgba(255,255,255,0.66);
  --modal-bg: rgba(250,248,247,0.96);
  --divider: rgba(45,42,51,0.07);
  --header-bg: rgba(248,246,244,0.84);
  --input-bg: rgba(255,255,255,0.68);
  --input-border: rgba(94,88,104,0.22);
  --input-focus: #6b5070;
  --pink: #db3e8c;
  --blue: #66a5ed;
  --green: #99bf8e;
  --gold: #f6c45c;
  --stone: #8a8178;
  --red: #c97b7b;
  --shadow-soft: 0 4px 20px rgba(120,100,110,0.08);
  --shadow-hover: 0 8px 32px rgba(120,100,110,0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  color: var(--text-primary);
  background: var(--body-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 15% 25%, var(--body-bg-warm) 0%, transparent 70%),
    radial-gradient(ellipse 70% 50% at 85% 30%, var(--body-bg-cool) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 50% 85%, var(--body-bg-lilac) 0%, transparent 70%),
    var(--body-bg);
}

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

button {
  cursor: pointer;
}

.tool-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
}

.icon-btn:hover {
  background: rgba(107,80,112,0.1);
}

.icon-btn.danger {
  color: #a46169;
}

button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--input-focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.header,
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--divider);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header {
  padding: 12px 24px;
}

.topbar {
  padding: 12px 20px;
}

.header-left,
.header-right,
.brand,
.right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo,
.brand .emoji {
  font-size: 22px;
}

.app-title,
.brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand {
  background: linear-gradient(135deg, var(--accent), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand .emoji {
  -webkit-text-fill-color: initial;
}

.lang-badge,
.sync-chip {
  border: 1px solid var(--divider);
  border-radius: 20px;
  background: var(--input-bg);
  color: var(--text-secondary);
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
}

.back {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.back:hover {
  background: var(--input-bg);
  color: var(--accent);
}

.main {
  width: min(980px, calc(100vw - 32px));
  min-height: calc(100vh - 98px);
  margin: 0 auto;
  padding: 40px 0 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 42px;
}

.page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 30px;
}

.hero {
  text-align: center;
}

.hero h1 {
  margin-bottom: 12px;
  font-size: 36px;
  font-weight: 850;
  letter-spacing: 0;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-tertiary);
  font-size: 14px;
  letter-spacing: 0;
}

.hub-wordmark {
  padding: 18px 24px 6px;
}

.wordmark-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.hub-wordmark h1 {
  flex-shrink: 0;
  margin: 0;
  font-size: 56px;
  line-height: 1.25;
  background: linear-gradient(110deg, #228579 8%, #649a84 40%, #d67c87 73%, #e16b79 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.wordmark-stickers {
  width: 70px;
  height: 68px;
  position: relative;
  flex-shrink: 0;
}

.sticker-cheese {
  position: absolute;
  top: -4px;
  left: 0;
  font-size: 38px;
  line-height: 1;
  transform: rotate(-16deg);
}

.sticker-glasses {
  position: absolute;
  top: 30px;
  left: 27px;
  font-size: 32px;
  line-height: 1;
  transform: rotate(14deg);
}

.wordmark-signature {
  position: relative;
  flex-shrink: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-style: italic;
  line-height: 1.05;
  color: #728d82;
  text-align: left;
  transform: rotate(-7deg);
}

.sticker-sparkle {
  position: absolute;
  top: -14px;
  right: -28px;
  font-size: 23px;
  line-height: 1;
  transform: rotate(12deg);
}

.wordmark-motto {
  width: max-content;
  position: relative;
  margin: 16px auto 0;
  padding-bottom: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #7e988c;
}

.wordmark-stroke {
  position: absolute;
  width: 140px;
  height: 9px;
  left: -30px;
  bottom: 1px;
  border-bottom: 2px solid #b6d7c6;
  border-radius: 50%;
  transform: rotate(-5deg);
}

.hub-wordmark + .subject-grid .card-learn {
  background: linear-gradient(135deg, #f3fbf7, #d2e9df);
  border-color: #c1ddcd;
  color: #365d50;
}

.hub-wordmark + .subject-grid .card-review {
  background: linear-gradient(135deg, #fff6f6, #f2d3d7);
  border-color: #eac2c8;
  color: #724b53;
}

.hub-wordmark + .subject-grid .add-subject-card {
  background: #f9fcfa;
  border-color: #d6e5dc;
  color: #6a8274;
}

@media (max-width: 600px) {
  .hub-wordmark { padding: 14px 24px 6px 0; }
  .wordmark-line { gap: 8px; }
  .hub-wordmark h1 { font-size: 32px; }
  .wordmark-stickers { width: 44px; height: 50px; }
  .sticker-cheese { font-size: 28px; top: 0; }
  .sticker-glasses { font-size: 24px; top: 26px; left: 16px; }
  .wordmark-signature { font-size: 15px; }
  .sticker-sparkle { font-size: 19px; right: -22px; top: -12px; }
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
}

.subject-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.mode-grid {
  max-width: 840px;
  margin: 0 auto;
}

.card {
  min-height: 235px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 28px;
  padding: 40px 22px 32px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  color: inherit;
}

button.card {
  width: 100%;
  border-color: rgba(255,255,255,0.5);
}

.card:hover {
  transform: translateY(-5px) scale(1.01);
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  pointer-events: none;
  transition: opacity 0.3s;
}

.card::before {
  inset: 0;
  opacity: 0.7;
}

.card::after {
  width: 100%;
  height: 70%;
  bottom: 0;
  opacity: 0.52;
}

.card-learn {
  background: var(--learn-base);
  color: var(--learn-text);
}

.card-learn::before {
  background: radial-gradient(ellipse 120% 100% at 30% 20%, var(--learn-mid) 0%, transparent 65%);
}

.card-learn::after {
  right: 0;
  background: radial-gradient(ellipse 90% 80% at 75% 85%, var(--learn-deep) 0%, transparent 60%);
}

.card-review {
  background: var(--review-base);
  color: var(--review-text);
}

.card-review::before {
  background: radial-gradient(ellipse 120% 100% at 70% 20%, var(--review-mid) 0%, transparent 65%);
}

.card-review::after {
  left: 0;
  background: radial-gradient(ellipse 90% 80% at 25% 85%, var(--review-deep) 0%, transparent 60%);
}

.card-dashboard {
  background: #f7f4fb;
}

.card-dashboard::before {
  background: radial-gradient(ellipse 120% 100% at 40% 15%, #e6d8f0 0%, transparent 65%);
}

.card-dashboard::after {
  right: 0;
  background: radial-gradient(ellipse 90% 80% at 80% 85%, var(--accent) 0%, transparent 62%);
  opacity: 0.32;
}

.card-mark {
  background: var(--body-bg-lilac);
}

.card-mark::before {
  background: radial-gradient(ellipse 120% 100% at 50% 15%, #e0f0d8 0%, transparent 65%);
}

.card-mark::after {
  left: 10%;
  background: radial-gradient(ellipse 90% 80% at 50% 85%, var(--green) 0%, transparent 62%);
  opacity: 0.42;
}

.card-icon,
.card-title,
.card-desc,
.add-subject-card label,
.add-subject-card button {
  position: relative;
  z-index: 2;
}

.card-icon {
  font-size: 46px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.06));
}

.card-title {
  font-size: 20px;
  font-weight: 760;
}

.card-desc {
  max-width: 86%;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

.subject-card {
  padding: 0;
}

.subject-open {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 235px;
  padding: 48px 18px 32px;
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
}

.subject-controls {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 2px;
}

.subject-controls .icon-btn {
  background: rgba(255,255,255,0.45);
}

.add-subject-card .card-icon {
  display: flex;
}

.add-subject-card .tool-icon {
  width: 40px;
  height: 40px;
}

.add-subject-card {
  min-height: 235px;
  padding: 24px;
}

label {
  display: grid;
  gap: 6px;
  width: 100%;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(107,80,112,0.15);
}

.btn-primary,
.btn-secondary,
.modal-btns button,
.show-answer-main,
.result-buttons button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 750;
}

.btn-primary,
.modal-btns .primary,
.show-answer-main {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  width: auto;
  border: 1px solid var(--divider);
  background: var(--input-bg);
  color: var(--text-primary);
}

.footer {
  padding: 0 0 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  letter-spacing: 1px;
}

.mode-tabs {
  display: flex;
  margin: 12px 0 0;
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  overflow: hidden;
}

.mode-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 0;
  font-size: 14px;
  font-weight: 700;
}

.mode-tabs button.active {
  background: linear-gradient(135deg, var(--learn-mid) 0%, var(--learn-deep) 100%);
  color: #fff;
  border-radius: var(--radius);
}

.search-section {
  margin: 10px 0 8px;
}

.search-box {
  position: relative;
}

.search-box input {
  padding: 11px 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--learn-text);
  pointer-events: none;
}

.cat-section {
  padding: 0;
}

.cat-section h3 {
  margin: 8px 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 550;
}

.main-cats,
.sub-cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
  scrollbar-width: none;
}

.main-cats::-webkit-scrollbar,
.sub-cats::-webkit-scrollbar {
  display: none;
}

.main-cat-btn,
.sub-cat-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  background: transparent;
  color: var(--cat-color, var(--accent));
  border: 1.5px solid color-mix(in srgb, var(--cat-color, var(--accent)) 45%, white);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
}

.sub-cat-btn {
  border-radius: 14px;
  padding: 6px 10px;
  font-size: 11px;
}

.main-cat-btn.active,
.sub-cat-btn.active {
  background: var(--cat-color, var(--accent));
  border-color: var(--cat-color, var(--accent));
  color: #fff;
  transform: scale(1.03);
}

.cat-section {
  margin-bottom: 14px;
}

.category-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1.5px solid color-mix(in srgb, var(--cat-color) 45%, white);
  border-radius: 20px;
  color: var(--cat-color);
  padding-right: 2px;
}

.category-chip.active {
  background: var(--cat-color);
  border-color: var(--cat-color);
  color: #fff;
}

.category-chip .main-cat-btn,
.category-chip .sub-cat-btn {
  border: 0;
  background: transparent;
  color: inherit;
}

.category-chip .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: inherit;
}

.category-chip .icon-btn:hover {
  background: rgba(255,255,255,0.22);
}

.category-chip .tool-icon {
  width: 14px;
  height: 14px;
}

.subcategory-chip {
  border-radius: 14px;
}

.add-category-btn {
  border: 1.5px dashed var(--input-border);
  color: var(--learn-text);
}

.table-wrap {
  margin: 0 0 16px;
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow-x: auto;
  position: relative;
}

.table-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 80% at 30% 20%, var(--learn-base) 0%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
  position: relative;
  z-index: 1;
}

thead th {
  background: rgba(240,204,198,0.25);
  border-bottom: 2px solid rgba(94,88,104,0.1);
  color: var(--learn-text);
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}

.level-head {
  width: 64px;
}

.concept-table {
  min-width: 0;
}

.concept-head {
  width: 25%;
}

.delete-head {
  width: 50px;
}

.concept-table td {
  vertical-align: middle;
}

.concept-table tr {
  cursor: default;
}

.concept-link {
  display: block;
  width: 100%;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--text-primary);
  font-weight: 650;
  text-align: left;
  overflow-wrap: anywhere;
}

.concept-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.explanation-cell {
  color: var(--text-secondary);
}

.explanation-scroll {
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  padding: 2px 0 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--learn-mid) transparent;
  -webkit-overflow-scrolling: touch;
}

.explanation-scroll:focus-visible {
  outline: 1px solid var(--learn-deep);
  outline-offset: 2px;
}

.btn-pack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px;
  font-size: 13px;
}

.pack-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 20px 0;
  border-top: 1px solid var(--divider);
}

.pack-entry h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.pack-count {
  font-size: 13px;
  margin-bottom: 7px;
  color: var(--text-secondary);
}

.pack-topics {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.pack-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.pack-error {
  color: #a46169;
  font-size: 13px;
}

.concept-card-section a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.concept-table .delete-cell {
  padding: 5px;
  text-align: center;
}

tbody tr {
  border-bottom: 1px solid rgba(94,88,104,0.1);
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(240,204,198,0.12);
}

tbody td {
  height: 44px;
  padding: 9px 14px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  vertical-align: top;
}

.level-cell {
  text-align: center;
  padding-inline: 5px;
}

.status-dot {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,0.45);
}

.concept-tags small {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--text-tertiary);
  font-size: 11px;
}

.concept-tags small span {
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.38);
}

.empty-wrap {
  overflow: hidden;
}

.empty-msg {
  padding: 38px 16px;
  color: var(--text-tertiary);
  text-align: center;
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.actions {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  gap: 8px;
  padding: 12px 0;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--divider);
  overflow-x: auto;
}

.actions button {
  flex: 0 0 auto;
  width: 42px;
  height: 38px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 17px;
}

.actions .primary {
  background: linear-gradient(135deg, var(--learn-mid), var(--learn-deep));
  color: #fff;
  border-color: transparent;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(45,42,51,0.32);
  backdrop-filter: blur(8px);
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--modal-bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 22px;
}

.modal-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.modal-title-row h2 {
  color: var(--accent);
  font-size: 19px;
}

.close-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 18px;
}

.detail-form {
  display: grid;
  gap: 12px;
}

.management-modal {
  width: min(420px, 100%);
}

.card-tools {
  display: flex;
  gap: 4px;
}

.concept-card h2 {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.concept-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 18px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.concept-intro {
  font-size: 16px;
  line-height: 1.75;
  margin-bottom: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.concept-card-section {
  border-top: 1px solid var(--divider);
  padding-top: 14px;
  margin-top: 14px;
}

.concept-card-section h3 {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.concept-card-section p {
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.concept-tags {
  margin-top: 18px;
}

.extra-fields summary {
  cursor: pointer;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.extra-fields-body {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.delete-description {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.modal-btns .confirm-danger {
  background: #a46169;
  color: #fff;
}

.undo-toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 24px);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--modal-bg);
  box-shadow: var(--shadow-hover);
  padding: 8px 10px 8px 16px;
  font-size: 13px;
}

.undo-toast span:not(.tool-icon) {
  overflow-wrap: anywhere;
}

.undo-toast > button:not(.icon-btn) {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 650;
  flex-shrink: 0;
}

.inline-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text-primary);
}

.inline-check input {
  width: auto;
}

.modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.modal-btns button {
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--divider);
}

.modal-btns .danger {
  color: #9a4f25;
  border-color: rgba(201,123,123,0.45);
}

.review-setup,
.review-panel,
.card-like {
  width: min(720px, 100%);
  margin: 18px auto 0;
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  padding: 24px 20px;
}

.section {
  margin-bottom: 22px;
}

.section-header {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
}

.setup-note {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 14px;
}

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

.mode-btn {
  min-height: 72px;
  border: 1px solid #c4a8db;
  border-radius: 18px;
  background: #e6d8f0;
  color: #5a4a70;
  padding: 12px;
  font-weight: 750;
}

.mode-btn small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.review-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.back-btn,
.icon-back-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--input-border);
  border-radius: 50%;
  background: var(--input-bg);
  color: var(--text-primary);
}

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--input-border) 50%, transparent);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.review-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.review-badge {
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text-secondary);
  padding: 6px 11px;
  font-size: 13px;
}

.round-title {
  margin: 8px 0 12px;
  color: var(--accent);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.word-box {
  min-height: 190px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 14px 0 18px;
  padding: clamp(30px, 7vw, 58px) clamp(20px, 5vw, 44px);
  border: 1px solid #c4a8db;
  border-radius: 24px;
  background: linear-gradient(150deg, var(--card-bg), #f7f0fa);
  color: var(--text-primary);
  font-size: clamp(1.55rem, 4.5vw, 2.45rem);
  font-weight: 760;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.review-summary {
  color: var(--text-secondary);
  line-height: 1.75;
  text-align: center;
}

.simple-answer-box {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #c4a8db;
  border-radius: 18px;
  background: #f7f0fa;
  text-align: center;
}

.simple-answer-label {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.simple-answer-text {
  color: var(--text-primary);
  font-size: clamp(1.25rem, 4vw, 1.85rem);
  font-weight: 750;
  line-height: 1.45;
}

.hint-stack {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.hint-item {
  border: 1px solid #ead9a2;
  border-radius: 16px;
  background: #fff8df;
  color: #5a4a70;
  padding: 10px 12px;
  line-height: 1.55;
}

.hint-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.result-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.result-buttons button {
  flex: 1 1 calc(50% - 10px);
  min-width: 0;
  color: #fff;
}

.result-easy,
.result-remembered {
  background: #7fb069;
}

.result-hinted {
  background: #b99ac8;
}

.result-revealed {
  background: #9c8ba7;
}

.result-unknown {
  background: var(--red);
}

.dashboard-hero {
  margin: 20px 0;
}

.overview {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.compact-overview {
  grid-template-columns: repeat(4, 1fr);
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
}

.stat-card,
.panel {
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.stat-card {
  min-height: 92px;
  padding: 13px;
}

.stat-card .label {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 7px;
}

.stat-card .value {
  font-size: 27px;
  font-weight: 850;
}

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

.panel {
  padding: 17px;
  margin-bottom: 14px;
}

.panel h2 {
  margin-bottom: 13px;
  font-size: 17px;
}

.list {
  display: grid;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 13px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 7px;
}

.list-row:last-child {
  border-bottom: 0;
}

.history-table {
  margin-bottom: 0;
}

@media (max-width: 920px) {
  .cards-grid,
  .overview,
  .compact-overview,
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .lang-badge {
    display: none;
  }

  .pack-entry {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .pack-actions {
    justify-content: flex-end;
  }
  .header {
    padding: 11px 14px;
  }

  .main,
  .page {
    width: min(100vw - 20px, 520px);
  }

  .main {
    justify-content: flex-start;
    padding-top: 28px;
  }

  .cards-grid,
  .overview,
  .compact-overview,
  .grid-2,
  .mode-buttons {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 190px;
  }

  .subject-open {
    min-height: 190px;
  }

  .concept-table .level-head {
    width: 44px;
  }

  .concept-head {
    width: 27%;
  }

  .concept-table .delete-head {
    width: 42px;
  }

  .concept-table th,
  .concept-table td {
    padding: 9px 6px;
    font-size: 13px;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-box {
    padding: 18px;
    max-height: calc(100dvh - 24px);
  }

  .hero p {
    letter-spacing: 0;
    line-height: 1.7;
  }

  .mode-tabs {
    overflow-x: auto;
  }

  .mode-tabs button {
    min-width: 74px;
  }
}
.review-range { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin-top: 14px; }
.review-range-group { padding: 12px 0; border-bottom: 1px solid #e3dfe5; min-width: 0; }
.review-check { display: flex; align-items: center; gap: 8px; font-size: 14px; overflow-wrap: anywhere; }
.review-check input { width: 16px; height: 16px; flex: 0 0 16px; accent-color: #887fac; }
.category-check { font-weight: 600; margin-bottom: 10px; }
.review-subchecks { display: flex; flex-wrap: wrap; gap: 12px 18px; }
#review-count { width: 100%; max-width: 200px; padding: 10px; border: 1px solid #d7d0da; border-radius: 6px; background: white; font-size: 15px; }
.strict-options { display: grid; gap: 10px; margin: 20px 0; }
.strict-option { width: 100%; text-align: left; padding: 14px 16px; border: 1px solid #d4c6e5; border-radius: 6px; background: #faf8fc; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.strict-option:disabled { cursor: default; opacity: 1; }
.strict-option.correct-answer { background: #e7f2e8; border-color: #61956a; }
.strict-option.wrong-answer { background: #f8e7e9; border-color: #be686c; }
.strict-answer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 20px 0; }
.strict-answer label { flex: 1 1 220px; display: grid; gap: 8px; text-align: left; }
.strict-answer input { width: 100%; box-sizing: border-box; padding: 12px; font-size: 17px; border: 1px solid #d4c6e5; border-radius: 6px; }
.strict-feedback { text-align: left; padding: 12px 0; overflow-wrap: anywhere; }
.strict-feedback.is-correct { color: #3f7548; }
.strict-feedback.is-wrong { color: #a14850; }
