body {
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(217, 70, 239, 0.12), transparent 24%),
    radial-gradient(circle at bottom center, rgba(99, 102, 241, 0.09), transparent 32%),
    #f4f7fb;
  color: #1f2937;
  margin: 0;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 10;
}

.image-lightbox-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.78);
  z-index: 40;
}

.image-lightbox-frame {
  max-width: min(1100px, 100%);
  max-height: 100%;
}

.image-lightbox-frame img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, 85vw);
  height: 100vh;
  padding: 24px 20px;
  background: #ffffff;
  box-shadow: 4px 0 18px rgba(0, 0, 0, 0.12);
  z-index: 20;
  overflow-y: auto;
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.side-menu-header h2 {
  margin: 0;
}

.app,
.manage-page {
  margin: 0 auto;
  padding: 32px 20px;
}

.app {
  max-width: 1280px;
}

.app.study-page {
  max-width: 1320px;
}

.manage-page {
  max-width: 900px;
  position: relative;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-brand-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f46e5;
}

.app-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: linear-gradient(90deg, #42d7ff 0%, #60a5fa 38%, #8b5cf6 72%, #d946ef 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 18px rgba(96, 165, 250, 0.18);
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.18));
}

.app-brand-link:hover {
  filter: brightness(1.05);
}

.page-header h1 {
  margin: 0;
}

.intro {
  margin-bottom: 24px;
}

.study-hero {
  margin-bottom: 28px;
  padding: 16px 20px 14px;
  background:
    radial-gradient(circle at top right, rgba(66, 215, 255, 0.18), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(217, 70, 239, 0.12), transparent 22%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(239, 246, 255, 0.92)),
    linear-gradient(120deg, #f8fbff, #eef8ff);
  border: 1px solid rgba(120, 158, 255, 0.28);
  border-radius: 22px;
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(66, 215, 255, 0.06),
    0 0 28px rgba(139, 92, 246, 0.08);
}

.study-hero .page-brand-row {
  margin-bottom: 8px;
}

.study-hero .page-header {
  margin-bottom: 8px;
  align-items: center;
}

.study-hero .intro {
  margin: 0 0 12px;
  font-size: 0.96rem;
  line-height: 1.5;
  color: #42526b;
}

.study-hero .page-heading h1 {
  font-size: 1.75rem;
}

.dashboard-hero {
  margin-bottom: 28px;
  padding: 28px 30px;
  background:
    radial-gradient(circle at top right, rgba(66, 215, 255, 0.2), transparent 34%),
    radial-gradient(circle at 70% 15%, rgba(217, 70, 239, 0.14), transparent 22%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(240, 249, 255, 0.95)),
    linear-gradient(120deg, #f8fbff, #eef8ff);
  border: 1px solid rgba(120, 158, 255, 0.3);
  border-radius: 24px;
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(66, 215, 255, 0.08),
    0 0 34px rgba(139, 92, 246, 0.08);
}

.dashboard-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.dashboard-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.dashboard-stat-card,
.dashboard-panel,
.dashboard-category-card,
.focus-area-card {
  background: #ffffff;
  border: 1px solid rgba(131, 159, 245, 0.26);
  border-radius: 20px;
  box-shadow:
    0 14px 32px rgba(15, 23, 42, 0.07),
    0 0 0 1px rgba(66, 215, 255, 0.05);
}

.dashboard-stat-card {
  padding: 22px 22px 18px;
}

.dashboard-stat-card h2 {
  margin: 6px 0 8px;
  font-size: 2rem;
}

.dashboard-stat-label {
  margin: 0;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
}

.dashboard-panel {
  padding: 24px;
  margin-bottom: 22px;
}

.dashboard-panel-header {
  margin-bottom: 18px;
}

.dashboard-panel-header h2 {
  margin: 0 0 6px;
}

.dashboard-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-category-card {
  padding: 18px;
}

.dashboard-category-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-category-card h3 {
  margin: 0;
}

.dashboard-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0c4a6e;
  font-size: 0.85rem;
  font-weight: 700;
}

.dashboard-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.dashboard-focus-list {
  display: grid;
  gap: 12px;
}

.focus-area-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}

.focus-area-card h3,
.focus-area-card p {
  margin: 0;
}

.focus-rank {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
}

.study-hero .page-header {
  margin-bottom: 14px;
}

