:root {
  color-scheme: dark;
  --bg: #09070b;
  --glass: rgba(18, 14, 23, 0.72);
  --glass-strong: rgba(25, 18, 31, 0.9);
  --chrome: #edf0f5;
  --chrome-soft: #aeb7c4;
  --text: #fff7fd;
  --muted: #c9b9c8;
  --pink: #ff4fc3;
  --hot: #ff149d;
  --blush: #ffafd9;
  --mint: #63ffd8;
  --amber: #ffd36e;
  --red: #ff5c85;
  --line: rgba(255, 79, 195, 0.26);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
  --glow: 0 0 24px rgba(255, 79, 195, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 16px) 14px calc(env(safe-area-inset-bottom) + 18px);
  background:
    linear-gradient(180deg, rgba(8, 6, 10, 0.28), rgba(8, 6, 10, 0.92)),
    radial-gradient(circle at 80% 8%, rgba(99, 255, 216, 0.12), transparent 26%),
    radial-gradient(circle at 10% 18%, rgba(255, 79, 195, 0.22), transparent 28%),
    url("assets/server-room-pink.png") center / cover fixed,
    #09070b;
}

.screen {
  width: 100%;
  max-width: 980px;
  min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 34px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.22rem, 5vw, 1.86rem);
  font-weight: 900;
  line-height: 1.08;
  color: var(--chrome);
  text-shadow: 0 0 24px rgba(255, 79, 195, 0.48);
}

.language-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: -4px auto 14px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 79, 195, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.language-toggle button {
  min-width: 78px;
  padding: 6px 11px;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 0.86rem;
  font-weight: 950;
}

.language-toggle button.active {
  background: rgba(255, 79, 195, 0.18);
  color: var(--blush);
  box-shadow: 0 0 18px rgba(255, 79, 195, 0.22);
}

.language-toggle span {
  color: rgba(255, 255, 255, 0.42);
  font-weight: 900;
}

.icon-button {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.05)),
    rgba(18, 14, 23, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  color: var(--chrome);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.icon-button:hover,
.icon-button:active {
  transform: scale(1.05);
  color: var(--pink);
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.icon-button svg,
.topic-icon svg,
.mini-icon svg,
.flash-subject-row svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 2.25;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-hero {
  min-height: 118px;
  margin: 0 0 14px;
  padding: 18px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 79, 195, 0.08) 42%, rgba(9, 7, 11, 0.74)),
    rgba(9, 7, 11, 0.62);
  backdrop-filter: blur(16px) saturate(1.28);
  -webkit-backdrop-filter: blur(16px) saturate(1.28);
  box-shadow: var(--shadow);
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 4.3rem);
  line-height: 0.96;
  font-weight: 950;
  color: var(--chrome);
}

.home-hero p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 3.8vw, 1.14rem);
  line-height: 1.32;
  font-weight: 700;
}

.hero-stat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 12px;
}

.stat-card {
  min-height: 90px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
}

.stat-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  background: conic-gradient(var(--pink) var(--value), rgba(255, 255, 255, 0.12) 0);
  box-shadow: 0 0 22px rgba(255, 79, 195, 0.3);
}

.stat-ring-inner {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(9, 7, 11, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-ring strong {
  font-size: 0.92rem;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.1;
  font-weight: 800;
}

.study-dashboard,
.bookmark-panel,
.list,
.search-results {
  display: grid;
  gap: 10px;
}

.study-dashboard {
  margin-bottom: 14px;
}

.readiness-card,
.goal-panel,
.weak-panel,
.search-panel,
.reader-card,
.quiz-panel,
.score-card,
.flash-card {
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 79, 195, 0.06), rgba(6, 5, 8, 0.82)),
    var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.readiness-card {
  min-height: 88px;
  display: grid;
  grid-template-columns: 1fr 86px;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.goal-panel {
  min-height: 92px;
  display: grid;
  grid-template-columns: 1fr minmax(140px, 190px);
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.readiness-card span,
.readiness-card small,
.goal-panel span,
.goal-panel small {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.readiness-card span,
.goal-panel span {
  font-size: 0.76rem;
  text-transform: uppercase;
}

.readiness-card strong,
.goal-panel strong {
  display: block;
  margin: 3px 0;
  color: var(--chrome);
  font-size: clamp(1.12rem, 5vw, 1.48rem);
  line-height: 1.05;
}

.date-control {
  display: grid;
  gap: 6px;
}

.date-control input {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 79, 195, 0.3);
  background: rgba(7, 6, 10, 0.72);
  color: var(--text);
  font-weight: 850;
}

.mini-action,
.pill-button,
.quiz-primary {
  min-height: 52px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #ffc9ea, #ff4fc3 48%, #c60078);
  color: #190313;
  font-weight: 950;
  box-shadow: 0 16px 36px rgba(255, 79, 195, 0.28);
}

.weak-panel,
.search-panel {
  padding: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.section-heading h2 {
  margin: 0;
  color: var(--chrome);
  font-size: clamp(1rem, 4.2vw, 1.2rem);
  line-height: 1.1;
}

.section-heading span,
.subject-count {
  min-width: 34px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 79, 195, 0.34);
  background: rgba(255, 79, 195, 0.14);
  color: var(--blush);
  font-size: 0.86rem;
  font-weight: 950;
}

.weak-row,
.bookmark-row,
.lesson-row,
.search-row {
  min-height: 70px;
  display: grid;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
  text-align: left;
}

.weak-row {
  grid-template-columns: 1fr 58px;
}

.weak-row span,
.bookmark-row strong,
.lesson-row strong,
.search-row strong {
  font-weight: 900;
  line-height: 1.12;
}

.weak-row strong,
.bookmark-star,
.search-row span {
  color: var(--pink);
}

.empty-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.3;
  font-weight: 700;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 20px;
  justify-items: center;
}

.topic-card {
  width: 100%;
  min-height: 138px;
  padding: 13px 8px 11px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 79, 195, 0.08), rgba(9, 7, 11, 0.78)),
    rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow);
  color: var(--chrome);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  overflow: hidden;
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-card:hover,
.topic-card:active {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--glow);
}

