:root {
  color-scheme: light;
  --bg: #eff1f5;
  --ink: #12151b;
  --muted: #5a6572;
  --accent: #0a84ff;
  --accent-2: #34c759;
  --accent-3: #ff9f0a;
  --card: rgba(255, 255, 255, 0.82);
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 18px 40px rgba(16, 22, 30, 0.12);
  --radius: 24px;
  --ios-blur: saturate(180%) blur(20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f6f7fb 0%, #e9edf5 55%, #eef1f6 100%);
  min-height: 100vh;
  line-height: 1.6;
  padding: 32px clamp(16px, 4vw, 48px) calc(120px + env(safe-area-inset-bottom));
}

.app,
main,
.hero {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.app {
  width: 100%;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.orb {
  position: fixed;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  opacity: 0.25;
  filter: blur(0px);
  z-index: 0;
}

.orb-one {
  background: radial-gradient(circle, rgba(10, 132, 255, 0.5), transparent 70%);
  top: -140px;
  right: 6%;
}

.orb-two {
  background: radial-gradient(circle, rgba(52, 199, 89, 0.4), transparent 70%);
  bottom: -120px;
  left: 5%;
}

.hero,
.section {
  position: relative;
  z-index: 1;
}

.hero {
  background: var(--card);
  backdrop-filter: var(--ios-blur);
  border-radius: 28px;
  padding: clamp(24px, 5vw, 48px);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  animation: fadeUp 0.9s ease-out both;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

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

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  display: block;
  flex-shrink: 0;
}

.logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-title {
  font-family: "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand-title-accent {
  color: #06124b;
}

#brand-title-suffix {
  display: block;
  margin-top: 0;
  text-transform: none;
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  letter-spacing: inherit;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 14px;
}

.lang-toggle {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: var(--ios-blur);
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

.hero-content {
  margin-top: 28px;
  max-width: 720px;
}

.hero h1 {
  font-family: "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", sans-serif;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero p {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.btn {
  border: none;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(10, 132, 255, 0.28);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent);
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: var(--ios-blur);
}

.btn.success {
  background: var(--accent-2);
  color: #fff;
}

.btn.danger {
  background: #ff453a;
  color: #fff;
}

.btn:hover {
  transform: translateY(-2px);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #667084;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.tab-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: var(--ios-blur);
  box-shadow: 0 12px 30px rgba(16, 22, 30, 0.18);
  z-index: 5;
}

.tab-button {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 18px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-button.active {
  background: rgba(10, 132, 255, 0.15);
  color: var(--accent);
}

.tab-label {
  font-size: 14px;
}

.tab-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.tab-icon svg {
  width: 100%;
  height: 100%;
}

.update-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: var(--ios-blur);
  box-shadow: 0 16px 36px rgba(16, 22, 30, 0.16);
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 6;
}

.update-banner.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.update-text {
  font-weight: 600;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.update-actions {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: stretch;
  align-items: center;
  width: 100%;
}

.update-actions .btn {
  font-size: 16px;
  min-width: 0;
  flex: 1 1 0;
  justify-content: center;
}

.a2hs-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  top: calc(12px + env(safe-area-inset-top));
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #0d4b7a, #062a4f);
  color: #f5f7fb;
  box-shadow: 0 18px 34px rgba(6, 18, 34, 0.25);
  z-index: 7;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.a2hs-banner.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.a2hs-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

.a2hs-icon svg,
.a2hs-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.a2hs-content {
  flex: 1;
  display: grid;
  gap: 4px;
}

.a2hs-title {
  font-weight: 700;
}

.a2hs-text {
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  color: rgba(245, 247, 251, 0.9);
}

.a2hs-steps {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: rgba(245, 247, 251, 0.95);
}

.a2hs-step {
  display: flex;
  align-items: center;
  gap: 6px;
}

.a2hs-share-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: #f5f7fb;
}

.a2hs-add-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: #f5f7fb;
}

.a2hs-share-icon svg {
  width: 100%;
  height: 100%;
}

.a2hs-add-icon svg {
  width: 100%;
  height: 100%;
}

.a2hs-close {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
}

.section {
  margin-bottom: 48px;
}

.section-head {
  margin-bottom: 22px;
  max-width: 760px;
}

.section h2 {
  font-family: "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", sans-serif;
  font-size: clamp(26px, 4vw, 36px);
  margin-bottom: 10px;
}

.section p {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.steps {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: var(--card);
  backdrop-filter: var(--ios-blur);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 30px rgba(16, 22, 30, 0.1);
  animation: fadeUp 0.8s ease both;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.step-number {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-2);
  margin-bottom: 6px;
  font-weight: 700;
}

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

.card ul {
  list-style: none;
  display: grid;
  gap: 8px;
  padding: 0;
}

.card li::before {
  content: "•";
  margin-right: 8px;
  color: var(--accent);
}

.note {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(10, 132, 255, 0.12);
  color: var(--accent);
  font-weight: 500;
  border: 1px solid rgba(10, 132, 255, 0.18);
  display: flex;
  flex-direction: column;
}

.note .stripe-wrap {
  margin-top: 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: visible;
}

stripe-buy-button {
  display: inline-block;
  transform: scale(0.85);
  transform-origin: top center;
  font-size: 16px;
}

.practice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

select {
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 10px 36px 10px 12px;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.mode-toggle {
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: var(--ios-blur);
}

#exam-type-toggle {
  display: none;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.practice-controls .mode-btn {
  font-size: 16px;
}

.settings-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.settings-subtitle {
  margin-top: 20px;
}

.settings-subdesc {
  margin-bottom: 2px;
}

.settings-divider {
  height: 1px;
  margin: 18px 0;
  background: rgba(0, 0, 0, 0.1);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.05);
  backdrop-filter: var(--ios-blur);
}

.settings-label {
  font-weight: 600;
  color: var(--ink);
}

.settings-update-actions {
  margin-top: 12px;
}

.settings-update-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  min-height: 20px;
}

.settings-version {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.settings-contact-line {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.settings-contact-line a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d7dde6;
  border-radius: 999px;
  transition: 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.switch input:checked + .slider {
  background: var(--accent-2);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.practice-area {
  display: grid;
  gap: 18px;
}

.practice-card {
  min-height: 240px;
}

#study-card {
  position: relative;
}

#exam-card {
  display: none;
  position: relative;
}

.practice-meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.exam-restart-top {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 6px 12px;
  font-size: 14px;
}

.answers {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  color: var(--accent);
}

.answers.hidden {
  display: none;
}

.exam-option {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}

.exam-option.correct {
  border-color: rgba(52, 199, 89, 0.5);
  background: rgba(52, 199, 89, 0.16);
}

.exam-option.incorrect {
  border-color: rgba(255, 69, 58, 0.5);
  background: rgba(255, 69, 58, 0.16);
}

.exam-option.selected {
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.35);
}

.exam-option:disabled {
  cursor: default;
}

.exam-feedback {
  margin-top: 12px;
  font-weight: 600;
  color: var(--muted);
}

.exam-feedback.success {
  color: #1f8e4f;
}

.exam-feedback.error {
  color: #b9362d;
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

#exam-oral-actions {
  width: 100%;
}

#exam-reveal {
  flex: 1 1 100%;
}

#exam-correct,
#exam-incorrect {
  flex: 1 1 calc(50% - 5px);
  max-width: calc(50% - 5px);
  min-height: 54px;
  white-space: pre-line;
  text-align: center;
  justify-content: center;
  line-height: 1.15;
}

#study-next,
#exam-next {
  font-size: 16px;
}