.study-hero .intro {
  max-width: 760px;
  margin: 0 0 20px;
  font-size: 1.04rem;
  line-height: 1.65;
  color: #334155;
}

.filter-area {
  margin-bottom: 20px;
}

.study-bundle-picker {
  max-width: none;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.study-bundle-picker label {
  display: inline-block;
  margin-bottom: 0;
  font-weight: bold;
}

.study-bundle-picker select {
  width: min(360px, 100%);
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

.filter-area label,
.form-block label,
.card-edit-panel label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.filter-area select,
.form-block input,
.form-block textarea,
.form-block select,
.card-edit-panel input,
.card-edit-panel textarea,
.card-edit-panel select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

.form-block textarea,
.card-edit-panel textarea {
  resize: none;
  overflow: hidden;
  min-height: 96px;
}

.menu-actions {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}

.menu-search-section {
  margin: 6px 0 18px;
}

.menu-search-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.menu-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font: inherit;
}

.menu-search-results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.menu-search-result {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #f8fbff;
  color: #0f172a;
  text-decoration: none;
}

.menu-search-result:hover {
  background: #eef7ff;
  color: #0f172a;
}

.menu-search-type {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6366f1;
}

.menu-search-title {
  font-weight: 700;
}

.menu-search-context,
.menu-search-empty {
  color: #475569;
  font-size: 0.92rem;
}

.info-detail-btn {
  margin-top: 8px;
}

.info-detail-panel {
  margin-top: 18px;
  padding: 18px 18px 6px;
  background: #f8fbff;
  border: 1px solid #d8e5f2;
  border-radius: 16px;
}

.info-detail-panel h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #1e3a5f;
}

.info-detail-panel p {
  margin-top: 0;
  margin-bottom: 14px;
  line-height: 1.65;
}

.card-area {
  margin-bottom: 22px;
}

.card,
.bundle-card,
.create-bundle-card,
.explanation-panel {
  background: #ffffff;
  border: 1px solid rgba(131, 159, 245, 0.26);
  border-radius: 20px;
  padding: 24px;
  box-shadow:
    0 14px 32px rgba(15, 23, 42, 0.07),
    0 0 0 1px rgba(66, 215, 255, 0.05);
}

.card {
  position: relative;
  overflow: hidden;
  padding: 30px 28px 28px;
  border-width: 1.5px;
  box-shadow:
    0 24px 54px rgba(15, 23, 42, 0.11),
    0 0 0 1px rgba(66, 215, 255, 0.07),
    0 0 34px rgba(139, 92, 246, 0.06);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, #42d7ff, #60a5fa 34%, #8b5cf6 68%, #d946ef);
}

.card::after {
  content: "";
  position: absolute;
  inset: 20px 20px auto auto;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(66, 215, 255, 0.14), rgba(139, 92, 246, 0.08) 48%, transparent 72%);
  pointer-events: none;
  border-radius: 999px;
  filter: blur(2px);
}

.edit-card-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 7px 12px;
  background: #fff3bf;
  color: #7c5a00;
  border: 1px solid #f6d860;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.1;
}

.edit-card-btn:hover {
  background: #ffe89a;
  color: #7c5a00;
}

.card-question-header {
  position: relative;
  width: fit-content;
  margin: 0 auto 16px;
  padding: 0 64px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.question-heading {
  margin: 0;
  text-align: center;
  font-size: 2.1rem;
  color: #0f172a;
}

.card-nav-btn {
  position: absolute;
  top: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.96), rgba(186, 230, 253, 0.94) 48%, rgba(125, 211, 252, 0.88) 100%);
  color: #0c4a6e;
  border: 1px solid rgba(96, 165, 250, 0.55);
  box-shadow:
    0 0 0 1px rgba(66, 215, 255, 0.08),
    0 10px 20px rgba(14, 116, 144, 0.12),
    0 0 20px rgba(96, 165, 250, 0.15);
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  overflow: visible;
}

#previous-card-btn {
  left: 0;
}

#next-card-btn {
  right: 0;
}

