:root {
  --sidebar-width: 250px;
  --content-width: 1380px;
}

body {
  min-height: 100vh;
  letter-spacing: 0;
  line-height: 1.55;
}

button,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid #9bb89e;
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  width: var(--sidebar-width);
  padding: 28px 18px 20px;
  background: var(--white);
  border-right-color: var(--line);
}

.brand {
  margin: 0 0 42px 7px;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}

.sidebar-label {
  margin-bottom: 10px;
  font-size: 10px;
}

.main-nav {
  gap: 5px;
}

.nav-item {
  height: 46px;
  border-radius: 11px;
  font-size: 13px;
}

.nav-item.active {
  box-shadow: inset 3px 0 var(--green);
}

.streak-card {
  padding: 16px;
  border-radius: 15px;
  background: var(--paper);
}

.profile-row {
  padding-top: 17px;
}

.main-content {
  width: min(calc(100% - var(--sidebar-width)), var(--content-width));
  min-width: 0;
  max-width: none;
  margin-left: var(--sidebar-width);
  padding: 0 clamp(28px, 5vw, 72px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 72px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(14px);
}

.breadcrumb {
  font-size: 11px;
}

.view {
  min-width: 0;
  max-width: 100%;
  padding-top: 36px;
  padding-bottom: 36px;
}

.welcome-row {
  align-items: center;
  margin-bottom: 25px;
}

.welcome-row h1,
.page-intro h1 {
  font-size: clamp(29px, 3vw, 38px);
  line-height: 1.25;
}

.welcome-sub,
.page-intro p {
  font-size: 13px;
  line-height: 1.8;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 12px;
}

.hero-card {
  min-height: 238px;
  align-items: center;
  padding: 32px 36px;
  border-radius: 18px;
  background: var(--green-soft);
}

.hero-copy {
  width: 76%;
}

.hero-kicker {
  font-size: 10px;
}

.hero-copy h2 {
  margin-top: 13px;
  font-size: 28px;
}

.hero-copy > p {
  margin-bottom: 22px;
  font-size: 12px;
}

.subject-pills {
  gap: 8px;
}

.subject-pill {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 11px;
}

.subject-pill small {
  font-size: 9px;
}

.text-link,
.inline-link,
.subtle-link {
  font-size: 11px;
}

.text-link {
  margin-top: 17px;
}

.hero-art {
  left: 69%;
  opacity: 0.7;
}

.stats-grid {
  gap: 15px;
  margin-top: 17px;
}

.stat-card {
  height: 124px;
  padding: 17px 18px;
  border-radius: 14px;
  background: var(--white);
}

.stat-heading {
  font-size: 11px;
}

.stat-value {
  margin-top: 5px;
}

.stat-value strong {
  font-size: 30px;
}

.stat-foot {
  margin-top: 5px;
  font-size: 10px;
}

.lower-grid {
  align-items: stretch;
  gap: 15px;
  margin-top: 17px;
}

.lower-grid > *,
.stats-grid > *,
.practice-layout > *,
.challenge-layout > * {
  min-width: 0;
}

.hero-copy,
.welcome-row > *,
.panel-heading > * {
  min-width: 0;
}

.welcome-row h1,
.page-intro h1,
.question-text {
  overflow-wrap: anywhere;
}

.panel,
.recent-panel,
.focus-panel {
  border-color: var(--line);
  border-radius: 15px;
  background: var(--white);
  box-shadow: 0 8px 26px #384e3b08;
}

.recent-panel,
.focus-panel {
  min-height: 270px;
  padding: 20px;
}

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

.panel-heading h3 {
  margin-top: 5px;
  font-size: 18px;
}

.empty-recent {
  padding: 26px 0;
  font-size: 12px;
}

.focus-panel {
  display: flex;
  flex-direction: column;
}

.focus-panel .panel-heading {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.daily-goal-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.daily-goal-select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
}

.goal-progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.goal-progress-text {
  font-size: 17px;
  font-weight: 700;
}

.goal-progress-caption {
  color: var(--muted);
  font-size: 10px;
}

.goal-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--green-soft);
}

.goal-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.25s ease;
}

.focus-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.focus-timer-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.focus-kicker {
  color: var(--muted);
  font-size: 10px;
}

