:root {
  --color-bg: #111e2b;
  --color-bg-secondary: #0e1b27;
  --color-bg-tertiary: #080d13;
  --color-text-primary: #d5e8f2;
  --color-text-secondary: #7aaabf;
  --color-border: rgba(43, 184, 184, 0.12);
  --color-border-hover: rgba(43, 184, 184, 0.38);
  --color-teal: #2bb8b8;
  --color-teal-dark: #1e9494;
  --color-teal-bright: #44d1d1;
  --color-teal-light: rgba(43, 184, 184, 0.15);
  --radius-md: 8px;
  --radius-lg: 16px;
  --font-head: "Ubuntu", sans-serif;
  --font-body: "Source Sans 3", "Ubuntu", sans-serif;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Ubuntu", sans-serif;
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: 56px;
}
.shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.app-header {
  margin-bottom: 2rem;
}
.app-header h1 {
  font-size: 22px;
  font-weight: 500;
}
.app-header p {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}
.app-header a {
  color: var(--color-teal-bright);
  text-decoration: none;
  font-weight: 700;
}
.app-header a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 2rem;
}
.phase-card {
  background: var(--color-bg);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.phase-card:hover {
  border-color: var(--color-teal);
}
.phase-card.active {
  border: 1.5px solid var(--color-teal);
}
.phase-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-teal-bright);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.phase-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.4;
}
.phase-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
}
.progress-bar {
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  margin-top: 10px;
}
.progress-fill {
  height: 100%;
  background: var(--color-teal);
  border-radius: 2px;
  transition: width 0.4s;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  background: var(--color-bg);
  border: 0.5px solid var(--color-border-hover);
  border-radius: var(--radius-md);
  font-family: "Ubuntu", sans-serif;
  margin-bottom: 1.5rem;
  padding: 8px 16px;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.back-btn:hover {
  background: var(--color-teal-light);
  border-color: var(--color-teal);
  color: var(--color-teal-bright);
}
.back-btn-bottom {
  margin-top: 2rem;
  margin-bottom: 0;
}
.section-title {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 4px;
}
.section-sub {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}
.score-widget {
  display: flex;
  gap: 24px;
  background: var(--color-bg);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 1.5rem;
}
.score-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}
.score-value {
  font-size: 22px;
  font-weight: 500;
  color: var(--color-teal-bright);
}
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.exercise-card {
  background: var(--color-bg);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.ex-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ex-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.badge-quiz {
  background: rgba(0, 128, 128, 0.2);
  color: var(--color-teal-bright);
  border: 0.5px solid rgba(0, 180, 180, 0.3);
}
.badge-challenge {
  background: rgba(0, 100, 60, 0.25);
  color: #4dd9a0;
  border: 0.5px solid rgba(0, 180, 100, 0.3);
}
.badge-flashcard {
  background: var(--color-teal-light);
  color: var(--color-teal-bright);
  border: 0.5px solid rgba(0, 180, 180, 0.25);
}
.badge-ranking {
  background: rgba(120, 80, 0, 0.3);
  color: #f0c060;
  border: 0.5px solid rgba(200, 140, 0, 0.3);
}
.score-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
}
.score-high {
  background: rgba(0, 120, 80, 0.25);
  color: #4dd9a0;
  border: 0.5px solid rgba(0, 180, 100, 0.3);
}
.score-mid {
  background: rgba(120, 80, 0, 0.3);
  color: #f0c060;
  border: 0.5px solid rgba(200, 140, 0, 0.3);
}
.score-low {
  background: rgba(160, 40, 40, 0.25);
  color: #f08080;
  border: 0.5px solid rgba(220, 80, 80, 0.3);
}
.ex-question {
  font-size: 15px;
  color: var(--color-text-primary);
  line-height: 1.65;
  margin-bottom: 14px;
}
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  background: var(--color-bg-secondary);
  font-size: 14px;
  color: var(--color-text-primary);
  font-family: "Ubuntu", sans-serif;
  transition:
    border-color 0.15s,
    background 0.15s;
  line-height: 1.5;
  width: 100%;
}
.option-btn:hover:not(:disabled) {
  border-color: var(--color-teal);
  background: var(--color-teal-light);
}
.option-btn.correct {
  background: rgba(0, 120, 80, 0.2);
  border-color: #00a060;
  color: #4dd9a0;
}
.option-btn.wrong {
  background: rgba(160, 40, 40, 0.2);
  border-color: #c04040;
  color: #f08080;
}
.option-letter {
  font-weight: 700;
  min-width: 20px;
  font-size: 13px;
  color: var(--color-teal-bright);
}
.option-btn.correct .option-letter,
.option-btn.wrong .option-letter {
  color: inherit;
}
.feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.65;
}
.feedback.correct {
  background: rgba(0, 120, 80, 0.15);
  color: #4dd9a0;
  border: 0.5px solid rgba(0, 180, 100, 0.4);
}
.feedback.wrong {
  background: rgba(160, 40, 40, 0.15);
  color: #f08080;
  border: 0.5px solid rgba(220, 80, 80, 0.4);
}
.textarea-input {
  width: 100%;
  min-height: 90px;
  padding: 10px 12px;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: "Ubuntu", sans-serif;
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  resize: vertical;
  line-height: 1.6;
}
.textarea-input:focus {
  outline: none;
  border-color: var(--color-teal);
}
.textarea-input:disabled {
  opacity: 0.6;
}
.answer-reveal {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--color-bg-secondary);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.75;
  color: var(--color-text-secondary);
  white-space: pre-line;
}
.answer-reveal strong {
  color: var(--color-teal-bright);
  display: block;
  margin-bottom: 6px;
}
.btn {
  padding: 8px 18px;
  border: 0.5px solid var(--color-border-hover);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: "Ubuntu", sans-serif;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.btn:hover {
  background: var(--color-teal-light);
  border-color: var(--color-teal);
}
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--color-teal);
  color: #fff;
  border-color: var(--color-teal);
  font-weight: 500;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-teal-dark);
  border-color: var(--color-teal-dark);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.hint-text {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: 10px;
}
.flashcard {
  perspective: 1000px;
  cursor: pointer;
}
.flashcard-inner {
  min-height: 120px;
  position: relative;
  transition: transform 0.5s;
  transform-style: preserve-3d;
}
.flashcard-inner.flipped {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  width: 100%;
  min-height: 120px;
  backface-visibility: hidden;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  text-align: center;
}
.flashcard-front {
  background: rgba(43, 184, 184, 0.12);
  border: 1px solid rgba(43, 184, 184, 0.35);
  color: var(--color-teal-bright);
  font-weight: 500;
  font-size: 16px;
}
.flashcard-back {
  background: var(--color-bg-secondary);
  border: 0.5px solid var(--color-border);
  transform: rotateY(180deg);
  color: var(--color-text-primary);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-line;
}
.flashcard-hint {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 8px;
}
.rice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 10px 0;
}
.rice-table th {
  padding: 6px 10px;
  text-align: left;
  color: var(--color-text-secondary);
  font-weight: 500;
  border-bottom: 0.5px solid var(--color-border);
  font-size: 12px;
}
.rice-table td {
  padding: 6px 10px;
  border-bottom: 0.5px solid var(--color-border);
  color: var(--color-text-primary);
}
.rice-table input {
  width: 65px;
  padding: 4px 6px;
  border: 0.5px solid var(--color-border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-family: "Ubuntu", sans-serif;
}
.rice-table input:focus {
  outline: none;
  border-color: var(--color-teal);
}
.global-bar {
  background: var(--color-bg);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.global-stat {
  display: flex;
  flex-direction: column;
}
.global-stat-label {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.global-stat-value {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-teal-bright);
}
.global-progress {
  flex: 1;
  min-width: 120px;
}
.global-progress-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
}
.global-progress-fill {
  height: 100%;
  background: var(--color-teal);
  border-radius: 2px;
  transition: width 0.4s;
}
.reset-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 0.5px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.saved-indicator {
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.saved-indicator::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-teal);
}
.btn-reset {
  font-size: 12px;
  padding: 6px 14px;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}
