:root {
  --bg: #fff4fb;
  --bg-accent: #ffd6ee;
  --panel: rgba(255, 248, 252, 0.9);
  --panel-strong: #fff8fc;
  --ink: #3f2433;
  --muted: #7f6273;
  --line: rgba(114, 55, 86, 0.12);
  --accent: #e56aa6;
  --accent-deep: #b63f78;
  --success: #b63f78;
  --danger: #b24567;
  --shadow: 0 22px 60px rgba(137, 69, 106, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 199, 232, 0.92), transparent 28%),
    radial-gradient(circle at bottom right, rgba(229, 106, 166, 0.24), transparent 24%),
    linear-gradient(135deg, #fff8fd 0%, #fff1f8 38%, #ffe6f2 100%);
}

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

[hidden] {
  display: none !important;
}

button {
  cursor: pointer;
  border: 0;
}

.page-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.sidebar,
.study-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-block,
.panel,
.hero-card,
.study-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.brand-block,
.panel,
.study-card {
  padding: 24px;
}

.hero-card {
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 247, 251, 0.97), rgba(255, 226, 240, 0.95)),
    var(--panel);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--accent-deep);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: "Instrument Serif", serif;
  font-size: clamp(2.3rem, 4vw, 3.4rem);
  line-height: 0.96;
  margin-bottom: 14px;
}

h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.intro,
.muted,
.field-hint,
.deck-meta,
.voice-output {
  color: var(--muted);
  line-height: 1.5;
}

.panel-heading,
.status-strip,
.controls,
.voice-panel,
.deck-item,
.deck-actions,
.utility-row {
  display: flex;
  align-items: center;
}

.panel-heading,
.controls,
.deck-item {
  justify-content: space-between;
}

.panel-heading {
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field span,
.status-label,
.answer-label {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(68, 46, 24, 0.12);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 180px;
}

.primary-button,
.secondary-button,
.ghost-button,
.use-button,
.delete-button,
.classic-round-button,
.silent-round-button {
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.primary-button,
.use-button {
  background: var(--accent);
  color: white;
  box-shadow: 0 14px 30px rgba(229, 106, 166, 0.28);
}

.secondary-button {
  background: rgba(229, 106, 166, 0.1);
  color: var(--accent-deep);
}

.ghost-button,
.delete-button,
.classic-round-button,
.silent-round-button {
  background: rgba(30, 26, 24, 0.06);
  color: var(--ink);
}

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

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.use-button:hover,
.delete-button:hover,
.classic-round-button:hover,
.silent-round-button:hover,
.flashcard:hover {
  transform: translateY(-1px);
}

.count-pill {
  min-width: 32px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(229, 106, 166, 0.12);
  color: var(--accent-deep);
}

.count-pill.ready-pill {
  background: rgba(50, 158, 107, 0.14);
  color: #1f7a53;
}

.count-pill.partial-pill {
  background: rgba(214, 142, 38, 0.15);
  color: #9f5f0a;
}

.count-pill.needs-pill {
  background: rgba(178, 69, 103, 0.14);
  color: var(--danger);
}

.deck-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.folder-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(229, 106, 166, 0.1);
}

.folder-tab {
  border-radius: 999px;
  padding: 10px 8px;
  color: var(--accent-deep);
  background: transparent;
}

.folder-tab.active {
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(229, 106, 166, 0.24);
}

.deck-item {
  gap: 12px;
  padding: 14px 16px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(68, 46, 24, 0.08);
}

.deck-actions {
  gap: 10px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.quick-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.utility-row {
  gap: 10px;
  flex-wrap: wrap;
}

.import-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-copy {
  margin-bottom: 20px;
}

.status-strip {
  justify-content: flex-start;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(114, 55, 86, 0.1);
}

.study-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.flashcard {
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 241, 247, 0.92));
  border-radius: 28px;
  border: 1px solid rgba(114, 55, 86, 0.12);
  padding: 20px;
  cursor: pointer;
}

.flashcard:focus-visible {
  outline: 3px solid rgba(229, 106, 166, 0.46);
  outline-offset: 4px;
}

.image-frame {
  position: relative;
  min-height: 480px;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 235, 244, 0.95), rgba(255, 221, 238, 0.96));
  border: 1px solid rgba(114, 55, 86, 0.08);
}

.timer-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  min-width: 76px;
  padding: 10px 14px;
  border-radius: 999px;
  text-align: center;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  color: white;
  background: rgba(182, 63, 120, 0.9);
  box-shadow: 0 14px 30px rgba(137, 69, 106, 0.28);
}

.start-options {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100% - 42px));
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 245, 250, 0.97), rgba(255, 233, 244, 0.94));
  border: 1px solid rgba(182, 63, 120, 0.12);
  box-shadow: 0 24px 60px rgba(137, 69, 106, 0.16);
}

