:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #e8dfc8;
  --surface: #fffaf0;
  --surface-alt: #eee1c5;
  --ink: #102e43;
  --muted: #53666e;
  --navy: #153e58;
  --navy-deep: #09283d;
  --accent: #d8b66d;
  --accent-strong: #1d5875;
  --signal: #ad382d;
  --line: #b7a985;
  --line-strong: #778d92;
  --focus: #153e58;
  --shadow: 0 .65rem 1.8rem rgba(15, 42, 57, .14);
}

* { box-sizing: border-box; }
body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-wrap: anywhere;
  background:
    linear-gradient(rgba(248, 241, 221, .82), rgba(232, 220, 191, .86)),
    repeating-linear-gradient(0deg, transparent 0 2.95rem, rgba(38, 96, 120, .15) 3rem),
    repeating-linear-gradient(90deg, transparent 0 2.95rem, rgba(38, 96, 120, .15) 3rem);
  color: var(--ink);
}
body::before { display: none; }
a { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: .2rem solid var(--focus); outline-offset: .14rem; box-shadow: 0 0 0 .38rem #fffaf0; }
.skip-link { position: absolute; top: .5rem; left: .8rem; z-index: 2; padding: .6rem .8rem; transform: translateY(-180%); background: var(--surface); color: var(--ink); font-weight: 800; }
.skip-link:focus { transform: translateY(0); }

.masthead {
  border-bottom: .35rem solid #ad382d;
  background:
    linear-gradient(rgba(255, 250, 237, .93), rgba(238, 225, 194, .94)),
    repeating-linear-gradient(0deg, transparent 0 2.95rem, rgba(38, 96, 120, .18) 3rem),
    repeating-linear-gradient(90deg, transparent 0 2.95rem, rgba(38, 96, 120, .18) 3rem);
}
.masthead-inner { display: flex; max-width: 76rem; min-height: 5.5rem; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 auto; padding: .8rem clamp(1rem, 4vw, 2rem); }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 2.7rem; height: 2.7rem; place-items: center; border: .15rem solid var(--navy); border-radius: .15rem; background: var(--navy-deep); color: #fff5dc; font-family: Georgia, serif; font-size: 1.5rem; font-weight: 700; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; }
.brand small { color: var(--muted); font-size: .75rem; }
.theme-nav, .account-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.theme-nav a, .account-nav a, .account-nav button { display: inline-flex; min-height: 2.75rem; align-items: center; justify-content: center; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .28rem; background: var(--surface); color: var(--ink); font: inherit; font-size: .77rem; font-weight: 750; text-decoration: none; }
.account-nav form { display: inline-flex; margin: 0; }
.account-nav button { cursor: pointer; }
.theme-nav a[aria-current="page"], .account-nav a[aria-current="page"] { border-color: var(--navy); background: var(--navy); color: #fffaf0; }
.theme-nav a:hover, .account-nav a:hover, .account-nav button:hover { border-color: var(--accent-strong); background: var(--surface-alt); }

.profile-layout { width: min(100% - 2rem, 68rem); margin: 0 auto; padding: clamp(1.4rem, 5vw, 3rem) 0 4rem; }
.page-intro { max-width: 48rem; }
.eyebrow { margin: 0 0 .45rem; color: var(--signal); font-size: .75rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; line-height: 1.1; }
h1 { font-size: clamp(2rem, 7vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2.1rem); }
.lead, .section-lead { max-width: 58rem; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.login-note { margin: 1rem 0 0; padding: .8rem 1rem; border-left: .25rem solid var(--accent-strong); background: var(--surface); color: var(--muted); }
.login-note span { color: var(--ink); font-weight: 700; }
.message-stack { display: grid; gap: .6rem; margin-top: 1rem; }
.message, .error-summary { margin: 0; padding: .8rem 1rem; border-radius: .28rem; background: #e0eadb; color: #2b654e; font-weight: 700; }
.message-error, .error-summary { background: #f4e3c7; color: #914620; }
.error-summary ul, .field-errors ul { margin: .4rem 0 0; padding-left: 1.15rem; }

.card { margin-top: 1.2rem; padding: clamp(1.1rem, 4vw, 2rem); border: 1px solid var(--line); border-radius: .38rem; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.privacy-badge { display: inline-flex; flex: 0 0 auto; min-height: 2rem; align-items: center; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: .18rem; background: var(--surface-alt); color: var(--navy); font-size: .73rem; font-weight: 800; }
.section-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .7rem; margin-top: 1rem; }
.section-nav a { display: flex; min-height: 2.75rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .28rem; background: var(--surface); color: var(--ink); font-weight: 750; text-decoration: none; }
.section-nav a:hover { border-color: var(--accent-strong); background: var(--surface-alt); }
.open-points { display: grid; gap: .55rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.open-points li { min-width: 0; padding: .7rem .8rem; border-left: .25rem solid var(--signal); background: var(--surface-alt); }
.open-points a { font-weight: 750; }

.profile-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.field-grid { display: grid; gap: 1rem; margin-top: 1.2rem; }
.phase-note { padding: .75rem 1rem; border-left: .25rem solid var(--signal); background: var(--surface-alt); font-weight: 700; }
.field label { display: block; color: var(--navy-deep); font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; min-height: 3rem; margin-top: .35rem; padding: .65rem .7rem; border: 1px solid var(--line-strong); border-radius: .28rem; background: #fffaf0; color: var(--ink); font: inherit; }
.field-help { margin: .3rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.field-errors { margin-top: .35rem; color: #914620; font-size: .85rem; font-weight: 700; }
.field-invalid input, .field-invalid select, .field-invalid textarea { border-color: var(--signal); }
.mfa-steps { display: grid; gap: .8rem; margin: 1rem 0 0; padding-left: 1.4rem; line-height: 1.55; }
.mfa-key-label { margin-bottom: .4rem; color: var(--navy-deep); font-weight: 800; }
.mfa-key { display: block; padding: .9rem; border: 1px solid var(--line); border-radius: .28rem; background: var(--surface-alt); color: var(--ink); font-size: 1.05rem; letter-spacing: .08em; overflow-wrap: anywhere; user-select: text; }
.rule-content { margin-top: 1rem; border: 1px solid var(--line); background: var(--surface-alt); }
.rule-content summary { min-height: 2.75rem; padding: .75rem .85rem; cursor: pointer; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; font-weight: 700; }
.rule-content > :not(summary) { padding: 0 .85rem .85rem; line-height: 1.55; }
details.card summary { cursor: pointer; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 1.4rem; font-weight: 700; }
.role-note, .loss-notice { margin: 1rem 0 0; padding: .8rem 1rem; border-left: .25rem solid var(--accent-strong); background: var(--surface-alt); color: var(--muted); line-height: 1.5; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }
.button { display: inline-flex; min-height: 2.85rem; align-items: center; justify-content: center; padding: .65rem .95rem; border: 1px solid transparent; border-radius: .28rem; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.button-primary { border-color: #6f2019; background: #9b3028; color: #fff; box-shadow: inset 0 1px rgba(255, 255, 255, .2), 0 .18rem 0 #6f2019; }
.button-primary:hover { background: #7e261f; }
.button-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--navy); }
.button-danger { border-color: #6f2019; background: #852a1b; color: #fff; }
.button:disabled { border-color: #88969a; background: #88969a; cursor: not-allowed; }
.conflict-card { border-left: .3rem solid var(--signal); }
.current-values { display: grid; gap: .45rem; margin: 1rem 0 0; }
.current-values div { display: grid; grid-template-columns: minmax(9rem, .7fr) minmax(0, 1fr); gap: .8rem; padding: .55rem 0; border-top: 1px solid rgba(119, 141, 146, .45); }
.current-values dt { color: var(--muted); }
.current-values dd { margin: 0; overflow-wrap: anywhere; font-weight: 750; }
.later-card { border-left: .3rem solid #7c4b91; }
.withdraw-card { border-color: #c58b68; }
.withdraw-form { margin-top: 1rem; }
.confirm-line { display: grid; grid-template-columns: 1.35rem minmax(0, 1fr); gap: .65rem; align-items: start; font-weight: 750; }
.confirm-line input { width: 1.2rem; height: 1.2rem; margin: .15rem 0 0; accent-color: var(--signal); }
.withdraw-form .button { margin-top: .9rem; }
.neutral-result { width: min(100% - 2rem, 42rem); margin: 15vh auto 0; padding: clamp(1.4rem, 5vw, 2.5rem); border: 1px solid var(--line); border-radius: .38rem; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.result-message { margin: 1rem 0; color: var(--muted); line-height: 1.6; }

/* Nacht bleibt die freigegebene Kapitänskajüte: Holz außen, helle Pergamentkarten innen. */
body.theme-night { color-scheme: dark; --canvas: #21130b; --surface: #f1e2bc; --surface-alt: #dcc79a; --ink: #2a190e; --muted: #604b30; --navy: #5a3b1e; --navy-deep: #2a190e; --accent: #b88b31; --accent-strong: #674611; --signal: #9b3028; --line: #a17d42; --line-strong: #7c5a29; --focus: #153e58; --shadow: 0 1rem 2.5rem rgba(9, 5, 2, .36); background: radial-gradient(circle at 82% 5%, rgba(67, 119, 126, .24), transparent 25rem), repeating-linear-gradient(92deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 4.5rem), linear-gradient(102deg, #160c07, #3b2413 47%, #1a0f09); background-attachment: fixed; color: #f4e8c8; }
body.theme-night .masthead { border-bottom: .24rem double #b88b31; background: linear-gradient(rgba(6, 24, 30, .86), rgba(10, 44, 50, .9)), repeating-linear-gradient(90deg, transparent 0 4rem, rgba(255, 255, 255, .035) 4.05rem), #0b2a32; color: #fff5d8; box-shadow: inset 0 -.2rem rgba(0, 0, 0, .28); }
body.theme-night .brand, body.theme-night .brand small { color: #fff5d8; }
body.theme-night .brand small { color: #d2c299; }
body.theme-night .brand-mark { border-color: rgba(216, 182, 109, .72); border-radius: 50% 50% 50% .15rem; background: rgba(184, 139, 49, .13); color: #e6c773; }
body.theme-night .theme-nav a, body.theme-night .account-nav a, body.theme-night .account-nav button { border-color: rgba(216, 182, 109, .72); background: rgba(241, 226, 188, .12); color: #fff5d8; }
body.theme-night .theme-nav a[aria-current="page"], body.theme-night .account-nav a[aria-current="page"] { border-color: #fff0c8; background: #9b3028; color: #fff; }
body.theme-night .page-intro h1, body.theme-night .page-intro h2, body.theme-night .page-intro .lead, body.theme-night .page-intro > a { color: #f4e8c8; }
body.theme-night .page-intro .eyebrow { color: #d8b66d; }
body.theme-night .page-intro a:not(.button) { color: #f0cc7b; }
body.theme-night .card, body.theme-night .neutral-result, body.theme-night .login-note { background: #f1e2bc; color: #2a190e; }
body.theme-night .card .section-lead, body.theme-night .card .field-help, body.theme-night .card .result-message { color: var(--muted); }
body.theme-night .field label, body.theme-night .mfa-key-label { color: #2a190e; }
body.theme-night .field input, body.theme-night .field select, body.theme-night .field textarea { background: #fffaf0; color: #2a190e; }
body.theme-night .login-note span { color: #2a190e; }
body.theme-night .privacy-badge { color: #2a190e; }

@media (min-width: 44rem) { .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 42rem) {
  .masthead-inner { flex-direction: row; flex-wrap: wrap; gap: .7rem .5rem; }
  .brand { flex: 1 0 auto; white-space: nowrap; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .theme-nav { justify-content: flex-end; }
  .theme-nav a { flex: 0 1 auto; }
  .account-nav { flex: 1 1 100%; justify-content: flex-start; }
  .account-nav a, .account-nav form { flex: 1 1 auto; }
  .account-nav button { width: 100%; }
}
@media (max-width: 34rem) { .profile-layout { width: min(100% - 1rem, 68rem); } .card { padding: 1rem; } .form-actions .button, .withdraw-form .button { width: 100%; } .current-values div { grid-template-columns: 1fr; gap: .15rem; } }

.auth-layout { width: min(100% - 2rem, 30rem); }
.auth-layout h1 { font-size: clamp(1.75rem, 6vw, 2.25rem); overflow-wrap: anywhere; }
.auth-layout p { line-height: 1.5; }
.auth-masthead .masthead-inner { flex-direction: row; align-items: center; }
.auth-masthead .theme-nav a { flex: 0 0 auto; }
.field input.auth-code { font-size: 1.5rem; letter-spacing: .3rem; }
.auth-cancel { margin-top: 1rem; }
.auth-cancel button { min-height: 2.75rem; padding: .5rem 0; border: 0; background: transparent; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; }
body.theme-night .auth-cancel button { color: #f0cc7b; }
