:root {
  --bg: #f6f2ec;
  --surface: #ffffff;
  --text: #1d232b;
  --muted: #5f6976;
  --border: #ddd4c8;
  --shadow: 0 16px 36px rgba(28, 35, 43, 0.08);
  --radius: 20px;
  --sidebar-width: 320px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f7f3ed 0%, #f2ede5 100%);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; }

.menu-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 60;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  border: 0;
  background: rgba(21, 28, 36, 0.92);
  box-shadow: var(--shadow);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 14px;
  cursor: pointer;
}
.menu-toggle span {
  height: 2.5px;
  border-radius: 99px;
  background: #ffffff;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  max-width: calc(100vw - 28px);
  background: #fffdf9;
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  z-index: 55;
  overflow-y: auto;
  box-shadow: 18px 0 42px rgba(20, 28, 35, 0.15);
}
.sidebar.open { transform: translateX(0); }
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 24, 0.48);
  z-index: 50;
}
.sidebar-inner { padding: 28px 22px 32px; }
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.sidebar-close {
  border: 1px solid var(--border);
  background: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}
.sidebar-nav { display: grid; gap: 10px; }
.sidebar-link {
  display: block;
  padding: 13px 14px;
  border-radius: 14px;
  font-weight: 600;
}
.sidebar-link:hover, .sidebar-link.active { background: #f1ece4; }
.sidebar-section-title {
  margin: 10px 4px 0;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.sidebar-level {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}
.level-toggle {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.level-toggle-main { display: flex; align-items: center; gap: 12px; }
.level-chip {
  min-width: 44px;
  text-align: center;
  padding: 9px 10px;
  border-radius: 12px;
  font-weight: 800;
  color: #fff;
}
.level-name { display: block; font-weight: 800; }
.level-subtitle { display: block; color: var(--muted); font-size: 0.9rem; }
.level-arrow { transition: transform 0.2s ease; font-size: 1rem; }
.level-toggle.open .level-arrow { transform: rotate(180deg); }
.level-panel { display: none; padding: 0 10px 10px; }
.level-panel.open { display: grid; gap: 8px; }
.sidebar-sublink {
  display: block;
  padding: 11px 12px;
  border-radius: 12px;
  color: #29313a;
}
.sidebar-sublink:hover, .sidebar-sublink.active { background: rgba(0,0,0,0.05); }
.level-a2 .level-chip { background: #7a2e32; }
.level-b1 .level-chip { background: #0d5e56; }
.level-b2 .level-chip { background: #c07b2d; }

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 94px 30px 48px;
}
.page { display: grid; gap: 26px; }
.section-block, .page-banner, .hero, .reader-panel, .tool-card, .stat-card, .story-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-block { padding: 28px; }
.section-block.compact { padding: 24px; }
.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 460px);
  gap: 28px;
  padding: 28px;
  align-items: center;
}
.hero-copy h1 { margin: 0 0 12px; font-size: clamp(2.4rem, 3.2vw, 3.5rem); line-height: 1.02; }
.hero-text { margin: 0 0 18px; max-width: 58ch; font-size: 1.08rem; color: #39424d; }
.hero-callout {
  max-width: 540px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px 16px;
  background: #fcf9f3;
}
.hero-callout strong { display: block; margin-bottom: 8px; font-size: 1rem; }
.hero-callout p { margin: 0; color: #495463; }
.hero-media img { width: 100%; height: 100%; max-height: 460px; object-fit: cover; border-radius: 18px; }
.section-heading h2, .filter-row h2 { margin: 0 0 8px; }
.section-heading p, .filter-row p { margin: 0; color: var(--muted); }
.level-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.level-card {
  padding: 24px;
  border-radius: var(--radius);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
}
.level-card-top {
  display: inline-block;
  margin-bottom: 10px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
}
.level-card h3 { margin: 0 0 10px; font-size: 1.5rem; }
.level-card p { margin: 0; color: rgba(255,255,255,0.92); }
.level-card.level-a2 { background: linear-gradient(135deg, #7a2e32, #a64b50); }
.level-card.level-b1 { background: linear-gradient(135deg, #0d5e56, #1d8478); }
.level-card.level-b2 { background: linear-gradient(135deg, #b06b22, #d49441); }
.card-link-button {
  align-self: flex-start;
  margin-top: 18px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.24);
  font-weight: 700;
}
.page-banner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px;
}
.page-banner h1 { margin: 0 0 8px; font-size: 2.2rem; }
.page-banner p { margin: 0; color: #36404b; }
.page-banner-badge {
  min-width: 92px;
  height: 92px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
}
.level-theme.level-a2 { --level-main: #7a2e32; --level-soft: #f7dbde; }
.level-theme.level-b1 { --level-main: #0d5e56; --level-soft: #daf0ed; }
.level-theme.level-b2 { --level-main: #c07b2d; --level-soft: #f8e9d3; }
.level-theme .page-banner {
  background: linear-gradient(180deg, var(--level-soft), #fff);
  border-color: color-mix(in srgb, var(--level-main) 28%, white);
}
.level-theme .page-banner-badge,
.level-theme .level-badge { background: var(--level-main); }
.level-theme .reader-panel,
.level-theme .tool-card,
.level-theme .story-card,
.level-theme .section-block { border-color: color-mix(in srgb, var(--level-main) 22%, var(--border)); }
.filter-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.filter-control {
  display: grid;
  gap: 8px;
  font-weight: 700;
}
.filter-control span { font-size: 0.95rem; }
.filter-control select {
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.story-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.story-card-image {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.story-card-image img { width: 100%; height: 100%; object-fit: cover; }
.story-status {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  backdrop-filter: blur(6px);
}
.story-status.not-started { background: rgba(33, 41, 50, 0.82); }
.story-status.started { background: rgba(197, 120, 27, 0.9); }
.story-status.completed { background: rgba(16, 112, 86, 0.92); }
.story-card-body { padding: 20px; display: grid; gap: 14px; }
.story-card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
}
.story-card h3 { margin: 0; font-size: 1.3rem; }
.story-card p { margin: 0; color: #4b5563; }
.story-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}
.story-facts div {
  background: #faf6f1;
  border: 1px solid #ebe2d6;
  border-radius: 14px;
  padding: 12px;
}
.story-facts dt {
  margin-bottom: 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
  color: var(--muted);
}
.story-facts dd { margin: 0; font-weight: 800; }
.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.72fr);
  gap: 20px;
}
.reader-panel { padding: 28px; }
.reader-panel p { margin: 0 0 16px; line-height: 1.7; }
.reader-image { margin-bottom: 22px; }
.reader-image img { border-radius: 16px; width: 100%; max-height: 320px; object-fit: cover; }
.story-banner-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 330px;
}
.story-banner-details div {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.7);
  display: grid;
  gap: 3px;
}
.story-banner-details strong { font-size: 1.35rem; }
.story-banner-details span { color: #485463; font-size: 0.92rem; }
.tool-panel { display: grid; gap: 18px; align-content: start; }
.tool-card { padding: 22px; position: sticky; top: 96px; }
.tool-card h2, .tool-card h3 { margin-top: 0; }
.tool-card p { margin-bottom: 0; color: #4d5866; line-height: 1.65; }
.tool-card.subdued { position: static; background: #fdf9f3; }
.placeholder-block {
  margin-top: 24px;
  padding: 20px;
  border-radius: 16px;
  background: #fbf8f3;
  border: 1px dashed #d8cfc2;
}
.placeholder-block h2 { margin: 0 0 10px; font-size: 1.2rem; }
.placeholder-block p { margin: 0; }
.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.stat-card { padding: 26px; display: grid; gap: 8px; }
.stat-card strong { font-size: 2rem; }
.stat-card span { color: var(--muted); }
.empty-state {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.neutral { background: linear-gradient(180deg, #f3efe8, #fff); }
.noscript-message {
  margin: 80px auto;
  max-width: 720px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

@media (max-width: 1080px) {
  .hero, .reader-layout, .level-card-grid, .progress-grid {
    grid-template-columns: 1fr;
  }
  .story-banner-details {
    min-width: 0;
    width: 100%;
  }
  .filter-row, .page-banner {
    flex-direction: column;
    align-items: stretch;
  }
}