.focus-timer-value {
  color: var(--green-dark);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.focus-timer-status {
  color: var(--muted);
  font-size: 9px;
}

.focus-timer-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.focus-toggle,
.focus-reset {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 700;
}

.focus-toggle {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.focus-toggle:hover,
.primary-button:hover {
  filter: brightness(0.96);
}

.focus-session-count {
  margin-top: auto;
  padding-top: 10px;
  color: var(--muted);
  font-size: 10px;
}

.focus-session-count strong {
  color: var(--green);
}

.page-intro {
  margin-bottom: 24px;
}

.practice-layout {
  gap: 18px;
}

.practice-form {
  padding: 24px;
  border-radius: 15px;
}

.choice-grid {
  gap: 10px;
}

.choice-card {
  min-height: 118px;
  border-radius: 13px;
}

.choice-card:hover,
.answer-option:hover {
  transform: translateY(-1px);
}

.quiz-card {
  padding: clamp(22px, 4vw, 40px);
  border-radius: 17px;
}

.answer-option {
  min-height: 58px;
  border-radius: 12px;
}

.mistake-card,
.history-item {
  border-radius: 12px;
}

.challenge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.challenge-card,
.challenge-aside {
  padding: clamp(18px, 3vw, 28px);
}

.challenge-card-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}

.challenge-icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  flex: 0 0 43px;
  border-radius: 13px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 22px;
}

.challenge-card-heading h2,
.challenge-aside h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
}

.challenge-card-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.challenge-card > .field-label {
  display: block;
  margin-top: 15px;
}

.challenge-card > .field-label span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.challenge-server-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.challenge-server-row input,
.challenge-nickname {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
}

.challenge-server-row input:focus,
.challenge-nickname:focus {
  border-color: #9bb89e;
  outline: 2px solid #e6eee6;
}

.challenge-server-save {
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--green-dark);
  font-size: 11px;
}

.challenge-server-status {
  min-height: 19px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.challenge-join {
  min-width: 104px;
  white-space: nowrap;
}

.challenge-aside {
  background: var(--green-soft);
}

.challenge-aside h3 {
  margin: 9px 0 12px;
}

.challenge-aside ol {
  display: grid;
  gap: 11px;
  padding-left: 20px;
  color: #687365;
  font-size: 11px;
  line-height: 1.75;
}

.challenge-safety {
  margin: 15px 0;
  padding: 11px;
  border: 1px solid #dfe7dc;
  border-radius: 10px;
  background: #ffffffa6;
  color: #5f6e5c;
  font-size: 10px;
  line-height: 1.7;
}

.challenge-result {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.challenge-result[hidden] {
  display: none;
}

.challenge-result h3 {
  margin: 0 0 7px;
  font-size: 14px;
}

.challenge-result p {
  color: var(--muted);
  font-size: 10px;
}

.challenge-result ol {
  display: grid;
  gap: 5px;
  padding-left: 22px;
  font-size: 11px;
}

.share-completion {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--green-soft);
}

.share-completion h3 {
  margin: 0;
  font-family: var(--serif);
}

.share-completion p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.share-completion .challenge-share-url {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 10px;
}

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

.challenge-action-row button {
  min-height: 37px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 600;
}

.quiz-actions .share-hidden {
  display: none;
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 220px;
  }

  .main-content {
    padding-right: 28px;
    padding-left: 28px;
  }

  .hero-art {
    left: 66%;
    opacity: 0.45;
  }

  .hero-copy {
    width: 84%;
  }

  .lower-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .sidebar {
    width: min(290px, 86vw);
    padding: 24px 18px;
  }

  .main-content {
    width: 100%;
    margin: 0;
    padding: 0 18px 26px;
  }

  .challenge-layout,
  .challenge-card,
  .challenge-aside {
    min-width: 0;
    max-width: 100%;
  }

  .challenge-card {
    padding: 17px;
  }

  .challenge-server-row {
    flex-wrap: wrap;
  }

  .challenge-server-row input {
    flex: 1 1 190px;
  }

  .challenge-join {
    flex: 1 1 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card:last-child {
    grid-column: 1 / -1;
  }

  .topbar {
    height: 62px;
  }

  .view {
    padding-top: 25px;
  }

  .welcome-row {
    gap: 14px;
  }

  .welcome-row h1,
  .page-intro h1 {
    font-size: 29px;
  }

  .hero-card {
    min-height: 265px;
    padding: 22px 18px;
  }

  .hero-copy {
    width: 100%;
  }

  .hero-art {
    inset: 100px 0 0 56%;
    opacity: 0.25;
  }

  .subject-pills {
    max-width: 100%;
  }

  .subject-pill {
    height: 32px;
    padding: 0 9px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .stat-card {
    height: 96px;
    padding: 12px 15px;
  }

  .lower-grid {
    gap: 10px;
  }

  .recent-panel,
  .focus-panel {
    min-height: auto;
    padding: 16px;
  }

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

  .goal-progress-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .goal-progress-caption {
    font-size: 10px;
  }

  .focus-timer-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .focus-timer-actions {
    width: 100%;
  }

  .focus-toggle {
    flex: 1;
  }

  .practice-form {
    padding: 17px;
  }

  .choice-card {
    min-height: 98px;
  }

  .quiz-card {
    padding: 20px 16px;
  }
}

@media (max-width: 375px) {
  .main-content {
    padding-right: 14px;
    padding-left: 14px;
  }

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

  .stat-card:last-child {
    grid-column: auto;
  }

  .quiz-meta {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
