:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --line: #e5e7eb;
  --surface: #f8fafc;
  --shadow: 0 12px 30px rgba(17, 17, 17, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 18px 34px;
}

.brand-block h1,
.page-heading h2,
.panel h3,
.lesson-section h3 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.25;
}

.brand-block h1 {
  font-size: 30px;
}

.brand-block p,
.panel p,
.lesson-section p {
  margin: 10px 0 0;
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.brand-block > p:last-child,
.muted,
.lesson-meta-list dt,
.word-card p,
.note-card p,
.panel p,
.lesson-section p {
  color: var(--muted);
}

.nav-list {
  display: flex;
  width: 100%;
  max-width: 1120px;
  gap: 10px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-item {
  display: inline-flex;
  min-height: 48px;
  flex: 1 0 0;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 16px;
  text-align: center;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  border-color: #bfdbfe;
  background: var(--accent-soft);
  color: var(--text);
  outline: none;
}

.nav-mark {
  display: none;
}

.main-area {
  min-width: 0;
  padding: 34px;
}

.page {
  display: none;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.page.is-active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading > div {
  min-width: 0;
}

.page-heading > *,
.section-heading > *,
.home-grid > *,
.lesson-layout > *,
.lesson-preview > * {
  min-width: 0;
}

.page-heading h2 {
  margin-top: 6px;
  font-size: 40px;
}

.home-heading {
  display: grid;
  justify-content: flex-start;
  gap: 14px;
}

.home-heading .primary-action {
  width: fit-content;
}

.day-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.day-navigation .eyebrow {
  min-width: 52px;
  margin: 0 4px;
  text-align: center;
  font-size: 14px;
}

.nav-btn {
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.primary-action,
.secondary-action {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-action {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.secondary-action {
  border: 1px solid #bfdbfe;
  background: #ffffff;
  color: var(--accent);
}

.primary-action:hover,
.primary-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible {
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.6fr);
  gap: 18px;
}

.panel,
.lesson-section,
.word-card,
.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.goal-panel h3,
.stats-panel h3,
.lesson-preview h3,
.checkin-panel h3,
.note-editor h3 {
  margin-top: 6px;
  font-size: 22px;
}

.goal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.goal-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 14px;
}

.streak-number {
  color: var(--text);
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
}

.checkin-panel,
.lesson-preview {
  margin-top: 18px;
}

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

.checkin-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.day-cell {
  display: grid;
  min-height: 88px;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  text-align: center;
}

.day-cell strong {
  font-size: 18px;
}

.day-cell span {
  color: var(--muted);
  font-size: 13px;
}

.day-cell.is-done {
  border-color: #bfdbfe;
  background: var(--accent-soft);
}

.lesson-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
}

.lesson-meta-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 10px;
  margin: 0;
}

.lesson-meta-list div {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
}

.lesson-meta-list dt {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.lesson-meta-list dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.lesson-layout {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.lesson-tab-strip {
  position: sticky;
  top: 24px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lesson-index {
  position: static;
  display: flex;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.lesson-index::-webkit-scrollbar {
  display: none;
}

.lesson-index a {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 16px;
  text-decoration: none;
  white-space: nowrap;
}

.lesson-index a:hover,
.lesson-index a:focus-visible,
.lesson-index a.is-active {
  border-color: #bfdbfe;
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.lesson-tab-control {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  box-shadow: var(--shadow);
}

.lesson-tab-control:hover,
.lesson-tab-control:focus-visible {
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}

.lesson-tab-control span {
  font-size: 18px;
  line-height: 1;
}

.lesson-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.lesson-section {
  min-width: 0;
  padding: 24px;
  scroll-margin-top: 20px;
}

.lesson-section h3 {
  margin-top: 6px;
  font-size: 22px;
}

.lesson-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 12px;
}

.lesson-footer-nav .eyebrow {
  min-width: 64px;
  text-align: center;
  font-size: 14px;
}

.simple-list,
.pattern-list {
  margin: 14px 0 0;
  padding-left: 22px;
}

.simple-list li,
.pattern-list li {
  margin: 8px 0;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  margin-top: 18px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td:first-child {
  font-weight: 800;
}

.reading-content {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.reading-paragraph,
.reading-dialogue {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.reading-dialogue {
  padding-left: 16px;
  border-left: 3px solid #bfdbfe;
}

.reading-speaker {
  display: inline-block;
  margin-right: 8px;
  color: var(--accent);
  font-weight: 700;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 12px 14px;
}

textarea {
  display: block;
  margin: 16px 0 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}

.search-box {
  display: grid;
  min-width: min(300px, 100%);
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.word-card {
  display: grid;
  min-height: 176px;
  gap: 12px;
  padding: 18px;
}

.word-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.word-card h3 {
  margin: 0;
  font-size: 22px;
}

.word-card button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 800;
}

.word-card button.is-saved {
  border-color: #bfdbfe;
  background: var(--accent-soft);
  color: var(--accent);
}

.word-card .example {
  color: var(--text);
}

.note-editor {
  margin-bottom: 16px;
}

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

.note-card {
  padding: 18px;
}

.note-card h3 {
  margin: 0;
  font-size: 18px;
}

.note-card p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(16px);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 920px) {
  .side-nav {
    padding: 22px;
  }

  .nav-item {
    padding: 0 8px;
  }

  .nav-mark {
    display: none;
  }

  .main-area {
    padding: 24px;
  }

  .page-heading h2 {
    font-size: 34px;
  }

  .home-grid,
  .lesson-layout,
  .lesson-preview {
    grid-template-columns: 1fr;
  }

  .lesson-tab-strip {
    top: 18px;
  }

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

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .main-area,
  .side-nav {
    width: 100%;
    padding: 18px 16px;
  }

  .side-nav {
    align-items: stretch;
    padding: 14px 16px;
  }

  .brand-block h1 {
    font-size: 28px;
  }

  .page-heading,
  .section-heading {
    display: grid;
    width: 100%;
    gap: 14px;
  }

  .page-heading > div,
  .page-heading > button,
  .section-heading > div,
  .section-heading > button {
    width: 100%;
    min-width: 0;
  }

  .page-heading h2 {
    font-size: 30px;
    line-height: 1.22;
  }

  .day-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    width: 100%;
    gap: 8px;
  }

  .day-navigation .eyebrow {
    align-self: center;
    min-width: 54px;
    margin: 0;
  }

  .nav-btn {
    width: 100% !important;
    min-width: 0;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .nav-list {
    gap: 8px;
  }

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

  .lesson-meta-list,
  .word-grid {
    grid-template-columns: 1fr;
  }

  .lesson-tab-strip {
    width: 100%;
    gap: 8px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .lesson-index {
    width: 100%;
    padding: 8px;
  }

  .lesson-index a {
    min-height: 40px;
    padding: 8px 14px;
  }

  .lesson-tab-control {
    width: 38px;
    height: 38px;
  }

  .lesson-content {
    width: 100%;
  }

  .lesson-footer-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    padding-bottom: 0;
  }

  .lesson-footer-nav .eyebrow {
    align-self: center;
    min-width: 54px;
  }

  .lesson-section,
  .panel,
  .word-card,
  .note-card {
    width: 100%;
    padding: 20px 18px;
  }

  .lesson-section h3,
  .panel h3,
  .word-card h3,
  .note-card h3,
  p,
  li,
  td,
  dd,
  textarea,
  input {
    overflow-wrap: break-word;
  }

}

/* Custom Day Selection & Navigation Styles */
.day-cell.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  font-weight: 700;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none !important;
}

@media (min-width: 641px) {
  .secondary-action.nav-btn {
    width: auto;
  }

  .home-heading .primary-action {
    width: auto;
  }
}
