:root {
  color-scheme: light;
  --ink: #25312b;
  --muted: #657069;
  --paper: #f6f3ed;
  --card: #fff;
  --accent: #b95f3b;
  --line: #e6ded2;
  --nav-bg: #efe5d7;
  --nav-line: #d9ccba;
}
[data-theme="dark"] { color-scheme: dark; --ink:#e9eee9; --muted:#aeb9b1; --paper:#151a17; --card:#202722; --accent:#e28a66; --line:#39433c; --nav-bg:#252d28; --nav-line:#39433c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme:dark; --ink:#e9eee9; --muted:#aeb9b1; --paper:#151a17; --card:#202722; --accent:#e28a66; --line:#39433c; --nav-bg:#252d28; --nav-line:#39433c; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}
.cookie-banner { position:fixed; z-index:20; right:1rem; bottom:1rem; width:min(440px,calc(100% - 2rem)); padding:1rem; background:var(--card); border:1px solid var(--line); border-radius:14px; }
.cookie-banner[hidden] { display:none; }
.cookie-banner p { margin:0 0 .75rem; }
.cookie-banner div { display:flex; gap:.5rem; justify-content:flex-end; }
a { color: inherit; }
.hero { background: #efe5d7; padding: 0 5vw 5rem; }
nav {
  width: min(1080px, 100%);
  margin: auto;
  padding: 1.2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #d9ccba;
}
.brand { color: var(--accent); font-size: 1.1rem; font-weight: 750; text-decoration: none; }
.links { display: flex; gap: 1.25rem; }
.links a { color: var(--muted); font-size: .9rem; text-decoration: none; }
.links a:hover, .links a:focus { color: var(--accent); }
.intro { width: min(760px, 100%); margin: 5rem auto 0; text-align: center; }
.eyebrow { margin: 0 0 .5rem; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(2.8rem, 9vw, 5.5rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -.025em; }
.subtitle { margin: 1rem 0; color: var(--accent); font-size: clamp(1.05rem, 3vw, 1.35rem); }
.intro > p:last-child { max-width: 660px; margin: 1.5rem auto 0; color: var(--muted); }
main { width: min(1080px, 90%); margin: auto; }
section { padding: 5rem 0; }
.section-heading { margin-bottom: 2rem; }
.fact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.fact-grid li { min-height: 125px; padding: 1.4rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.fact-grid li:last-child { grid-column: 1 / -1; }
.fact-grid span { display: block; margin-bottom: .65rem; color: var(--accent); font-size: .78rem; font-weight: 750; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
figure { margin: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
figcaption { padding: .9rem 1rem; color: var(--muted); font-size: .9rem; }
.about { display: grid; grid-template-columns: 1fr 2fr; gap: 3rem; align-items: start; border-top: 1px solid var(--line); }
.about > p { margin: 0; color: var(--muted); }
footer { padding: 1.5rem 5vw; color: var(--muted); background: #e9e2d8; text-align: center; font-size: .85rem; }
footer p { margin: 0; }
.login-link, .button, button, summary {
  cursor: pointer;
}
.login-link, .button, button {
  display: inline-block; padding: .55rem .85rem; border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink); background: var(--card); text-decoration: none;
  font: inherit;
}
.login-link, button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.topbar { position: relative; z-index: 10; width: 100%; padding: 1rem 5vw; display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--nav-bg); border-bottom: 1px solid var(--nav-line); }
.topnav { width: auto; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .2rem .65rem; border: 0; }
.topnav > a, .nav-button { display: inline-block; padding: .2rem 0; border: 0; border-radius: 0; color: var(--muted); background: transparent; text-decoration: none; white-space: nowrap; }
.topnav > a:hover, .topnav > a:focus, .nav-button:hover, .nav-button:focus, .dropdown-toggle[aria-expanded="true"] { color: var(--accent); background: transparent; }
.topnav .inline { display: inline-flex; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + .3rem); right: 0; z-index: 20; min-width: 155px; padding: .3rem; display: grid; gap: .15rem; background: var(--card); border: 1px solid var(--line); border-radius: 9px; }
.dropdown-menu[hidden] { display: none; }
.dropdown-item { width: 100%; padding: .5rem .65rem; border: 0; border-radius: 6px; background: transparent; text-align: left; white-space: nowrap; }
.dropdown-item:hover, .dropdown-item:focus, .dropdown-item.active { background: var(--paper); color: var(--accent); }
.inline { display: inline; }
.app-main { width: min(1180px, 92%); margin: auto; padding: 2.5rem 0 5rem; }
.app-main h1 { font-size: clamp(2rem, 6vw, 3.5rem); }
.auth-card { width: min(430px, 100%); margin: 5vh auto; padding: 2rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
form { display: grid; gap: .8rem; }
label { display: grid; gap: .3rem; font-weight: 650; }
input, textarea, select { width: 100%; padding: .65rem; border: 1px solid #cfc6ba; border-radius: 7px; background: #fff; color: var(--ink); font: inherit; }
textarea { min-height: 120px; resize: vertical; }
.editor { min-height: 55vh; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.45; tab-size: 4; }
.toolbar { grid-template-columns: minmax(180px, 1fr) auto auto auto; align-items: center; margin: 1.5rem 0; }
.check { display: flex; grid-auto-flow: column; align-items: center; font-weight: 400; }
.check input { width: auto; }
.actions, .title-row { display: flex; flex-wrap: wrap; align-items: start; gap: .8rem; margin: 1rem 0; }
details { padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
details form { min-width: min(320px, 75vw); margin-top: .8rem; }
.table-wrap { overflow-x: auto; margin-top: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.item-name { font-weight: 700; }
.tag { display: inline-block; margin: .1rem; padding: .15rem .4rem; border-radius: 5px; color: #874328; background: #f4e3d8; font-size: .78rem; text-decoration: none; }
.breadcrumbs { margin-bottom: 1rem; color: var(--muted); }
.readme { margin-top: 2rem; padding: 1.5rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.notice, .error { padding: .7rem 1rem; border-radius: 7px; }
.notice { background: #e3f1e7; }
.error { background: #f8ded8; color: #7e2d20; }
.danger { color: #8a251c; border-color: #d5a39d; }
.muted { color: var(--muted); }
.terminal-status, .terminal-actions { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; margin: 1rem 0; }
.terminal-status { padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.terminal-actions form { display: inline; }
.terminal-screen { min-height: 60vh; max-height: 70vh; overflow: auto; margin: 0; padding: 1rem; border: 1px solid #39404a; border-radius: 10px; color: #e6edf3; background: #0d1117; font: 14px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
.terminal-screen:focus { border-color: #b95f3b; }
.compact-input { width: min(220px, 100%); }
.public-hero { padding-top: 3rem; text-align: center; }
.public-hero > p { max-width: 720px; margin: 1rem auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.xterm { height: 100%; }

@media (max-width: 720px) {
  .hero { padding-bottom: 3.5rem; }
  .intro { margin-top: 3.5rem; }
  section { padding: 3.5rem 0; }
  .gallery { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; gap: 1rem; }
  .toolbar { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topnav { width: 100%; justify-content: flex-start; }
  .dropdown-menu { right: auto; left: 0; }
}

@media (max-width: 480px) {
  .topnav { align-items: flex-start; }
  .links { flex-direction: column; gap: .25rem; text-align: right; }
  .fact-grid { grid-template-columns: 1fr; }
  .fact-grid li:last-child { grid-column: auto; }
}