.topic-icon,
.mini-icon,
.bookmark-star {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.34), rgba(255, 79, 195, 0.12)),
    rgba(16, 12, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 0 22px rgba(255, 79, 195, 0.22);
}

.topic-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.topic-icon svg {
  display: block;
  margin: auto;
}

.topic-card > span:not(.topic-icon) {
  display: block;
  max-width: 100%;
  font-size: clamp(0.76rem, 3.1vw, 1.02rem);
  line-height: 1.08;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.topic-card > span:not(.topic-icon):last-child {
  width: 100%;
  text-align: center;
  padding: 0 4px;
}

.lesson-row {
  width: 100%;
  grid-template-columns: 52px 1fr 24px;
  min-height: 86px;
}

.mini-icon {
  width: 46px;
  height: 46px;
  color: var(--pink);
}

.chevron {
  color: rgba(255, 255, 255, 0.46);
  font-size: 1.8rem;
}

.bookmark-row {
  grid-template-columns: 40px 1fr 22px;
}

.bookmark-row small,
.search-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.reader,
.quiz-card,
.flash-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.progress-strip {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 12px;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
}

.progress-dot.active {
  background: var(--pink);
  box-shadow: var(--glow);
}

.reader-card {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px 96px;
  touch-action: pan-y;
}

.reader-card h2 {
  margin: 3px 0 20px;
  color: var(--pink);
  text-shadow: var(--glow);
  font-size: clamp(1.62rem, 7vw, 2.48rem);
  line-height: 1.02;
}

.reader-card h3 {
  margin: 22px 0 9px;
  color: var(--mint);
  font-size: clamp(1.02rem, 4vw, 1.18rem);
}

.reader-card p,
.reader-card li {
  color: #fff9fd;
  font-size: clamp(1.02rem, 4.35vw, 1.26rem);
  line-height: 1.36;
}

.reader-card ul {
  padding-left: 1.15rem;
}

.reader-card li + li {
  margin-top: 8px;
}

.memory-box {
  margin: 18px 0;
  padding: 14px 15px;
  border-left: 4px solid var(--pink);
  border-radius: 14px;
  background: rgba(255, 79, 195, 0.12);
  color: #ffe7f7;
  font-size: clamp(1rem, 4.1vw, 1.18rem);
  line-height: 1.32;
}

.use-case-box {
  margin: 18px 0;
  padding: 14px 15px;
  border-radius: 16px;
  border: 1px solid rgba(99, 255, 216, 0.22);
  background: rgba(99, 255, 216, 0.08);
}

.use-case-box h3 {
  margin-top: 0;
}

.use-case-box ul {
  margin: 0;
}

.code-strip {
  margin: 14px 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(99, 255, 216, 0.22);
  background: rgba(2, 6, 8, 0.78);
  color: var(--mint);
  overflow-x: auto;
  white-space: nowrap;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

.bottom-nav,
.quiz-actions {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + 8px);
  display: grid;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, rgba(9, 7, 11, 0.9) 40%, #09070b 100%);
}

.bottom-nav {
  grid-template-columns: 52px minmax(100px, 1fr) minmax(112px, 1.12fr) 52px;
}

.pill-button {
  min-height: 54px;
  padding: 0 13px;
  font-size: 0.95rem;
  line-height: 1.05;
  white-space: nowrap;
}

.pill-button.secondary,
.quiz-ghost,
.quiz-nav-button,
.flash-tool {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  box-shadow: none;
}

.quiz-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 14px 96px;
}

.quiz-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.quiz-meter {
  height: 7px;
  margin-bottom: 20px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.11);
}

.quiz-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--mint));
  box-shadow: var(--glow);
}

.question {
  margin: 0 0 18px;
  color: var(--text);
  font-size: clamp(1.1rem, 5vw, 1.48rem);
  line-height: 1.28;
  font-weight: 900;
}

.answer-list {
  display: grid;
  gap: 11px;
}

.answer {
  min-height: 70px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 11px;
  align-items: center;
  padding: 12px 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
}

