:root {
  --bg: #f7f3ea;
  --panel: #fffdf8;
  --ink: #1f2933;
  --muted: #5d6673;
  --line: #d8cdb8;
  --accent: #8a5a1f;
  --accent-dark: #5f3d13;
  --good: #1d6b3f;
  --warn: #8a4b00;
  --locked: #9aa3ad;
  --shadow: 0 14px 35px rgba(31, 41, 51, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #fff7df, var(--bg));
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-end;
  padding: 2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,253,248,0.9);
}
.eyebrow { margin: 0 0 .25rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-size: .8rem; font-weight: 700; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; }
.subtitle { margin: .75rem 0 0; color: var(--muted); max-width: 58rem; }
.progress-card { min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; box-shadow: var(--shadow); }
.progress-bar { height: 10px; border-radius: 999px; background: #eadfcb; overflow: hidden; margin-top: .75rem; }
#progressFill { height: 100%; width: 0%; background: var(--accent); transition: width .25s ease; }

.layout { display: grid; grid-template-columns: 360px 1fr; gap: 1.5rem; padding: 1.5rem; }
.sidebar, .lesson-panel { background: rgba(255,253,248,.95); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.sidebar { padding: 1rem; align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sidebar h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.lesson-item { width: 100%; display: grid; grid-template-columns: 58px 1fr; gap: .75rem; text-align: left; border: 1px solid var(--line); background: #fffaf0; color: var(--ink); border-radius: 12px; padding: .75rem; cursor: pointer; }
.lesson-item:hover:not(:disabled), .lesson-item.active { border-color: var(--accent); outline: 2px solid rgba(138,90,31,.12); }
.lesson-item.locked { color: var(--locked); background: #f0eee9; cursor: not-allowed; }
.lesson-item.complete { border-color: rgba(29,107,63,.35); background: #f2fbf4; }
.lesson-number { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; border-radius: 999px; background: #eadfcb; font-weight: 700; }
.lesson-meta small { display: block; color: var(--muted); margin-top: .2rem; }

.lesson-panel { padding: 1.5rem; min-width: 0; }
.lesson-status { display: inline-block; padding: .25rem .65rem; border-radius: 999px; background: #eadfcb; color: var(--accent-dark); font-weight: 700; font-size: .85rem; }
.lesson-panel h2 { font-size: clamp(1.8rem, 4vw, 3rem); margin: .75rem 0 .25rem; line-height: 1.1; }
.lesson-subtitle { color: var(--muted); font-size: 1.1rem; margin: 0 0 1rem; }
.actions, .footer-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }
.lesson-actions { margin-top: .75rem; margin-bottom: 1rem; }
.button.utility { font-size: .9rem; opacity: .88; }
.button, .link-button { border: 0; border-radius: 10px; padding: .8rem 1rem; text-decoration: none; font-weight: 700; cursor: pointer; font-family: Arial, sans-serif; }
.button { background: var(--accent); color: white; display: inline-block; }
.button.secondary { background: #eadfcb; color: var(--accent-dark); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.link-button { background: transparent; color: var(--accent); padding: .25rem; }
.notice, .result { border-radius: 14px; padding: 1rem; margin: 1rem 0; }
.notice { background: #fff4d6; border: 1px solid #e5c77d; }
.result.success { background: #e8f6ec; border: 1px solid #97c7a6; color: var(--good); }
.result.warn { background: #fff0dd; border: 1px solid #e1b16f; color: var(--warn); }
.embed-wrap { width: 100%; height: min(68vh, 760px); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; }
iframe { width: 100%; height: 100%; border: 0; }
.embed-wrap.video-mode { height: auto; min-height: 360px; padding: 1rem; display: grid; gap: .75rem; align-content: start; }
.embed-wrap.video-mode groovevideo-widget { display: block; width: 100%; min-height: 320px; }
.video-note { margin: 0; color: var(--muted); font-size: .95rem; }
.watch-check { display: block; margin: 1rem 0; font-weight: 700; background: #f6efe2; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.quiz { margin-top: 1rem; }
.quiz-intro { border-top: 1px solid var(--line); padding-top: 1rem; }
.focus { background: #f8f1e5; border-left: 4px solid var(--accent); padding: .75rem; }
.question { border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin: 1rem 0; }
.question legend { font-weight: 700; padding: 0 .25rem; }
.question label { display: block; padding: .5rem; margin: .35rem 0; border-radius: 8px; cursor: pointer; }
.question label:hover { background: #f8f1e5; }
.muted { color: var(--muted); }

@media (max-width: 900px) {
  .site-header { display: block; padding: 1rem; }
  .progress-card { margin-top: .75rem; }
  .layout { grid-template-columns: 1fr; padding: .75rem; gap: .75rem; }
  .sidebar { position: static; max-height: none; padding: .75rem; border-radius: 14px; }
  .lesson-panel { padding: 1rem; border-radius: 14px; }
  .embed-wrap { height: 62vh; }
  .actions { gap: .5rem; }
  .button, .link-button { padding: .7rem .85rem; }
}

@media (max-width: 560px) {
  body { line-height: 1.42; }
  .site-header { padding: .75rem; }
  h1 { font-size: 1.85rem; }
  .subtitle { font-size: .95rem; }
  .layout { padding: .5rem; gap: .5rem; }
  .sidebar { padding: .6rem; }
  .lesson-panel { padding: .75rem; }
  .lesson-panel h2 { font-size: 1.6rem; }
  .lesson-subtitle { font-size: 1rem; }
  .lesson-item { grid-template-columns: 48px 1fr; padding: .6rem; gap: .55rem; }
  .lesson-number { min-width: 38px; height: 38px; font-size: .88rem; }
  .notice, .result, .watch-check, .question { padding: .75rem; border-radius: 11px; margin: .75rem 0; }
  .embed-wrap.video-mode { min-height: 255px; padding: .5rem; border-radius: 12px; }
  .embed-wrap.video-mode groovevideo-widget { min-height: 235px; }
  .video-note { font-size: .85rem; }
  .actions.lesson-actions { margin-top: .55rem; }
  .actions.lesson-actions .button { width: 100%; text-align: center; }
  .footer-actions .button { flex: 1 1 140px; }
}

.result-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-actions .button {
  width: auto;
}

@media (max-width: 640px) {
  .result-actions .button {
    width: 100%;
  }
}

.student-card {
  margin: 0 0 1rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff8e8;
}

.student-card h3 {
  margin: 0 0 .35rem;
  font-size: 1rem;
}

.student-card p {
  margin: 0 0 .75rem;
  color: var(--muted);
  font-size: .9rem;
}

.student-form {
  display: grid;
  gap: .55rem;
}

.student-form label,
.completion-email label {
  display: grid;
  gap: .25rem;
  font-family: Arial, sans-serif;
  font-size: .86rem;
  font-weight: 700;
}

.student-form input,
.completion-email textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .65rem;
  font: inherit;
  background: white;
  color: var(--ink);
}

.student-form .small {
  padding: .6rem .75rem;
  font-size: .85rem;
}

.saved-note {
  color: var(--good) !important;
  font-weight: 700;
  margin: .25rem 0 0 !important;
}

.completion-email {
  margin-top: 1rem;
  padding: .85rem;
  border-radius: 12px;
  background: rgba(255, 253, 248, .75);
  border: 1px solid rgba(29,107,63,.2);
}

.email-help {
  margin: .5rem 0 0;
  color: var(--muted);
  font-size: .92rem;
}

@media (max-width: 560px) {
  .student-card { padding: .65rem; border-radius: 11px; }
  .student-card p { font-size: .85rem; }
  .student-form input, .completion-email textarea { padding: .55rem; }
  .completion-email { padding: .65rem; }
}


.study-status {
  margin-top: .75rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf0;
  color: var(--ink);
}

.requirements {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: .85rem 1rem;
  background: #fffdf8;
}

.requirements ol {
  margin: .5rem 0 0 1.25rem;
  padding: 0;
}

.email-fallback {
  margin-top: 1rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--ink);
}

.email-preview {
  width: 100%;
  margin: .5rem 0 .75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .65rem;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: .9rem;
  color: var(--ink);
  background: white;
}

.copy-status {
  display: inline-block;
  margin-left: .65rem;
  font-weight: 700;
  color: var(--good);
}

@media (max-width: 560px) {
  .study-status, .requirements, .email-fallback { padding: .65rem; border-radius: 10px; }
  .email-preview { font-size: .82rem; }
  .copy-status { display: block; margin: .45rem 0 0; }
}

.site-footer {
  margin: 0 1.5rem 1.5rem;
  padding: 1.1rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,253,248,.9);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.site-footer p {
  margin: .25rem 0;
}

.footer-title {
  color: var(--accent-dark);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .86rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: .9rem;
  flex-wrap: wrap;
  margin: .45rem 0;
  font-family: Arial, sans-serif;
  font-size: .92rem;
}

.footer-links a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  font-size: .85rem;
}

@media (max-width: 560px) {
  .site-footer {
    margin: 0 .5rem .5rem;
    padding: .85rem;
    border-radius: 14px;
  }
  .footer-links {
    gap: .65rem;
  }
}
