:root {
  --fw-bg: #0e1512;
  --fw-surface: #18241e;
  --fw-raised: #223229;
  --fw-line: #35493d;
  --fw-text: #f0f5ed;
  --fw-muted: #a9bdaf;
  --fw-accent: #c1e39b;
  --fw-radius: 18px;
  --fw-ease: cubic-bezier(.2, .75, .25, 1);
  --fw-duration: 160ms;
}

body {
  background: radial-gradient(ellipse at 82% 0, #1a2a21 0, transparent 48rem) var(--fw-bg);
  color: var(--fw-text);
}

[hidden] { display: none !important; }
main { padding-top: clamp(24px, 3.4vw, 46px); }
main [data-view] { min-width: 0; }
h1 { font-size: clamp(1.9rem, 3vw, 2.7rem); letter-spacing: -.035em; }
.eyebrow, .edition, .nav-label { color: #b2c7a6; }
.muted, .hint, footer { color: var(--fw-muted); }
.hint { font-size: .83rem; }
label { font-size: .875rem; }
.page-heading { flex-wrap: wrap; }
.breadcrumb b { color: var(--fw-text); font-size: .9rem; }
.breadcrumb { color: var(--fw-muted); }
.mode-badge { border-radius: 999px; }
.topbar { background: #131d17; border-color: var(--fw-line); height: 70px; }

.sidebar {
  padding-top: 23px;
  padding-bottom: 16px;
  background: #121b16;
  border-color: var(--fw-line);
}
.brandmark { overflow: hidden; background: #24372b; border: 1px solid #49634e; }
.brandmark img { width: 100%; height: 100%; object-fit: cover; }
.nav-label { margin-top: 32px; }
.sidebar nav { gap: 4px; scrollbar-width: thin; }
.sidebar nav a {
  min-height: 43px;
  padding: 9px 11px;
  color: var(--fw-muted);
  border: 1px solid transparent;
  border-radius: 11px;
}
.sidebar nav a:hover { background: var(--fw-raised); color: var(--fw-text); }
.sidebar nav a.active { background: #25392b; color: var(--fw-accent); border-color: #47634b; }
.sidebar-bottom { padding-top: 14px; }
.mobile-menu { display: none; }

.panel, .feature, .stats article, .challenge-select button {
  border-color: var(--fw-line);
  border-radius: var(--fw-radius);
  background: var(--fw-surface);
}
.panel, .stats article { box-shadow: 0 6px 22px #0002; }
.stats article { background: linear-gradient(155deg, #203127, var(--fw-surface) 75%); }
.stats strong { color: var(--fw-accent); }
.stats p, .feature p { color: var(--fw-muted); font-size: .875rem; }
.command-main { background: linear-gradient(142deg, #253b2d, var(--fw-surface) 68%); }
.frachtwerk-cover {
  margin-bottom: 24px;
  border: 1px solid #445d4b;
  border-radius: 22px;
  box-shadow: 0 10px 24px #0004;
}
.frachtwerk-cover img { height: clamp(155px, 21vw, 295px); aspect-ratio: auto; }
.home-actions .primary, .home-actions .secondary { min-height: 47px; }
.home-actions a[href="#download"] { grid-column: 1 / -1; }
[data-view="overview"] > .panel:has(a[href*="/legacy.html"]) { padding: 12px 18px; }
[data-view="overview"] > .panel:has(a[href*="/legacy.html"]) .hint { margin: 0; }

:is(.primary, .secondary, .icon-button, .stop-controls button, .dialog-close) { border-radius: 11px; }
.primary { background: var(--fw-accent); border-color: var(--fw-accent); color: #162417; }
.primary:hover { background: #d6efb8; border-color: #d6efb8; }
.secondary, .icon-button { background: #202e26; color: var(--fw-text); border-color: #415849; }
.secondary:hover, .icon-button:hover { background: #2b4133; border-color: #76917f; }
.stop-controls button { min-height: 34px; padding-inline: 8px; }
.stop-controls button:hover:enabled { background: var(--fw-raised); }
:is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--fw-accent);
  outline-offset: 3px;
}
.file-label:focus-within { outline: 2px solid var(--fw-accent); outline-offset: 3px; }
:is(input:not([type=checkbox],[type=radio],[type=range],[type=file]), select, textarea) {
  min-height: 44px;
  border-radius: 11px;
  background-color: #101914;
  border-color: #475f50;
  color: var(--fw-text);
}
:is(input[type=checkbox], input[type=radio], input[type=range], progress) { accent-color: var(--fw-accent); }
[type=checkbox], [type=radio] { cursor: pointer; }
.file-label, summary { border-radius: 9px; }

dialog {
  background: #1b2a21;
  color: var(--fw-text);
  border-color: #4a6651;
  border-radius: 22px;
  box-shadow: 0 22px 65px #0009;
}
dialog::backdrop { background: #080e0bcf; }
.dialog-close { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; background: #293d30; }
#toast { border-radius: 13px; }
.footer-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
footer .footer-actions button { min-height: 36px; font-size: .8rem !important; }
#site-motion[aria-pressed=false] { color: var(--fw-muted); }
#discord-configure:not([open]) > :not(summary), #pair-setup:not([open]) > :not(summary) { display: none; }
#pair-setup[open] > summary { margin-bottom: .75rem; }

@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion=off]) :is(button, .primary, .secondary, .file-label, .sidebar nav a, input, select, textarea) {
    transition: background-color var(--fw-duration) var(--fw-ease),
      border-color var(--fw-duration) var(--fw-ease), color var(--fw-duration) var(--fw-ease),
      box-shadow var(--fw-duration) var(--fw-ease), transform var(--fw-duration) var(--fw-ease);
  }
  :root:not([data-motion=off]) :is(button:enabled, a.primary, a.secondary, .sidebar nav a):active { transform: scale(.98); }
  :root:not([data-motion=off]) main > [data-view]:not([hidden]) { animation: fw-enter 220ms var(--fw-ease); }
  :root:not([data-motion=off]) dialog[open] { animation: fw-enter 190ms var(--fw-ease); }
  :root:not([data-motion=off]) dialog[open]::backdrop { animation: fw-fade 190ms ease; }
  :root:not([data-motion=off]) #toast.visible { animation: fw-enter 190ms var(--fw-ease); }
}
@keyframes fw-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fw-fade { from { opacity: 0; } to { opacity: 1; } }
:root[data-motion=off] *, :root[data-motion=off] *::before, :root[data-motion=off] *::after, :root[data-motion=off] *::backdrop {
  animation: none !important;
  scroll-behavior: auto !important;
  transition: none !important;
}
:root[data-motion=off] .feature:hover { transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, *::backdrop { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  .feature:hover { transform: none; }
}

@media (min-width: 701px) and (max-width: 980px) {
  .sidebar nav { margin-top: 24px; }
  .sidebar nav a { padding-inline: 0; }
}
@media (max-width: 700px) {
  .sidebar { height: auto; min-height: 59px; flex-wrap: wrap; justify-content: space-between; padding: 8px 14px; }
  .brand > span:last-child { display: block; font-size: .88rem; }
  .brand small, .mode-badge { display: none; }
  .brandmark { width: 38px; height: 38px; }
  .topbar { height: 51px; }
  .sidebar nav { flex-basis: 100%; justify-content: flex-start; }
  .sidebar nav a { padding-inline: 9px; flex: 0 0 auto; }
  .sidebar[data-menu-ready] .mobile-menu { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; }
  .sidebar[data-menu-ready] nav { display: none; }
  .sidebar[data-menu-ready][data-menu-open] nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 55vh;
    overflow: auto;
    padding-block: 9px 4px;
  }
  .sidebar[data-menu-ready][data-menu-open] nav a { justify-content: flex-start; font-size: .85rem; gap: .55rem; overflow-wrap: anywhere; }
  :root:not([data-motion=off]) .sidebar[data-menu-open] nav { animation: fw-enter var(--fw-duration) var(--fw-ease); }
  .panel { padding: clamp(14px, 4vw, 23px); }
  .frachtwerk-cover { border-radius: 16px; }
  .frachtwerk-cover img { height: auto; aspect-ratio: 3 / 1; }
  .footer-actions { justify-content: flex-start; }
}

@media (max-width: 380px) {
  .challenge-select { grid-template-columns: minmax(0, 1fr); }
  .challenge-layout > * { min-width: 0; }
  .timer-panel .stopwatch { font-size: clamp(2rem, 14vw, 3.4rem); }
}

@media print {
  :root { color-scheme: light; }
  .panel, .stats article, .feature { box-shadow: none; }
  main > [data-view] { animation: none !important; }
}