.start-options-copy {
  margin: 0 0 16px;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}

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

.start-options-grid > button {
  width: 100%;
  min-height: 80px;
  display: grid;
  place-items: center;
  text-align: center;
}

.start-round-button {
  min-width: 0;
  padding: 18px 16px;
  border-radius: 999px;
  color: white;
  background:
    linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 24px 50px rgba(182, 63, 120, 0.32);
  font-size: clamp(1rem, 3.5vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.08;
}

.start-round-button:hover {
  transform: translateY(-2px);
}

.silent-round-button {
  grid-column: 1 / -1;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-deep);
  box-shadow: 0 14px 30px rgba(137, 69, 106, 0.14);
  font-size: 1.08rem;
  font-weight: 700;
}

.classic-round-button {
  padding: 16px 24px;
  color: var(--accent-deep);
  background: rgba(229, 106, 166, 0.14);
  box-shadow: 0 14px 30px rgba(137, 69, 106, 0.12);
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 700;
  line-height: 1.08;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  color: white;
  background:
    radial-gradient(circle, rgba(182, 63, 120, 0.9), rgba(63, 36, 51, 0.36));
  font-size: clamp(7rem, 28vw, 16rem);
  font-weight: 700;
  text-shadow: 0 16px 36px rgba(63, 36, 51, 0.26);
}

.flashcard.ready-to-start {
  cursor: default;
}

.timer-badge.overtime {
  background: rgba(178, 69, 103, 0.94);
}

.correct-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  font-size: clamp(5rem, 18vw, 11rem);
  font-weight: 700;
  color: white;
  background: rgba(34, 153, 105, 0.72);
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
}

.correct-overlay.show {
  animation: correct-pop 720ms ease forwards;
}

@keyframes correct-pop {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }

  20% {
    opacity: 1;
    transform: scale(1.02);
  }

  78% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

.image-frame img {
  width: 100%;
  height: 480px;
  object-fit: contain;
  object-position: center;
  display: block;
}

.placeholder {
  min-height: 480px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.answer-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 12px;
}

#answer-text {
  font-size: clamp(1.1rem, 2vw, 1.55rem);
}

.flashcard.unrevealed #answer-text {
  letter-spacing: 0.08em;
  color: var(--muted);
}

.flashcard.revealed #answer-text {
  color: var(--success);
}

.controls,
.voice-panel {
  gap: 12px;
  flex-wrap: wrap;
}

.voice-panel {
  align-items: stretch;
}

.voice-panel > div {
  flex: 1 1 260px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(114, 55, 86, 0.08);
}

.voice-output {
  margin-top: 8px;
  min-height: 48px;
}

.results-panel {
  padding: 18px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 234, 244, 0.96), rgba(255, 248, 252, 0.96));
  border: 1px solid rgba(182, 63, 120, 0.15);
}

.custom-tools {
  margin-top: 4px;
}

.offline-panel {
  margin-top: 4px;
}

.guide-panel {
  margin-top: 4px;
}

.guide-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(229, 106, 166, 0.1);
}

.guide-tab {
  min-width: 132px;
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--accent-deep);
  font-weight: 700;
}

.guide-tab.active {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 12px 24px rgba(182, 63, 120, 0.22);
}

.guide-content {
  border-radius: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(114, 55, 86, 0.08);
}

.guide-lead {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.guide-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
  color: var(--ink);
  line-height: 1.55;
}

.guide-list strong {
  color: var(--accent-deep);
}

.guide-sources {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(114, 55, 86, 0.1);
}

.guide-sources a {
  color: var(--accent-deep);
}

.results-panel h3 {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 1.4rem;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.results-stats span {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

.results-stats strong {
  color: var(--ink);
}

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

.empty-state {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  text-align: center;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  animation: confetti-fall 2300ms cubic-bezier(0.17, 0.67, 0.35, 1) forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -20px, 0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translate3d(var(--drift), 105vh, 0) rotate(720deg);
    opacity: 0;
  }
}

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

  .image-frame,
  .image-frame img,
  .placeholder {
    min-height: 360px;
    height: 360px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1320px);
    margin: 10px auto 24px;
  }

  .brand-block,
  .panel,
  .hero-card,
  .study-card {
    border-radius: 24px;
    padding: 20px;
  }

  .controls > button,
  .deck-actions > button,
  .utility-row > button,
  .utility-row > label {
    flex: 1 1 100%;
  }

  .start-options {
    width: min(380px, calc(100% - 28px));
    padding: 18px;
  }

  .start-options-grid {
    grid-template-columns: 1fr;
  }

  .guide-tabs {
    width: 100%;
  }

  .guide-tab {
    min-width: 0;
  }
}
