.spaced-review-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.spaced-review-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  margin: 0;
}

.spaced-review-subtitle {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  max-width: 660px;
}

.spaced-review-error {
  color: var(--red);
  font-size: 0.9rem;
  background: rgba(183, 91, 77, 0.08);
  border: 1px solid rgba(183, 91, 77, 0.2);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}

.spaced-review-panel {
  background: rgba(255, 250, 239, .68);
  border: 1px solid rgba(104, 69, 22, .13);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 18px 48px rgba(86, 57, 17, .09);
  backdrop-filter: blur(16px);
  text-align: left;
}

.spaced-review-state {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Filters */
.spaced-review-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.spaced-review-filter {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(82, 54, 17, .14);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: rgba(255,255,255,.48);
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--ink);
}

.spaced-review-filter input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

/* RAG Badges */
.rag-badge,
.rag-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(82, 54, 17, .14);
  padding: 0.22rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.rag-icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 700;
}

.rag-red .rag-badge,
.rag-badge.rag-red,
.spaced-review-filter.rag-red {
  background: rgba(183, 91, 77, 0.12);
  border-color: rgba(183, 91, 77, 0.22);
}

.rag-red .rag-icon,
.rag-badge.rag-red .rag-icon,
.rag-badge-inline.rag-red .rag-icon {
  background: rgba(183, 91, 77, 0.28);
}

.rag-amber .rag-badge,
.rag-badge.rag-amber,
.spaced-review-filter.rag-amber {
  background: rgba(199, 149, 57, 0.14);
  border-color: rgba(199, 149, 57, 0.24);
}

.rag-amber .rag-icon,
.rag-badge.rag-amber .rag-icon,
.rag-badge-inline.rag-amber .rag-icon {
  background: rgba(199, 149, 57, 0.3);
}

.rag-green .rag-badge,
.rag-badge.rag-green,
.spaced-review-filter.rag-green {
  background: rgba(79, 143, 90, 0.12);
  border-color: rgba(79, 143, 90, 0.22);
}

.rag-green .rag-icon,
.rag-badge.rag-green .rag-icon,
.rag-badge-inline.rag-green .rag-icon {
  background: rgba(79, 143, 90, 0.28);
}

.rag-grey .rag-badge,
.rag-badge.rag-grey,
.spaced-review-filter.rag-grey {
  background: rgba(123, 106, 80, 0.10);
  border-color: rgba(123, 106, 80, 0.18);
}

.rag-grey .rag-icon,
.rag-badge.rag-grey .rag-icon,
.rag-badge-inline.rag-grey .rag-icon {
  background: rgba(123, 106, 80, 0.22);
}

/* Subjects */
.spaced-review-subjects {
  display: grid;
  gap: 1rem;
}

.spaced-review-subject {
  border: 1px solid rgba(82, 54, 17, .10);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.45);
  padding: 0.9rem;
}

.spaced-review-subject-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: Georgia, serif;
  color: var(--ink);
}

.spaced-review-subject-toggle,
.spaced-review-subsubject-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.spaced-review-subject-toggle input[type="checkbox"],
.spaced-review-subsubject-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.spaced-review-subject-header p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--ink);
}

.spaced-review-subject-header small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.79rem;
}

.spaced-review-subsubject-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.95rem;
}

.spaced-review-subsubject-block {
  border: 1px solid rgba(82, 54, 17, .10);
  border-radius: var(--radius-md);
  padding: 0.7rem;
  background: rgba(255,255,255,.48);
}

.spaced-review-subsubject-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.6rem;
}

.spaced-review-subsubject-header strong {
  font-size: 0.93rem;
  color: var(--ink);
}

.spaced-review-subsubject-header span {
  font-size: 0.82rem;
  color: var(--muted);
}

.spaced-review-subsubject-header small {
  font-size: 0.78rem;
  color: var(--muted);
}

.spaced-review-library-list {
  display: grid;
  gap: 0.55rem;
}

.spaced-review-library-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid rgba(82, 54, 17, .12);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  padding: 0.6rem 0.7rem;
  background: rgba(255,255,255,.48);
  cursor: pointer;
}

.spaced-review-library-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

.spaced-review-library-item.selected {
  box-shadow: 0 0 0 2px rgba(63, 124, 172, .25);
  border-color: rgba(63, 124, 172, .3);
}

.spaced-review-library-item.rag-red {
  border-left-color: var(--red);
}

.spaced-review-library-item.rag-amber {
  border-left-color: var(--gold);
}

.spaced-review-library-item.rag-green {
  border-left-color: var(--green);
}

.spaced-review-library-item.rag-grey {
  border-left-color: var(--muted);
}

.spaced-review-library-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.spaced-review-library-texts strong {
  font-size: 0.91rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spaced-review-library-texts span {
  font-size: 0.8rem;
  color: var(--muted);
}

.spaced-review-library-texts small {
  font-size: 0.77rem;
  color: var(--muted);
}

/* Footer */
.spaced-review-footer {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.spaced-review-footer p {
  font-size: 0.93rem;
  color: var(--ink);
}

@media (max-width: 760px) {
  .spaced-review-library-item {
    flex-wrap: wrap;
  }
}