.card-nav-btn::before,
.card-nav-btn::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.card-nav-btn::before {
  width: 8px;
  height: 8px;
  top: calc(50% - 4px);
  border-radius: 999px;
  background: radial-gradient(circle, #ffffff 0%, rgba(103, 232, 249, 0.95) 42%, rgba(139, 92, 246, 0.78) 100%);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.14),
    0 0 10px rgba(34, 211, 238, 0.2);
}

.card-nav-btn::after {
  width: 5px;
  height: 5px;
  top: calc(50% - 2px);
  border-radius: 999px;
  background: radial-gradient(circle, #ffffff 0%, rgba(103, 232, 249, 0.92) 40%, rgba(139, 92, 246, 0.74) 100%);
  box-shadow:
    0 0 8px rgba(139, 92, 246, 0.2);
}

#previous-card-btn::before {
  right: calc(100% + 3px);
}

#previous-card-btn::after {
  right: calc(100% + 13px);
}

#next-card-btn::before {
  left: calc(100% + 3px);
}

#next-card-btn::after {
  left: calc(100% + 13px);
}

.card-nav-btn:hover {
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 1), rgba(186, 230, 253, 1) 45%, rgba(125, 211, 252, 0.95) 100%);
  color: #0c4a6e;
}

.explanation-panel {
  margin-top: 20px;
}

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

.explanation-header h2 {
  margin: 0;
}

.explanation-content {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.explanation-text {
  white-space: pre-wrap;
}

.scheduler-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.scheduler-panel {
  margin-top: 28px;
  padding-top: 8px;
}

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

.scheduler-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.scheduler-content {
  margin-top: 12px;
}

.scheduler-detail-card {
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  padding: 10px 12px;
}

.scheduler-detail-card p {
  margin: 0;
  font-size: 14px;
}

.scheduler-detail-label {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compact-btn {
  padding: 7px 12px;
  font-size: 14px;
}

#question-text sup,
#answer-text sup,
.explanation-text sup {
  font-size: 0.75em;
  vertical-align: super;
}

#question-text sub,
#answer-text sub,
.explanation-text sub {
  font-size: 0.75em;
  vertical-align: sub;
}

.explanation-image {
  margin-top: 16px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

.explanation-images {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.answer-images {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.explanation-images img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  cursor: zoom-in;
}

.answer-images img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  cursor: zoom-in;
}

.question-image-area {
  margin-bottom: 16px;
}

.question-image-area img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  cursor: zoom-in;
}

.study-image-frame {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #f8fafc;
}

.study-image-frame img {
  display: block;
  width: 100%;
  transform-origin: center center;
  cursor: zoom-in;
}

.question-image-area .study-image-frame,
.answer-images .study-image-frame,
.explanation-images .study-image-frame {
  width: min(66%, 520px);
  margin-inline: auto;
}

.manage-image-frame {
  max-width: 100%;
}

.manage-image-frame img {
  cursor: default;
}

.bundle-name {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  margin-top: 0;
  margin-bottom: 20px;
  background: linear-gradient(90deg, rgba(66, 215, 255, 0.1), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(131, 159, 245, 0.34);
  border-radius: 999px;
  color: #1d4ed8;
  font-weight: 700;
}

#question-text {
  font-size: 1.22rem;
  line-height: 1.72;
  color: #172554;
}

#answer-area h2,
.multiple-choice-area h2 {
  font-size: 1.5rem;
}

#answer-text {
  font-size: 1.14rem;
  line-height: 1.7;
}

.study-question-image {
  max-height: 420px;
  object-fit: contain;
}

.controls,
.inline-actions,
.page-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.controls {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-top: 26px;
  padding: 20px 22px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.top-right-action {
  margin-left: auto;
}

.floating-history-box {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d8e1ec;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(8px);
}

.history-icon-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #c7d2fe;
  border-radius: 50%;
  background: #ffffff;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.history-icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #93c5fd;
  color: #2563eb;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.12);
}

.history-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.history-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.history-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.history-toast-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

.queue-actions {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 0 2px;
}

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

.multiple-choice-area {
  margin-top: 20px;
}

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

.choice-option-btn {
  width: 100%;
  text-align: left;
  background: #e0f2fe;
  color: #0f172a;
  border: 1px solid #7dd3fc;
}

.choice-option-btn:hover {
  background: #bae6fd;
  color: #0f172a;
}

.hidden {
  display: none;
}

.status-text,
.helper-text,
.empty-state {
  color: #4b5563;
}

.study-status-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.study-status-panel .status-text {
  margin: 0;
  min-height: 72px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #dde5ef;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  color: #334155;
  font-weight: 600;
  line-height: 1.45;
}

button,
.button-link {
  display: inline-block;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  white-space: nowrap;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.controls #show-answer-btn {
  width: 100%;
  min-width: 0;
}

.controls #show-answer-btn {
  grid-column: span 3;
}

