:root {
  color-scheme: dark;
  --ink: #eff8f3;
  --muted: #b9cdc9;
  --green: #abe8cc;
  --border: #344e51;
  --base: #101d23;
  --panel: #15262b;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--base);
  font-synthesis: none;
  line-height: 1.55;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--green); text-underline-offset: 0.22em; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #d3fb9a; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.wrap { width: min(1160px, calc(100% - 72px)); margin-inline: auto; }
.skip-link { position: fixed; inset: 12px auto auto 12px; transform: translateY(-200%); z-index: 3; padding: 10px 14px; background: var(--green); color: var(--base); }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--border); background: #101d23; }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.header-inner { min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.42rem; font-weight: 760; letter-spacing: -0.06em; text-decoration: none; white-space: nowrap; }
.brand span span { color: var(--green); }
.brand-mark { position: relative; display: block; width: 31px; height: 31px; border: 1px solid var(--green); border-radius: 50%; transform: rotate(25deg); }
.brand-mark::before, .brand-mark::after { position: absolute; content: ''; inset: 4px 8px; border: 1px solid var(--green); border-radius: 50%; }
.brand-mark::after { transform: rotate(73deg); }
nav { display: flex; gap: clamp(15px, 3vw, 35px); }
nav a { color: var(--muted); font-size: 0.94rem; font-weight: 650; text-decoration: none; }
nav a:hover { color: var(--green); }