.answer-letter {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(255, 79, 195, 0.14);
  border: 1px solid rgba(255, 79, 195, 0.32);
  color: var(--blush);
  font-weight: 950;
}

.answer-text {
  font-size: clamp(0.96rem, 4.2vw, 1.16rem);
  line-height: 1.2;
  font-weight: 750;
}

.answer.selected {
  border-color: rgba(255, 79, 195, 0.62);
  background: rgba(255, 79, 195, 0.14);
  box-shadow: var(--glow);
}

.answer.selected .answer-letter {
  background: var(--pink);
  color: #170212;
}

.answer.correct {
  border-color: rgba(99, 255, 216, 0.58);
  background: rgba(99, 255, 216, 0.12);
}

.answer.correct .answer-letter {
  background: var(--mint);
  color: #02100c;
}

.answer.wrong {
  border-color: rgba(255, 92, 133, 0.66);
  background: rgba(255, 92, 133, 0.13);
}

.answer.wrong .answer-letter {
  background: var(--red);
  color: #fff;
}

.feedback,
.choice-breakdown {
  margin: 15px 0 0;
  padding: 13px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff6fd;
  line-height: 1.35;
}

.choice-breakdown {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.choice-breakdown > strong,
.choice-breakdown span {
  color: var(--pink);
}

.choice-breakdown p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.choice-breakdown p.right {
  color: #e9fff9;
}

.quiz-actions {
  grid-template-columns: 0.82fr 1.08fr 0.95fr 0.82fr;
}

.quiz-actions button {
  min-height: 52px;
  border-radius: 17px;
  font-weight: 950;
}

.score-card {
  margin-top: 18px;
  padding: 22px 18px;
  text-align: center;
}

.score-card .score {
  margin: 7px 0;
  color: var(--pink);
  text-shadow: var(--glow);
  font-size: clamp(3rem, 18vw, 6rem);
  line-height: 0.95;
  font-weight: 950;
}

.score-card p {
  color: var(--muted);
  line-height: 1.36;
  font-weight: 750;
}

.score-card .pill-button {
  width: 100%;
  margin-top: 10px;
}

.flash-meta,
.flash-tools {
  display: grid;
  gap: 10px;
}

.flash-meta {
  grid-template-columns: 1fr auto;
  margin: 2px 6px 14px;
  color: var(--muted);
  font-weight: 750;
}

.flash-tools {
  grid-template-columns: 0.74fr 0.72fr 1.25fr;
  margin: 0 0 14px;
}

.flash-tool {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 16px;
  font-size: 0.84rem;
  font-weight: 950;
  line-height: 1.05;
}

.flash-tool.saved {
  border-color: rgba(99, 255, 216, 0.32);
  background: rgba(99, 255, 216, 0.12);
  color: var(--mint);
}

.flash-card {
  flex: 1;
  width: 100%;
  min-height: 410px;
  padding: 27px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  touch-action: pan-y;
}

.flash-card.flipped {
  background:
    linear-gradient(145deg, rgba(99, 255, 216, 0.12), rgba(255, 79, 195, 0.06), rgba(6, 5, 8, 0.84)),
    var(--glass);
}

.flash-label {
  align-self: flex-start;
  margin-bottom: 18px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 79, 195, 0.28);
  background: rgba(255, 79, 195, 0.13);
  color: var(--blush);
  font-size: 0.8rem;
  font-weight: 950;
  text-transform: uppercase;
}

.flash-card strong {
  display: block;
  color: #fff;
  font-size: clamp(1.8rem, 8.4vw, 4.4rem);
  line-height: 1.05;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.flash-card.flipped strong {
  font-size: clamp(1.22rem, 5.5vw, 2.16rem);
  line-height: 1.18;
}

.flash-card small {
  display: block;
  margin-top: 22px;
  color: var(--muted);
  font-weight: 800;
}

.flash-subject-row {
  grid-template-columns: 52px 1fr 48px;
}

.search-input {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border-radius: 18px;
  border: 1px solid rgba(255, 79, 195, 0.32);
  background: rgba(7, 6, 10, 0.74);
  color: var(--text);
  font: inherit;
  font-weight: 850;
  outline: none;
}

.search-input:focus {
  box-shadow: var(--glow);
}

.search-row {
  min-height: 74px;
  display: grid;
  gap: 3px;
}

.utility-card {
  padding-bottom: 34px;
}

.cram-list,
.source-list {
  display: grid;
  gap: 12px;
}

.cram-item,
.source-row {
  padding: 12px 13px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
}

.cram-item .code-strip {
  margin-top: 0;
}

.cram-item p,
.source-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.32;
}

.source-row strong {
  color: var(--chrome);
  font-size: 1.05rem;
}

.command-lab-card .code-strip {
  margin-top: 22px;
}

@media (max-width: 520px) {
  .goal-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 370px) {
  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    grid-template-columns: 50px 1fr 50px;
  }

  .bottom-nav .pill-button.secondary {
    display: none;
  }
}

@media (min-width: 700px) {
  .topic-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }
}
