/* Dark theme. Light is the default; the choice sets data-theme on <html>. */
:root { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --chalk: #0e1218;
  --paper: #161b24;
  --ink: #f2f4f7;
  --slate: #a3adbd;
  --brass: #d1a85c;
  --brass-soft: #2d2514;
  --brass-light: #e3c377;
  --line: #2a3140;
  --on-ink: #c4cad3;
}
/* Surfaces that are dark in both themes keep the light-theme colours for themselves */
html[data-theme="dark"] .close,
html[data-theme="dark"] .band,
html[data-theme="dark"] .story__total,
html[data-theme="dark"] .tile--ink,
html[data-theme="dark"] .mod--assistant .mod__icon,
html[data-theme="dark"] .hot__tag {
  --ink: #17202b;
  --chalk: #f2f3ef;
  --slate: #556070;
}
html[data-theme="dark"] .close { border-top: 1px solid var(--line); background: #151b25; }
html[data-theme="dark"] .band { background: #1b2230; border: 1px solid var(--line); }
html[data-theme="dark"] .story__total { background: #1b2230; border: 1px solid var(--line); }
html[data-theme="dark"] .btn--primary:hover { color: #1a1405; }
html[data-theme="dark"] .story__btn.is-on,
html[data-theme="dark"] .pager__btn:hover,
html[data-theme="dark"] .demo__nav button.is-on { color: var(--chalk); }
html[data-theme="dark"] .bar { fill: #2a3140; }
html[data-theme="dark"] .status--done { background: #12302a; border-color: #2f6b55; color: #46d39a; }
html[data-theme="dark"] .shot { background: var(--paper); }
.foot__btn { font: inherit; padding: 0; border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; }
.foot__btn:hover { color: #fff; }
.foot__btn:focus-visible { outline: 3px solid var(--brass-light); outline-offset: 3px; }

/* ---------------------------------------------------------------- welcome */
.onb { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow-y: auto; background: var(--chalk); color: var(--ink); padding: 16px; }
.onb__bg { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.onb__skip { border-radius: 999px; background: var(--chalk) !important; position: fixed; top: 14px; right: 16px; z-index: 3; font: inherit; font-weight: 700; padding: 8px 14px; border: 0; background: none; color: var(--slate); text-decoration: underline; text-underline-offset: 0.25em; cursor: pointer; }
.onb__skip:hover { color: var(--ink); }
.onb__brand { position: fixed; top: 16px; left: 20px; z-index: 3; font-weight: 700; font-size: 1.05rem; }
.onb__brand span { color: var(--slate); font-weight: 400; }

.onb__panel { --cut: 30px; position: relative; z-index: 2; width: min(1040px, 100%); margin-block: 56px 24px; padding: clamp(26px, 4vw, 56px); isolation: isolate; filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.14)); }
.onb__panel::before, .onb__panel::after { content: ""; position: absolute; z-index: -1; clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut)); }
.onb__panel::before { inset: 0; background: var(--brass); opacity: 0.55; }
.onb__panel::after { inset: 1.5px; background: var(--paper); }

.onb__swap { display: grid; gap: 28px; }
.onb__left { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.onb__prog { width: 112px; height: auto; display: block; }
.onb__prog .hx { fill: none; stroke: var(--line); stroke-width: 1.6; transition: fill 0.4s ease, stroke 0.4s ease; }
.onb__prog .hx.is-done { fill: var(--brass); stroke: var(--brass); }
.onb__prog .hx.is-cur { stroke: var(--brass); fill: var(--brass-soft); }
.onb__count { color: var(--slate); font-size: 0.95rem; font-weight: 700; }
.onb h2 { font-size: clamp(2.1rem, 1.3rem + 3.6vw, 3.9rem); line-height: 1; letter-spacing: -0.03em; font-weight: 700; text-wrap: balance; }
.onb .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.onb .w > span { display: inline-block; }
.onb__sub { color: var(--slate); max-width: 26em; font-size: 1.05rem; }

.onb__right { display: flex; flex-direction: column; gap: 22px; min-width: 0; justify-content: center; }
.onb__body { display: grid; gap: 12px; }
.onb__grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.onb__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt__box { display: grid; gap: 4px; align-content: start; height: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--chalk); transition: border-color 0.2s, background-color 0.2s, transform 0.2s; }
.opt:hover .opt__box { border-color: var(--brass); }
.opt input:focus-visible + .opt__box { outline: 3px solid var(--brass); outline-offset: 2px; }
.opt input:checked + .opt__box { border-color: var(--brass); background: var(--brass-soft); }
.opt__name { font-weight: 700; }
.opt__note { color: var(--slate); font-size: 0.9rem; }
.opt__tick { position: absolute; top: 12px; right: 12px; width: 18px; height: 20px; background: var(--brass); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); opacity: 0; transform: scale(0.4); transition: opacity 0.2s, transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); display: grid; place-items: center; }
.opt__tick::after { content: ""; width: 6px; height: 3px; border-left: 2px solid var(--chalk); border-bottom: 2px solid var(--chalk); transform: rotate(-45deg) translate(1px, -1px); }
.opt input:checked ~ .opt__tick { opacity: 1; transform: none; }
.opt__prev { display: block; width: 100%; height: auto; border-radius: 8px; margin-bottom: 6px; }
.onb__fine { color: var(--slate); font-size: 0.95rem; }
.onb__fine a { text-decoration: underline; text-underline-offset: 0.2em; }

.onb__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--chalk); }
.onb__row strong { display: block; }
.onb__row span { color: var(--slate); font-size: 0.9rem; }
.sw { position: relative; flex: none; width: 46px; height: 26px; }
.sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 13px; background: var(--line); transition: background-color 0.2s; pointer-events: none; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); transition: transform 0.2s; }
.sw input:checked + i { background: var(--brass); }
.sw input:checked + i::after { transform: translateX(20px); }
.sw input:disabled { cursor: not-allowed; }
.sw input:disabled + i { opacity: 0.6; }
.sw input:focus-visible + i { outline: 3px solid var(--brass); outline-offset: 2px; }
.onb details { color: var(--slate); font-size: 0.92rem; }
.onb summary { cursor: pointer; font-weight: 700; color: var(--ink); width: max-content; }
.onb summary:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; }
.onb table { width: 100%; margin-top: 10px; border-collapse: collapse; }
.onb th, .onb td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.onb th { color: var(--ink); }

