@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Fraunces:opsz,wght@9..144,500&display=swap");

:root {
  --bg: #f2ede2;
  --panel: rgba(255, 252, 245, 0.82);
  --text: #1f2328;
  --muted: #5f6670;
  --accent: #d14a2f;
  --accent-dark: #a73821;
  --line: rgba(0, 0, 0, 0.09);
  --good: #167953;
  --warn: #ad5f00;
  --danger: #a02420;
  --shadow: 0 14px 34px rgba(20, 20, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(140deg, #e8ebf1 0%, var(--bg) 45%, #f7e9df 100%);
  color: var(--text);
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  position: relative;
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(4px);
  opacity: 0.45;
}

.ambient-one {
  width: 26rem;
  height: 26rem;
  left: -7rem;
  top: -6rem;
  background: radial-gradient(circle at 30% 30%, #ffc58f, #ff8d67 65%, transparent 75%);
  animation: drift-one 14s ease-in-out infinite alternate;
}

.ambient-two {
  width: 30rem;
  height: 30rem;
  right: -8rem;
  bottom: -8rem;
  background: radial-gradient(circle at 70% 60%, #7cb9d8, #addfcb 65%, transparent 76%);
  animation: drift-two 18s ease-in-out infinite alternate;
}

@keyframes drift-one {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(28px);
  }
}

@keyframes drift-two {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-28px);
  }
}

.app-shell {
  width: min(1180px, 94vw);
  margin: 2rem auto 2.4rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  margin: 0 0 0.35rem;
  color: var(--muted);
}

h1,
h2,
h3,
h4 {
  font-family: "Fraunces", "Georgia", serif;
  margin: 0;
}

h1 {
  font-size: clamp(1.85rem, 2.8vw, 2.7rem);
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 0.5rem 0 0;
  color: var(--muted);
  max-width: 46rem;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.15rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.sync-panel {
  display: grid;
  gap: 0.65rem;
}

.sync-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.sync-actions button {
  margin-top: 0;
}

.sync-status {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.sync-status.status-ok {
  color: var(--good);
}

.sync-status.status-warn {
  color: var(--warn);
}

.sync-status.status-danger {
  color: var(--danger);
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

.stack-form {
  display: grid;
  gap: 0.5rem;
}

label {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid rgba(0, 0, 0, 0.17);
  border-radius: 11px;
  padding: 0.58rem 0.7rem;
  background: #fffdf8;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(209, 74, 47, 0.18);
}

button {
  margin-top: 0.25rem;
  border: 0;
  border-radius: 11px;
  padding: 0.6rem 0.85rem;
  font-weight: 600;
  background: linear-gradient(140deg, var(--accent), #ef7857);
  color: white;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.section-title {
  margin-top: 1rem;
  margin-bottom: 0.7rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 1.2rem;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin-bottom: 0.45rem;
}

.hidden {
  display: none;
}

.exam-list,
.topic-list {
  display: grid;
  gap: 0.65rem;
}

.exam-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.7);
}

.exam-card.selected {
  border-color: rgba(209, 74, 47, 0.5);
  box-shadow: 0 0 0 3px rgba(209, 74, 47, 0.12);
}

.exam-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: start;
}

.exam-card h4 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.exam-card small {
  color: var(--muted);
}

.mini-progress {
  width: 120px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.09);
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2da06d, #74c09d);
}

.exam-card-actions {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.45rem;
}

.exam-card-actions button {
  flex: 1;
  padding: 0.44rem 0.6rem;
  margin-top: 0;
  font-size: 0.86rem;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.danger-button {
  color: var(--danger);
}

.exam-meta {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  padding: 0.95rem;
}

.meta-row {
  margin-top: 0.42rem;
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
}

.pill {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  font-size: 0.84rem;
  color: #30445e;
  background: rgba(124, 185, 216, 0.2);
}

.progress-wrap {
  margin-top: 0.85rem;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  margin-bottom: 0.28rem;
  font-size: 0.89rem;
}

.progress-bar {
  width: 100%;
  height: 13px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.11);
}

#selected-exam-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2da06d, #74c09d 75%);
}

.form-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.topics-section {
  margin-top: 1.1rem;
}

.topic-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.68);
  display: grid;
  gap: 0.58rem;
}

.topic-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.topic-name {
  margin: 0;
  font-size: 1.02rem;
}

.topic-subline,
.topic-facts {
  margin: 0;
  color: var(--muted);
  font-size: 0.89rem;
}

.badge-row {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  padding: 0.18rem 0.48rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.9);
}

.chip.priority-critical {
  color: #701414;
  background: #ffd9d9;
  border-color: rgba(161, 54, 54, 0.28);
}

.chip.priority-high {
  color: #7a4d00;
  background: #ffe8bf;
  border-color: rgba(143, 94, 13, 0.27);
}

.chip.priority-medium {
  color: #28557c;
  background: #ddebff;
  border-color: rgba(31, 89, 136, 0.27);
}

.chip.priority-low {
  color: #0f5e3c;
  background: #d8f1e6;
  border-color: rgba(20, 121, 83, 0.25);
}

.topic-actions {
  display: flex;
  gap: 0.48rem;
}

.topic-actions button {
  margin-top: 0;
  padding: 0.4rem 0.62rem;
  font-size: 0.82rem;
}

.topic-actions .ghost-button {
  flex: 1;
}

.topic-actions .danger-button {
  flex: 0;
}

.soft-empty {
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 0.8rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

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

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

@media (prefers-reduced-motion: reduce) {
  .ambient {
    animation: none;
  }
}
