:root {
  --bg: #f6f0e4;
  --bg-deep: #f1e7d6;
  --surface: rgba(255, 252, 246, 0.92);
  --surface-strong: #ffffff;
  --text: #1f2937;
  --subtext: #4b5563;
  --border: #3f3f46;
  --border-soft: #d6cbb9;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: #e0f2f1;
  --accent: #b45309;
  --accent-soft: #fff3e0;
  --shadow: 0 22px 54px rgba(68, 48, 24, 0.12);
  --focus-ring: rgba(15, 118, 110, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.dashboard-page {
  margin: 0;
  font-family: "Noto Sans SC", "Atkinson Hyperlegible", "Noto Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(180, 83, 9, 0.14), transparent 26%),
    radial-gradient(circle at left top, rgba(15, 118, 110, 0.14), transparent 30%),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 58%, var(--bg-deep) 100%);
  line-height: 1.6;
}

a,
button,
input {
  font: inherit;
}

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

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  top: -56px;
  left: 16px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 16px;
}

.learner-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  gap: 16px;
}

.learner-shell-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.learner-shell-label {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtext);
}

.learner-shell-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.learner-shell-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.learner-shell-link:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: #fff;
}

.learner-shell-link[aria-current="page"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.18);
}

.learner-sidebar-note,
.panel {
  border: 2px solid var(--border-soft);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.learner-sidebar-note {
  padding: 18px;
  color: var(--subtext);
}

.learner-sidebar-note strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.learner-content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  padding: 20px;
}

.dashboard-hero {
  display: grid;
  gap: 18px;
}

.dashboard-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-hero-copy {
  min-width: 0;
}

.hero-eyebrow,
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.dashboard-hero h1 {
  margin-top: 10px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
}

.status,
.detail-empty,
.meta,
.history-subtitle,
.supporting-copy,
.account-user-label {
  color: var(--subtext);
}

.account-controls {
  position: relative;
  flex: none;
}

.account-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(280px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 10;
}

.account-user {
  padding: 8px 10px 4px;
}

.account-user-value {
  margin-top: 4px;
  font-weight: 700;
  word-break: break-word;
}

.menu-action,
.btn,
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 0 16px;
  border-radius: 16px;
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.menu-action {
  background: var(--primary-soft);
  color: var(--text);
  justify-content: flex-start;
  width: 100%;
}

.menu-action-secondary {
  background: #f7efe4;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-secondary,
.link-btn {
  background: #fff7ee;
  border-color: var(--border-soft);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dashboard-section {
  display: grid;
  gap: 16px;
  outline: none;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  margin-top: 10px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}

.dashboard-home-grid,
.activity-layout,
.summary-grid,
.home-summary-grid,
.journey-steps,
.history-list,
.attempt-list,
.detail-review-shell,
.detail-section,
.feed-entry-actions {
  display: grid;
  gap: 12px;
}

.overview-card,
.journey-card,
.login-card,
.quiz-section-shell {
  display: grid;
  gap: 14px;
}

.home-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.summary-card,
.home-metric,
.journey-step,
.history-card,
.attempt-item,
.detail-shell-card {
  border: 2px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface-strong);
}

.summary-card,
.home-metric {
  padding: 14px;
}

.summary-card strong,
.home-metric strong {
  display: block;
  font-size: 1.5rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-row .btn {
  width: auto;
  min-width: 180px;
}

.journey-step {
  padding: 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.journey-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.login-card form {
  display: grid;
  gap: 12px;
}

.field {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
}

.quiz-list {
  display: grid;
  gap: 12px;
}

.activity-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-card,
.attempt-item {
  padding: 14px;
}

.history-card.is-selected {
  border-color: var(--primary);
  background: #f1fbfa;
}

.history-card.is-revealed,
.attempt-item.is-revealed {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.feed-entry-main {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.history-card-body {
  display: grid;
  gap: 10px;
}

.history-card-header,
.attempt-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
}

.badge.in-progress {
  background: var(--primary);
}

.feed-entry-cta,
.attempt-item button {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
}

.feed-entry-cta {
  background: var(--primary);
  color: #fff;
}

.feed-entry-secondary,
.attempt-item button {
  background: #fff7ee;
  border-color: var(--border-soft);
  color: var(--text);
}

.detail-summary,
.detail-block {
  display: grid;
  gap: 10px;
}

.detail-section {
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.detail-section:first-of-type {
  padding-top: 0;
  border-top: none;
}

.detail-section-title {
  font-size: 1rem;
}

.review-list {
  display: grid;
  gap: 12px;
  padding: 0;
  list-style: none;
  margin: 0;
}

.review-item {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.review-item.incorrect {
  border-color: #b91c1c;
  background: #fff7f7;
}

.reference-list,
.review-references {
  margin: 8px 0 0 20px;
}

.detail-empty {
  min-height: 72px;
  display: grid;
  align-items: center;
}

.account-menu-button:focus-visible,
.menu-action:focus-visible,
.btn:focus-visible,
.link-btn:focus-visible,
.feed-entry-main:focus-visible,
.feed-entry-cta:focus-visible,
.attempt-item button:focus-visible,
.field:focus-visible,
.learner-shell-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (min-width: 960px) {
  .learner-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: start;
  }

  .learner-shell-sidebar {
    position: sticky;
    top: 16px;
  }

  .learner-shell-nav {
    flex-direction: column;
  }

  .dashboard-home-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.9fr);
  }

  .activity-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .feed-entry-actions {
    grid-template-columns: 1fr 1fr;
  }

  .activity-panel-head .btn {
    width: auto;
  }
}

@media (max-width: 959px) {
  .dashboard-hero-head,
  .section-heading,
  .activity-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .account-controls {
    width: 100%;
  }

  .account-menu-button {
    width: 100%;
    justify-content: center;
  }

  .action-row .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