.onb__big { display: grid; gap: 12px; }
.bigopt { text-align: left; font: inherit; color: inherit; padding: 20px 22px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--chalk); cursor: pointer; display: grid; gap: 4px; transition: border-color 0.2s, background-color 0.2s, transform 0.2s; }
.bigopt:hover { border-color: var(--brass); background: var(--brass-soft); }
.bigopt:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.bigopt strong { font-size: 1.2rem; }
.bigopt span { color: var(--slate); }
.bigopt--main { background: var(--ink); color: var(--chalk); border-color: var(--ink); }
.bigopt--main span { color: inherit; opacity: 0.78; }
.bigopt--main:hover { background: var(--brass); border-color: var(--brass); color: #fff; }
html[data-theme="dark"] .bigopt--main:hover { color: #1a1405; }
.onb__msg { padding: 14px 16px; border-radius: 12px; background: var(--brass-soft); border-left: 4px solid var(--brass); }

.onb__ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.onb__ctrl .btn { cursor: pointer; }
.btn--line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--line:hover { border-color: var(--brass); }
.onb__back { font: inherit; font-weight: 700; padding: 0.85em 0.6em; border: 0; background: none; color: var(--slate); cursor: pointer; }
.onb__back:hover { color: var(--ink); }
.onb__back[hidden] { display: none; }
.onb :focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; }

@media (min-width: 62em) {
  .onb__panel { margin-block: 64px 32px; }
  .onb__swap { grid-template-columns: 5fr 6fr; gap: 56px; }
  .onb__prog { width: 150px; }
}
@media (max-width: 40em) {
  .onb__grid--3 { gap: 8px; }
  .opt__box { padding: 10px; }
  .onb__brand { display: none; }
  .onb__panel { margin-top: 60px; --cut: 20px; }
}

/* Motion */
.onb { opacity: 1; }
.motion .onb { animation: onb-in 0.5s ease both; }
.motion .onb__panel { animation: onb-panel 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both; }
.motion .onb.is-leaving { animation: onb-out 0.7s ease forwards; }
.motion .onb.is-leaving .onb__panel { animation: onb-panel-out 0.55s cubic-bezier(0.5, 0, 0.8, 0.4) forwards; }
.motion .onb__swap.is-out { animation: onb-swap-out 0.2s ease forwards; }
.motion .onb__swap.is-in .w > span { animation: onb-rise 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 55ms); }
.motion .onb__swap.is-in .onb__sub, .motion .onb__swap.is-in .onb__right { animation: onb-fade 0.7s ease 0.3s both; }
.motion .onb__text-swap { animation: onb-fade 0.35s ease both; }
@keyframes onb-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes onb-out { to { opacity: 0; } }
@keyframes onb-panel { from { opacity: 0; transform: translateY(30px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes onb-panel-out { to { opacity: 0; transform: scale(1.04); } }
@keyframes onb-swap-out { to { opacity: 0; transform: translateX(-24px); } }
@keyframes onb-rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes onb-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* The colour change wipes across the screen from the tile you pressed */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { clip-path: circle(0 at var(--tx, 50%) var(--ty, 50%)); animation: vt-reveal 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes vt-reveal { to { clip-path: circle(150vmax at var(--tx, 50%) var(--ty, 50%)); } }

.onb h2:focus { outline: none; }
.onb__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.onb__list li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--chalk); font-weight: 700; }
.onb__list i { flex: none; width: 20px; height: 22px; background: var(--brass); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.onb__list li:nth-child(n+2) i { opacity: 0.55; }
.onb__list li:nth-child(n+3) i { opacity: 0.35; }
.onb__list li:nth-child(n+4) i { opacity: 0.2; }
.motion .onb__swap.is-in .onb__list li { animation: onb-fade 0.6s ease both; animation-delay: calc(0.45s + var(--i, 0) * 90ms); }
.motion .onb__list li { animation: onb-fade 0.6s ease both; animation-delay: calc(0.6s + var(--i, 0) * 90ms); }

html[data-theme="dark"] .band .btn,
html[data-theme="dark"] .close .btn { background: #f2f3ef; color: #17202b; border-color: #f2f3ef; }

/* ---------------------------------------------------------------- header tools */
.tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.site-head .wrap { position: relative; }
.langsw { display: inline-flex; padding: 3px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); }
.langsw button { font: inherit; font-size: 0.85rem; font-weight: 700; padding: 5px 11px; border: 0; border-radius: 999px; background: none; color: var(--slate); cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.langsw button:hover { color: var(--ink); }
.langsw button[aria-pressed="true"] { background: var(--ink); color: var(--chalk); }
.langsw button:focus-visible, .acct__btn:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.acct { position: relative; }
.acct__btn { display: grid; place-items: center; width: 38px; height: 38px; border: 1.5px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer; transition: border-color 0.2s; }
.acct__btn:hover, .acct__btn[aria-expanded="true"] { border-color: var(--brass); }
.acct__pop { position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; width: min(280px, 86vw); display: grid; gap: 8px; padding: 18px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14); }
.acct__pop[hidden] { display: none; }
.acct__pop p { color: var(--slate); font-size: 0.95rem; }
.acct__pop .btn { justify-self: start; margin-top: 6px; }
.motion .acct__pop:not([hidden]) { animation: onb-fade 0.25s ease both; }
.tools + .btn { margin-left: 4px; }
html[data-theme="dark"] .acct__pop { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); }
@media (max-width: 36em) { .langsw button { padding: 5px 9px; } }

.themebtn { display: grid; place-items: center; width: 38px; height: 38px; border: 1.5px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer; transition: border-color 0.2s; }
.themebtn:hover { border-color: var(--brass); }
.themebtn:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

/* Account menu: two buttons and a quiet link */
.acct__row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.acct__row .btn { margin-top: 0; }
.acct__ea { justify-self: start; font-size: 0.9rem; margin-top: 4px; }

/* Angemeldet: kleiner Punkt am Symbol und ein ruhiges Menü */
.acct--in .acct__btn { position: relative; }
.acct--in .acct__btn::after { content: ""; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--brass); box-shadow: 0 0 0 2px var(--paper); }
.acct__in { display: grid; gap: 6px; }
.acct__name { color: var(--ink) !important; font-weight: 600; font-size: 1.05rem !important; overflow-wrap: anywhere; }
.acct__row { display: flex; flex-wrap: wrap; gap: 8px; }