#study-toggle {
  font-size: 16px;
}

#exam-next:disabled {
  background: #c8ced8;
  color: #6a7380;
  box-shadow: none;
  cursor: not-allowed;
}

#exam-next:disabled:hover {
  transform: none;
}

#exam-reveal,
#exam-correct,
#exam-incorrect {
  font-size: 16px;
}

#cta-primary {
  font-size: 16px;
}

#settings-check-updates {
  font-size: 16px;
}

#exam-quiz-actions {
  justify-content: flex-end;
}

.exam-status {
  margin-top: 16px;
  font-weight: 600;
  color: var(--accent);
}

.exam-review {
  display: none;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 16px;
  line-height: 1.45;
}

.exam-review.show {
  display: block;
}

.exam-review h4 {
  font-size: 16px;
  margin-bottom: 12px;
}

.exam-review-list {
  display: grid;
  gap: 10px;
}

.exam-review-item {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 8px;
}

.exam-review-item.is-correct {
  border-color: rgba(52, 199, 89, 0.45);
  background: rgba(52, 199, 89, 0.1);
}

.exam-review-item.is-incorrect {
  border-color: rgba(255, 69, 58, 0.45);
  background: rgba(255, 69, 58, 0.1);
}

.exam-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 16px;
  color: var(--muted);
}

.exam-review-result {
  font-weight: 700;
}

.exam-review-item.is-correct .exam-review-result {
  color: #1f8e4f;
}

.exam-review-item.is-incorrect .exam-review-result {
  color: #b9362d;
}

.exam-review-question {
  font-weight: 600;
}

.exam-review-line {
  color: var(--muted);
  font-size: 16px;
}

.exam-review-line strong {
  color: var(--ink);
}

.sources {
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
}

.sources li {
  background: var(--card);
  backdrop-filter: var(--ios-blur);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.sources a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.credits {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 500;
}

.credits a {
  color: var(--accent);
  text-decoration: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 24px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
  }
}