.controls .review-buttons {
  grid-column: 1 / -1;
}

.queue-later-row {
  grid-template-columns: minmax(240px, 360px);
}

.mode-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.queue-actions button {
  width: 100%;
  min-width: 0;
}

button:hover,
.button-link:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(29, 78, 216, 0.18);
}

.hard-btn {
  background: #dc2626;
}

.hard-btn:hover {
  background: #b91c1c;
}

.okay-btn {
  background: #ea580c;
}

.okay-btn:hover {
  background: #c2410c;
}

.good-btn {
  background: #16a34a;
}

.good-btn:hover {
  background: #15803d;
}

.menu-btn,
.menu-close-btn {
  min-width: 44px;
  padding: 10px 12px;
}

.menu-btn {
  font-family: monospace;
  letter-spacing: -1px;
}

.prominent-menu-btn {
  background: linear-gradient(135deg, #67d1ff, #38bdf8);
  color: #083344;
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: bold;
  min-width: 118px;
  padding: 15px 19px;
  border: 2px solid #0ea5e9;
  box-shadow: 0 14px 26px rgba(14, 165, 233, 0.24);
}

.prominent-menu-btn:hover {
  background: #0ea5e9;
  color: #ffffff;
}

.secondary-link,
.secondary-btn {
  background: #475569;
  box-shadow: 0 10px 20px rgba(71, 85, 105, 0.15);
}

.secondary-link:hover,
.secondary-btn:hover {
  background: #334155;
}

.danger-btn {
  background: #dc2626;
  box-shadow: 0 10px 20px rgba(220, 38, 38, 0.15);
}

.danger-btn:hover {
  background: #b91c1c;
}

.master-action-btn {
  background: #0f766e;
  color: #ffffff;
  font-weight: 700;
  box-shadow: none;
}

.master-action-btn:hover {
  background: #0d9488;
}

.subtle-master-btn {
  background: #0369a1;
  box-shadow: none;
}

.subtle-master-btn:hover {
  background: #0284c7;
}

.utility-btn {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  box-shadow: none;
}

.utility-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.remove-btn {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  box-shadow: none;
}

.remove-btn:hover {
  background: #ffedd5;
  color: #7c2d12;
}

.icon-btn {
  min-width: 44px;
  font-size: 18px;
  font-weight: 700;
}

.bundle-list {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.manage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.folder-browser {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.browser-pane,
.selected-card-panel {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.selected-card-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.browser-section + .browser-section {
  margin-top: 24px;
}

.browser-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.browser-section-header h2,
.selected-card-panel h2 {
  margin: 0;
}

.folder-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.folder-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: none;
  max-width: 100%;
  min-width: 0;
}

.folder-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.folder-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  margin-left: 2px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 700;
}

.drop-target-folder {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.drop-target-folder:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.14);
}

.folder-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.folder-btn.selected {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.folder-btn.selected .folder-count {
  background: #ffffff;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.subfolder-btn {
  background: #f8fafc;
}

.subfolder-btn[draggable="true"] {
  cursor: grab;
}

.subfolder-btn[draggable="true"]:active {
  cursor: grabbing;
}

.folder-icon {
  font-family: monospace;
  color: #64748b;
}

.compact-form {
  max-width: 420px;
}

.auto-create-section {
  margin-top: 20px;
  max-width: 520px;
}

.auto-create-section h3 {
  margin-bottom: 8px;
}

.auto-create-dropzone {
  margin-top: 10px;
  padding: 22px 18px;
  border: 2px dashed #7dd3fc;
  border-radius: 14px;
  background: #f0f9ff;
  color: #0f172a;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.auto-create-dropzone:hover,
.auto-create-dropzone:focus-visible,
.auto-create-dropzone.drag-active {
  background: #e0f2fe;
  border-color: #0284c7;
  outline: none;
  transform: translateY(-1px);
}

.auto-create-dropzone p {
  margin: 0;
}

.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.flashcard-tile {
  display: grid;
  justify-items: start;
  gap: 10px;
  min-height: 110px;
  padding: 16px;
  text-align: left;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: none;
  overflow: hidden;
}

.flashcard-tile:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.flashcard-tile[draggable="true"] {
  cursor: grab;
}

.flashcard-tile[draggable="true"]:active {
  cursor: grabbing;
}

.flashcard-tile.selected {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.add-card-tile {
  background: #ecfeff;
  border-color: #67e8f9;
  color: #155e75;
}

.add-card-tile:hover {
  background: #cffafe;
  color: #155e75;
}

.flashcard-icon {
  font-family: monospace;
  font-size: 22px;
  line-height: 1;
}

.flashcard-label {
  display: block;
  width: 100%;
  font-size: 14px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.flashcard-select-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 700;
}

.flashcard-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.duplicate-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.potential-duplicate-badge {
  background: #ffe3f0;
  color: #8a245b;
  border: 1px solid #f3a9cf;
}

.selected-card-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.selected-card-meta p {
  margin: 0;
}

.potential-duplicate-panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fff6fb;
  border: 1px solid #f6c0db;
  border-radius: 14px;
}

.potential-duplicate-panel p {
  margin: 0 0 8px;
}

.potential-duplicate-panel p:last-child {
  margin-bottom: 0;
}

.potential-duplicate-match {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #f4bfd8;
  border-radius: 12px;
}

.potential-duplicate-match:first-of-type {
  margin-top: 10px;
}

.potential-duplicate-match .inline-actions {
  margin-top: 8px;
}

.duplicate-review-dialog {
  width: min(1080px, calc(100vw - 24px));
  max-height: min(86vh, 920px);
  overflow-y: auto;
}

.duplicate-review-content {
  margin-top: 16px;
}

.duplicate-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.duplicate-review-card {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: min(62vh, 560px);
  overflow: hidden;
  text-align: left;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #d7e2ee;
  border-radius: 14px;
  color: #0f172a;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

.duplicate-review-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 10px;
  padding-right: 8px;
  overscroll-behavior: contain;
  white-space: normal;
  word-break: break-word;
}

.duplicate-review-card.selected {
  background: #fff6fb;
  border-color: #f3a9cf;
  box-shadow: 0 8px 18px rgba(138, 36, 91, 0.12);
}

.duplicate-review-card p {
  margin: 0 0 10px;
}

.duplicate-review-card p:last-child {
  margin-bottom: 0;
}

.duplicate-review-card-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 5px 9px;
  background: #e2e8f0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

.duplicate-review-card.selected .duplicate-review-card-label {
  background: #ffd5e9;
  color: #8a245b;
}

#duplicate-review-keep-btn {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

#duplicate-review-keep-btn:hover {
  background: #bbf7d0;
}

.selected-card-content {
  margin-top: 18px;
}

.active-editor {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.question-image-preview {
  margin-bottom: 18px;
}

.question-image-preview p {
  margin-top: 0;
}

.question-image-preview img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

.image-preview-panel {
  margin-bottom: 18px;
}

.image-preview-panel p {
  margin-top: 0;
}

.detected-text-panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
}

.detected-text-panel h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.detected-textarea {
  margin-top: 8px;
  background: #ffffff;
}

.detected-line-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.detected-line-card {
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #ffffff;
}

.detected-line-card p {
  margin-top: 0;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.bundle-summary,
.confirm-dialog {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.confirm-dialog p {
  white-space: pre-wrap;
}

.menu-actions .button-link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  margin: 0;
}

.menu-manage-link {
  background: #b8f2e6;
  color: #0f3d38;
}

.menu-manage-link:hover {
  background: #9fe7d8;
  color: #0f3d38;
}

.menu-archives-link {
  background: #ffd6c9;
  color: #6f2f1a;
}

.menu-archives-link:hover {
  background: #ffc4b3;
  color: #6f2f1a;
}

.menu-info-link {
  background: #e9ddff;
  color: #4c2a75;
}

.menu-info-link:hover {
  background: #dcc8ff;
  color: #4c2a75;
}

.menu-hard-link {
  background: #ffe8b6;
  color: #6f4e00;
}

.menu-hard-link:hover {
  background: #ffdd90;
  color: #6f4e00;
}

.menu-study-link {
  background: #d9f0ff;
  color: #0b4f71;
}

.menu-study-link:hover {
  background: #bee6ff;
  color: #0b4f71;
}

.menu-home-link {
  background: #e8f7d8;
  color: #335c1d;
}

.menu-home-link:hover {
  background: #daf0c3;
  color: #335c1d;
}

.info-card {
  background: #ffffff;
  border: 1px solid rgba(131, 159, 245, 0.24);
  border-radius: 12px;
  padding: 20px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(66, 215, 255, 0.04);
}

.info-card + .info-card {
  margin-top: 18px;
}

.info-card h2 {
  margin-top: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #d8dee8;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}

.filter-chip input {
  margin: 0;
}

.hard-card-item h3 {
  margin-bottom: 8px;
}

.hard-card-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

.hard-card-summary::-webkit-details-marker {
  display: none;
}

.hard-card-expand-label {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
  font-weight: 700;
}

.hard-card-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

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

.bundle-summary {
  position: sticky;
  top: 20px;
}

.summary-cards {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.summary-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}

.summary-card p {
  margin: 6px 0;
}

.bundle-card h3,
.create-bundle-card h2 {
  margin-top: 0;
}

.bundle-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.form-block {
  margin-top: 16px;
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 12px;
}

.card-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  background: #f8fafc;
}

.card-item p {
  margin: 8px 0;
}

.card-edit-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.question-editor {
  min-height: 120px;
}

.subcategory-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #cbd5e1;
}

.subcategory-panel h4 {
  margin: 0 0 12px;
}

.option-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.option-row input {
  flex: 1;
}

.small-btn {
  padding: 8px 12px;
}

.progress-block {
  margin-top: 12px;
}

.progress-track {
  display: flex;
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-segment-hard {
  background: #dc2626;
}

.progress-segment-okay {
  background: #ea580c;
}

.progress-segment-good {
  background: #16a34a;
}

.progress-segment-easy {
  background: #2563eb;
}

.progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 14px;
  color: #4b5563;
}

.image-input-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.explanation-preview {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.explanation-preview img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

.editable-image-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #f8fafc;
}

.image-hover-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.editable-image-card:hover .image-hover-actions,
.editable-image-card:focus-within .image-hover-actions {
  opacity: 1;
  pointer-events: auto;
}

.image-editor-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  z-index: 35;
  padding: 22px;
  background: #ffffff;
  border: 1px solid #d8e1ec;
  border-radius: 20px;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.24);
}