.btn-reset:hover {
  color: #f08080;
  border-color: rgba(220, 80, 80, 0.5);
  background: rgba(160, 40, 40, 0.15);
}
.btn-danger {
  background: #8b2020;
  color: #f08080;
  border-color: rgba(220, 80, 80, 0.5);
}
.btn-danger:hover {
  background: #a02828;
}
.confirm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.honesty-banner {
  background: rgba(120, 80, 0, 0.2);
  border: 1px solid rgba(200, 140, 0, 0.4);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 2rem;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.honesty-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.honesty-title {
  font-size: 15px;
  font-weight: 500;
  color: #f0c060;
  margin-bottom: 6px;
}
.honesty-body {
  font-size: 13px;
  color: #c9a040;
  line-height: 1.7;
}
.honesty-body strong {
  color: #f0c060;
}
.start-screen {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}
.start-card {
  background: var(--color-bg);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 44px 48px;
  max-width: 520px;
  width: 100%;
}
.start-logo {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-teal-bright);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.start-title {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 10px;
}
.start-sub {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
}
.start-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
  color: var(--color-text-secondary);
}
.start-input {
  width: 100%;
  padding: 12px 14px;
  border: 0.5px solid var(--color-border-hover);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: "Ubuntu", sans-serif;
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  margin-bottom: 20px;
  transition: border-color 0.15s;
}
.start-input:focus {
  outline: none;
  border-color: var(--color-teal);
}
.start-note {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 16px;
  line-height: 1.6;
}
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 12px;
}
.results-title {
  font-size: 20px;
  font-weight: 500;
}
.results-name {
  font-size: 14px;
  color: var(--color-text-secondary);
}
.results-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-bottom: 1.5rem;
  align-items: start;
}
.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--color-teal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 32px rgba(43, 184, 184, 0.35);
}
.score-circle-num {
  font-size: 32px;
  font-weight: 700;
  color: #050d12;
  line-height: 1;
}
.score-circle-label {
  font-size: 12px;
  color: rgba(5, 13, 18, 0.75);
  margin-top: 2px;
}
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}
.results-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.7;
}
.phase-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 1.5rem 0;
}
.phase-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 44px;
  align-items: center;
  gap: 12px;
}
.phase-bar-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phase-bar-track {
  height: 10px;
  background: rgba(43, 184, 184, 0.18);
  border-radius: 5px;
  overflow: hidden;
}
.phase-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}
.phase-bar-pct {
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  color: var(--color-text-primary);
}
.share-section {
  background: var(--color-bg-secondary);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-top: 1.5rem;
}
.share-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}
.share-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}
.share-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-results-nav {
  padding: 10px 20px;
  font-size: 14px;
}
.results-stat-row {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.results-stat {
  background: var(--color-bg-secondary);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  flex: 1;
  min-width: 100px;
}
.results-stat-label {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.results-stat-value {
  font-size: 20px;
  font-weight: 500;
  color: var(--color-teal-bright);
}

/* ── Page Nav ── */
.page-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(8, 13, 19, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(43, 184, 184, 0.12);
  padding: 0.8rem 1.5rem;
}
.page-nav-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #e8f4fa;
  transition: opacity 0.2s;
}
.page-brand:hover {
  opacity: 0.85;
}
.page-brand-icon {
  border-radius: 50%;
}
.page-brand-name {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.page-brand-sub {
  display: block;
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--color-teal-bright);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
}
.page-nav-title {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}
@media (max-width: 480px) {
  .page-nav-title {
    display: none;
  }
}

/* ── PDF Banner ── */
.pdf-banner {
  background: rgba(43, 184, 184, 0.07);
  border: 1px solid rgba(43, 184, 184, 0.25);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.pdf-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}
.pdf-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-teal-bright);
  margin-bottom: 5px;
}
.pdf-banner-body {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.7;
}
.pdf-banner-body strong {
  color: var(--color-text-primary);
}
.pdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 16px;
  background: var(--color-teal);
  color: #050d12;
  border-radius: 50px;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s;
}
.pdf-download-btn:hover {
  background: var(--color-teal-bright);
}

/* ── Back to top ── */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-teal);
  background: rgba(8, 13, 19, 0.85);
  color: var(--color-teal-bright);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    background 0.2s ease,
    color 0.2s ease;
  pointer-events: none;
  text-decoration: none;
  line-height: 1;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--color-teal);
  color: #080d13;
  box-shadow: 0 0 18px rgba(43, 184, 184, 0.3);
}
@media (max-width: 575px) {
  .back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
  }
}
