:root {
  color-scheme: light;
  --ink: #152b24;
  --muted: #4a6157;
  --green: #155546;
  --forest: #102d28;
  --gold: #e6c383;
  --line: #d9e1d9;
  --paper: #f4f5ef;
  --white: #fffefa;
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--green); text-underline-offset: .22em; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button { min-height: 44px; }
:focus-visible { outline: 3px solid #ae6522; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: Georgia, Cambria, serif; font-weight: 400; line-height: 1.04; letter-spacing: -.042em; }
.shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.topbar { background: var(--forest); color: var(--white); }
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 69px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; font: 1.5rem Georgia, serif; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #a88956; color: var(--gold); border-radius: 50%; font: 1rem Georgia, serif; }
.quiet { background: transparent; color: var(--white); border: 1px solid #5a766c; border-radius: 8px; padding: 6px 14px; font-size: .875rem; }
.quiet:hover { background: #23483f; }
.hero { margin: 28px 0 32px; isolation: isolate; position: relative; overflow: hidden; background: linear-gradient(115deg, #102d28 22%, #1b4a3e); color: var(--white); border-radius: 22px; min-height: 330px; padding: clamp(30px, 6vw, 66px); display: grid; align-items: center; }
.hero h1 { font-size: clamp(3rem, 8vw, 6.15rem); margin: 12px 0 17px; }
.hero p:not(.label) { color: #e2ede5; max-width: 40ch; }
.label { font-weight: 700; font-size: .875rem; letter-spacing: .095em; text-transform: uppercase; color: var(--green); }
.hero .label, .login-screen .label { color: var(--gold); }
.arch { position: absolute; z-index: -1; width: 37%; height: 108%; right: 3%; bottom: -28%; color: #f0ce87; }
.arch i { display: block; position: absolute; border: 1px solid #dcb36c80; inset: 0; border-radius: 50% 50% 0 0 / 46% 46% 0 0; }
.arch i:nth-child(2) { inset: 9% 9% 0; }
.arch i:nth-child(3) { inset: 18% 18% 0; }
.arch span { position: absolute; top: 25%; left: 50%; transform: translateX(-50%); font-size: clamp(1.5rem, 5vw, 4rem); line-height: 1; }
.layout { display: grid; grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); align-items: start; gap: 24px; padding-bottom: 55px; }
.sidebar, .lesson { background: var(--white); border: 1px solid var(--line); border-radius: 17px; }
.sidebar { padding: 20px 16px 16px; }
.progress-text { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .875rem; font-weight: 700; }
.progress-text output { color: var(--muted); font-weight: 500; }
progress { display: block; width: 100%; height: 7px; margin: 10px 0 19px; border: 0; border-radius: 12px; appearance: none; background: #e4ebe3; accent-color: var(--green); }
progress::-webkit-progress-bar { background: #e4ebe3; border-radius: 12px; }
progress::-webkit-progress-value { background: var(--green); border-radius: 12px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 12px; }
nav { display: grid; gap: 4px; }
nav a { min-height: 44px; display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; padding: 6px 8px; border-radius: 8px; font-size: .875rem; }
nav a span { display: grid; place-items: center; font-size: .875rem; width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid var(--line); border-radius: 50%; }
nav a:hover, nav a[aria-current] { background: #e7eee8; }
nav a[aria-current] { font-weight: 700; }
nav a.done span, nav a[aria-current] span { background: var(--green); color: white; border-color: var(--green); }
.lesson { padding: clamp(20px, 5vw, 46px); margin: 0 0 15px; scroll-margin: 18px; }
.lesson h2 { font-size: clamp(2.05rem, 5vw, 3.5rem); margin: 8px 0 16px; }
.lesson h2:focus { outline: none; }
.lesson > p + p { margin-top: 14px; }
.lesson > p.label + h2 { margin-top: 8px; }
.lesson p { overflow-wrap: anywhere; }
.note { border-left: 3px solid #8a713c; border-radius: 0 9px 9px 0; background: #eef1e8; padding: 16px 18px; margin: 20px 0; }
.note h3 { font-size: 1rem; margin-bottom: 5px; }
.note p + p { margin-top: 8px; }
.note .arabic { font-size: clamp(1.6rem, 5vw, 2.5rem); text-align: start; font-family: "Segoe UI", sans-serif; }
details { margin-top: 14px; }
details summary { padding: 5px 0; color: var(--green); font-weight: 650; }
details p { margin-top: 8px; }
.flow { padding: 0 0 0 1.6em; margin: 18px 0; }
.flow li { padding-left: .35em; margin-bottom: .6em; }
.flow li::marker { color: var(--green); font-weight: 700; }
table { width: 100%; border-collapse: collapse; margin: 16px 0; text-align: left; }
th, td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); }
th:last-child, td:last-child { padding-right: 0; text-align: right; }
thead th { color: var(--muted); font-size: .875rem; }
.lesson-controls { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.primary, .secondary { border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; font-weight: 650; }
.primary { background: var(--green); color: white; }
.primary:hover { background: #104538; }
.secondary { background: var(--white); border-color: #94a79a; color: var(--ink); }
.secondary:hover { background: #e7eee8; }
.saved-note { margin: 13px 0 0; color: var(--muted); font-size: .875rem; text-align: right; }
.login-screen { min-height: 100svh; display: grid; place-items: center; padding: 22px; background: #e9eee6; }
.login-card { position: relative; isolation: isolate; overflow: hidden; width: min(100%, 455px); padding: clamp(24px, 6vw, 45px); background: linear-gradient(145deg, #102d28 38%, #1b463c); color: var(--white); border-radius: 23px; box-shadow: 0 20px 60px #12352925; }
.login-heading { margin: 44px 0 25px; }
.login-heading h1 { font-size: clamp(2.8rem, 10vw, 4.1rem); margin: 8px 0 10px; }
.login-heading > p:last-child { color: #e1ede4; }
.login-card form { display: grid; gap: 10px; }
.login-card label { font-size: .875rem; font-weight: 650; }
.login-card input { width: 100%; min-height: 53px; background: #fffefa; color: var(--ink); border: 1px solid #a9b9ad; border-radius: 8px; padding: 8px 14px; font-size: 1.2rem; letter-spacing: .24em; }
.login-card .primary { color: #192f25; background: var(--gold); margin-top: 6px; }
.login-card .primary:hover { background: #f0d39c; }
.login-card .arch { right: -16%; bottom: -44%; width: 58%; opacity: .4; }
.error { color: #ffd3bc; font-size: .875rem; }

@media (max-width: 730px) {
  .shell { width: calc(100% - 28px); }
  .hero { min-height: 280px; margin: 16px 0; }
  .hero .arch { right: -6%; opacity: .4; width: 49%; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .sidebar { padding: 16px; }
  nav { grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)); }
}

@media (max-width: 390px) {
  th, td { overflow-wrap: anywhere; hyphens: auto; }
}