.image-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-editor-header h2 {
  margin: 0;
}

.image-editor-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
}

.image-editor-canvas-wrap {
  overflow: auto;
  padding: 12px;
  margin-bottom: 16px;
  background: #f8fbff;
  border: 1px solid #d9e7f2;
  border-radius: 16px;
}

.image-editor-canvas-wrap canvas {
  display: block;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: #edf4fb;
  border-radius: 12px;
  cursor: crosshair;
}

button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.bundle-card.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.select-bundle-btn {
  margin-top: 12px;
}

.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 32px));
  z-index: 30;
}

.archive-list {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.archive-card {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.archive-card h3 {
  margin-top: 0;
}

.archive-meta {
  color: #4b5563;
}

.archive-group {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 0 20px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.archive-group-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
  cursor: pointer;
  font-weight: 700;
}

.archive-group-body {
  display: grid;
  gap: 12px;
}

.archive-card-condensed {
  padding: 14px 16px;
  box-shadow: none;
}

.archive-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.archive-select-row input {
  width: auto;
  margin: 0;
}

.restore-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

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

  .dashboard-overview-grid,
  .dashboard-category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .folder-browser {
    grid-template-columns: 1fr;
  }

  .bundle-summary {
    position: static;
  }

  .selected-card-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 720px) {
  .app {
    max-width: 100%;
    padding: 24px 16px 32px;
  }

  .floating-history-box {
    left: auto;
    right: 12px;
    bottom: 12px;
    gap: 6px;
    padding: 6px;
  }

  .history-icon-btn {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .duplicate-review-grid {
    grid-template-columns: 1fr;
  }

  .duplicate-review-card {
    height: min(48vh, 440px);
  }

  .dashboard-overview-grid,
  .dashboard-category-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .controls,
  .queue-actions,
  .review-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .card-nav-btn {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .card-question-header {
    padding: 0 56px;
    min-height: 48px;
  }

  .controls #show-answer-btn,
  .controls .review-buttons,
  .queue-actions > button,
  .queue-actions button {
    width: 100%;
    min-width: 0;
  }

  .controls #show-answer-btn,
  .controls .review-buttons {
    grid-column: auto;
  }

  .edit-card-btn {
    top: 12px;
    right: 12px;
    padding: 6px 10px;
    font-size: 12px;
  }
}