.hero { background: radial-gradient(ellipse at 87% 35%, #21423c 0%, transparent 49%), var(--base); border-bottom: 1px solid var(--border); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(285px, 0.85fr); gap: clamp(32px, 7vw, 104px); align-items: center; min-height: 450px; padding-block: 64px 68px; }
.eyebrow { color: var(--green); font-size: 0.79rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.03; letter-spacing: -0.041em; }
h1 { max-width: 760px; margin-block: 17px 23px; font-size: clamp(3rem, 5.65vw, 5.45rem); }
h1 em { color: var(--green); display: block; font-weight: 400; }
.hero-description { max-width: 54ch; color: var(--muted); font-size: clamp(1rem, 1.65vw, 1.13rem); margin-bottom: 26px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 15px; border-radius: 7px; font-size: 0.94rem; font-weight: 680; text-decoration: none; }
.primary-button { color: #10251e; background: var(--green); border: 1px solid var(--green); }
.primary-button:hover { background: #cef6e3; }
.secondary-button { color: var(--green); background: transparent; border: 1px solid #557175; }
.secondary-button:hover { border-color: var(--green); background: #203b3a; }

.topic-map { border: 1px solid #54716b; border-radius: 13px; background: #142a29; padding: 24px 25px 11px; box-shadow: 0 16px 38px #08121544; }
.topic-map h2 { font-size: 1.96rem; margin-bottom: 15px; }
.topic-links a { display: flex; align-items: center; gap: 12px; padding: 13px 4px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--border); }
.topic-links a:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.topic-links small { display: block; font-size: 0.87rem; color: var(--muted); }
.topic-dot { display: inline-block; flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.topic-dot.sleep { background: #ebd2a1; }
.topic-dot.focus { background: #9cddd2; }
.topic-dot.motivation { background: #c7bdf8; }

.library-section, .plan-section { padding-block: 66px; scroll-margin-top: 16px; }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: 24px; }
.section-header h2 { font-size: clamp(2.25rem, 4vw, 3.5rem); }
.section-header p { color: var(--muted); margin-top: 9px; }
.search, .select-label { color: var(--muted); font-size: 0.87rem; font-weight: 660; }
.search { flex: 0 1 324px; }
input[type='search'], select { display: block; width: 100%; min-height: 44px; margin-top: 5px; padding: 8px 11px; border: 1px solid #557175; border-radius: 7px; color: var(--ink); background: #12262b; font-size: 1rem; }
input::placeholder { color: #a1b6b6; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-bar button { min-height: 42px; padding: 6px 13px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); background: transparent; font-size: 0.94rem; }
.filter-bar button:hover { border-color: var(--green); }
.filter-bar button[aria-pressed='true'] { color: #142a29; background: var(--green); border-color: var(--green); font-weight: 700; }
#library-status, #plan-status { color: var(--muted); margin-block: 15px 14px; font-size: 0.92rem; }
.research-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.research-card { min-width: 0; min-height: 220px; display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel); }
.card-topic { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; margin-bottom: 9px; }
.research-card h3 { color: var(--ink); font-family: var(--serif); font-size: 1.4rem; line-height: 1.24; font-weight: 400; }
.research-card p { color: var(--muted); margin-block: 8px 17px; font-size: 0.95rem; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 7px; margin-top: auto; }
.text-button { min-height: 42px; padding: 5px 0; border: 0; color: var(--green); background: transparent; font-size: 0.93rem; text-align: left; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--ink); }
.save-button { padding-inline: 8px; text-decoration: none; }
.save-button[aria-pressed='true'] { color: var(--ink); }
.show-more { margin-top: 23px; text-align: center; }

.plan-section { background: #132529; border-block: 1px solid var(--border); }
.select-label { width: min(100%, 264px); }
select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%); background-size: 6px 6px; background-position: calc(100% - 17px) 50%, calc(100% - 11px) 50%; background-repeat: no-repeat; }
progress { display: block; width: min(300px, 100%); accent-color: var(--green); height: 10px; margin-bottom: 15px; }
.plan-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.plan-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.plan-list label { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.plan-list input { accent-color: var(--green); inline-size: 19px; block-size: 19px; flex: none; }
.plan-list span small { display: block; color: var(--muted); font-size: 0.83rem; }

.site-footer { padding-block: 32px; background: #101d23; }
.footer-inner { gap: 30px; align-items: flex-end; }
.footer-inner p { color: var(--muted); font-size: 0.88rem; margin-top: 6px; }
.footer-inner > div:last-child { max-width: 52ch; }

dialog { width: min(650px, calc(100% - 30px)); max-height: min(86vh, 800px); color: var(--ink); background: var(--panel); border: 1px solid #577575; border-radius: 13px; padding: 0; }
dialog::backdrop { background: #071116c9; }
.dialog-inner { padding: clamp(20px, 5vw, 38px); }
.dialog-close { float: right; margin: 0 0 8px 15px; }
.dialog-inner h2 { font-size: clamp(2rem, 6vw, 3rem); margin-block: 12px; }
.dialog-inner h3 { margin-top: 21px; }
.dialog-inner p:not(.eyebrow) { color: var(--muted); margin-top: 5px; }
.dialog-inner ul { padding-inline-start: 20px; }
.dialog-inner li + li { margin-top: 8px; }

@media (max-width: 870px) {
  .wrap { width: min(100% - 44px, 1160px); }
  .research-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-inner { gap: 30px; min-height: auto; }
}
@media (max-width: 610px) {
  .wrap { width: calc(100% - 36px); }
  .header-inner { min-height: 65px; gap: 11px; }
  nav { gap: 11px; }
  nav a { font-size: 0.79rem; }
  .brand { gap: 7px; font-size: 1.24rem; }
  .brand-mark { width: 25px; height: 25px; }
  .brand-mark::before, .brand-mark::after { inset: 3px 6px; }
  .hero-inner { grid-template-columns: 1fr; padding-block: 43px 38px; }
  h1 { font-size: clamp(2.75rem, 8vw, 3.8rem); }
  .library-section, .plan-section { padding-block: 43px; }
  .section-header, .footer-inner { flex-direction: column; align-items: stretch; gap: 17px; }
  .search { flex: auto; }
  .research-grid { grid-template-columns: 1fr; }
  .research-card { min-height: auto; }
}
@media (max-width: 350px) {
  .header-inner { flex-wrap: wrap; padding-block: 12px; }
}
