/*
 * base.css - Grundlage des Designs (globale claude.md, Abschnitt 22)
 *
 * Farben als Variablen in zwei Sätzen: hell und dunkel. Grundannahme ist die
 * Einstellung des Systems, der User kann mit data-theme dagegen umschalten.
 * Kein Build, keine externe Bibliothek, Schrift Roboto selbst gehostet.
 */

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/roboto-latin-400-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/roboto-latin-ext-400-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/roboto-latin-500-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/roboto-latin-ext-500-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/roboto-latin-700-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/roboto-latin-ext-700-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Farben ---------- */

:root {
    --font-family: "Roboto", "Segoe UI", "Helvetica Neue", Arial, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;

    --color-surface: #ffffff;
    --color-surface-alt: #f4f6f9;
    --color-surface-raised: #ffffff;
    --color-text: #1e2a35;
    --color-text-muted: #5a6978;
    --color-border: #d6dde5;
    --color-border-strong: #aab6c3;

    --color-primary: #ef7b17;
    --color-primary-hover: #d86c0f;
    --color-on-primary: #ffffff;
    --color-accent: #5dafe2;
    --color-link: #1f6fa8;
    --color-link-hover: #15537f;
    --color-danger: #c8323f;
    --color-danger-surface: #fbe9eb;
    --color-success: #237a47;
    --color-success-surface: #e6f4ec;
    --color-info-surface: #e8f3fb;
    --color-required: #ef7b17;
    --color-stripe: #eef6fc;

    --shadow-card: 0 10px 30px rgba(30, 42, 53, 0.08), 0 1px 3px rgba(30, 42, 53, 0.06);
    --radius: 16px;
    --radius-small: 10px;
    --focus-ring: 0 0 0 3px rgba(93, 175, 226, 0.55);
    --logo-light-display: none;
    --logo-dark-display: block;
    --theme-link-dark-display: inline-flex;
    --theme-link-light-display: none;
    /* Etikett "Art: Name" wie bei AnimeOnIce.de: dunkles Blau, weiße Schrift, Link in Orange */
    --color-credit-background: rgba(8, 26, 51, 0.9);
    --color-credit-link: #ff9140;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-surface: #161b22;
        --color-surface-alt: #0f1317;
        --color-surface-raised: #1d242d;
        --color-text: #e8edf2;
        --color-text-muted: #a3b0bd;
        --color-border: #2b3541;
        --color-border-strong: #475562;

        --color-primary: #f48a2e;
        --color-primary-hover: #f7a254;
        --color-on-primary: #1b0d08;
        --color-accent: #6fbdf0;
        --color-link: #7cc3f2;
        --color-link-hover: #a5d6f7;
        --color-danger: #ff7b86;
        --color-danger-surface: #3a1f23;
        --color-success: #6fd095;
        --color-success-surface: #1b3327;
        --color-info-surface: #1b2a36;
        --color-required: #f48a2e;
        --color-stripe: #17222c;

        --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
        --focus-ring: 0 0 0 3px rgba(111, 189, 240, 0.6);
        --logo-light-display: block;
        --logo-dark-display: none;
        --theme-link-dark-display: none;
        --theme-link-light-display: inline-flex;
    }
}

:root[data-theme="dark"] {
    --color-surface: #161b22;
    --color-surface-alt: #0f1317;
    --color-surface-raised: #1d242d;
    --color-text: #e8edf2;
    --color-text-muted: #a3b0bd;
    --color-border: #2b3541;
    --color-border-strong: #475562;

    --color-primary: #f48a2e;
    --color-primary-hover: #f7a254;
    --color-on-primary: #1b0d08;
    --color-accent: #6fbdf0;
    --color-link: #7cc3f2;
    --color-link-hover: #a5d6f7;
    --color-danger: #ff7b86;
    --color-danger-surface: #3a1f23;
    --color-success: #6fd095;
    --color-success-surface: #1b3327;
    --color-info-surface: #1b2a36;
    --color-required: #f48a2e;
        --color-stripe: #17222c;

    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
    --focus-ring: 0 0 0 3px rgba(111, 189, 240, 0.6);
    --logo-light-display: block;
    --logo-dark-display: none;
    --theme-link-dark-display: none;
    --theme-link-light-display: inline-flex;
}

/* ---------- Grundlagen ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-surface-alt);
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-surface-alt);
    color: var(--color-text);
}

h1,
h2,
h3 {
    line-height: 1.25;
    margin: 0 0 0.5em;
    font-weight: 700;
}

h1 {
    font-size: 1.6rem;
}

h2 {
    font-size: 1.2rem;
    margin-top: 1.5em;
}

h3 {
    font-size: 1.05rem;
    margin-top: 1.25em;
}

p {
    margin: 0 0 1em;
}

a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--color-primary);
    text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-small);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    background: var(--color-primary);
    color: var(--color-on-primary);
    padding: 8px 14px;
    border-radius: var(--radius-small);
    z-index: 100;
}

.skip-link:focus {
    top: 12px;
}

.icon {
    width: 1.25em;
    height: 1.25em;
    vertical-align: -0.3em;
    flex: none;
}

.muted {
    color: var(--color-text-muted);
}

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button-primary {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.button-primary:hover {
    background: var(--color-primary-hover);
    color: var(--color-on-primary);
}

.button-secondary {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.button-secondary:hover {
    background: var(--color-info-surface);
    border-color: var(--color-accent);
    color: var(--color-text);
}

.button-danger {
    background: var(--color-danger);
    color: #ffffff;
}

.button-danger:hover {
    filter: brightness(0.92);
}

.button-block {
    width: 100%;
}

.button[disabled],
.button[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.button-row .button {
    flex: 1 1 160px;
}

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* ---------- Formulare (22.4) ---------- */

/* Erklärung UNTER dem Feld (CSS order), damit Felder einer Reihe auf einer Höhe stehen
   (globale claude.md 22.4, dritte Runde; im Account nachgezogen am 2026-10-17, Michael).
   Für Screenreader bleibt die Erklärung über aria-describedby verknüpft */
.field {
    margin: 0 0 18px;
    display: flex;
    flex-direction: column;
}

.field > .field-label {
    order: 1;
}

.field > .field-control,
.field > .field-input,
.field > .field-select {
    order: 2;
}

.field > .field-hint {
    order: 3;
}

.field > .field-error {
    order: 4;
}

.field-label {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
}

.field-required {
    color: var(--color-required);
    font-weight: 700;
    margin-left: 2px;
}

.field-hint {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 6px;
}

.field-input,
.field-select {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    font: inherit;
    color: var(--color-text);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-small);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input:focus,
.field-select:focus {
    border-color: var(--color-accent);
}

.field-required-input .field-input,
.field-required-input .field-select {
    border-left: 3px solid var(--color-required);
}

.field-invalid .field-input,
.field-invalid .field-select {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 1px var(--color-danger);
}

.field-error {
    display: block;
    color: var(--color-danger);
    font-size: 0.92rem;
    margin-top: 6px;
}

.field-error::before {
    content: "";
}

.field-control {
    position: relative;
}

.field-password .field-input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
}

.password-toggle:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
}

.field-checkbox {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
}

.field-checkbox input {
    width: 22px;
    height: 22px;
    margin: 2px 0 0;
    accent-color: var(--color-primary);
}

.field-group {
    display: grid;
    gap: 0 16px;
}

.field-group-2 > .field,
.section-card form > .field {
    padding: 16px 18px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
}

.field-group-2 > .field .field-input,
.field-group-2 > .field .field-select,
.section-card form > .field .field-input,
.section-card form > .field .field-select {
    background: var(--color-surface);
}

.field-group-2 > .field .field-label,
.section-card form > .field .field-label {
    margin-bottom: 6px;
}

.field-group-2 > .field .field-hint,
.section-card form > .field .field-hint {
    margin-top: 8px;
}

@media (min-width: 560px) {
    .field-group-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.required-hint {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin: -6px 0 16px;
}

.code-input {
    font-size: 1.4rem;
    letter-spacing: 0.2em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.secret-box {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    word-break: break-all;
    padding: 12px 14px;
    background: var(--color-surface-alt);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-small);
    user-select: all;
}

.code-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
    margin: 12px 0 20px;
    padding: 0;
    list-style: none;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
}

/* ---------- Meldungen ---------- */

.flash {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    margin: 0 0 18px;
    border-radius: var(--radius-small);
    border: 1px solid var(--color-border);
    background: var(--color-info-surface);
}

.flash p:last-child {
    margin: 0;
}

.flash-error {
    background: var(--color-danger-surface);
    border-color: var(--color-danger);
    color: var(--color-text);
}

.flash-error .icon {
    color: var(--color-danger);
}

.flash-success {
    background: var(--color-success-surface);
    border-color: var(--color-success);
}

.flash-success .icon {
    color: var(--color-success);
}

.flash-info .icon {
    color: var(--color-link);
}

/* ---------- Listen und Tabellen ---------- */

.definition-list {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 2fr;
    gap: 8px 16px;
    margin: 0 0 16px;
}

.definition-list dt {
    font-weight: 500;
    color: var(--color-text-muted);
}

.definition-list dd {
    margin: 0;
}

.item-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.item-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 20px 0;
    border-top: 1px solid var(--color-border);
}

.item-list li:first-child {
    border-top: 0;
}

.item-main {
    flex: 1 1 200px;
}

.item-title {
    font-weight: 500;
}

.item-meta {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.inline-form {
    display: inline;
}

.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}

.status-pill-on {
    background: var(--color-success-surface);
    border-color: var(--color-success);
    color: var(--color-success);
}

/* ---------- Rechtstexte ---------- */

.legal-text {
    line-height: 1.6;
}

.legal-text h2 {
    margin: 2em 0 0.8em;
    padding: 10px 14px;
    background: var(--color-info-surface);
    border-left: 4px solid var(--color-primary);
    border-radius: 8px;
    font-size: 1.1rem;
}

.legal-text h3 {
    margin-top: 1.5em;
}

/* Nummerierte Klauseln in einer Flucht: Nummer links, Text eingerückt */
.legal-text .clause {
    display: grid;
    grid-template-columns: 3.4em 1fr;
    gap: 0 8px;
}

.legal-text .clause-number {
    font-weight: 500;
    color: var(--color-text-muted);
}

.legal-text ul,
.legal-text ol {
    padding-left: 1.6em;
    margin: 0 0 1em;
}

.legal-text li {
    padding-left: 0.3em;
    margin-bottom: 0.35em;
}

.legal-text li > ul,
.legal-text li > ol {
    margin: 0.35em 0 0;
}

.legal-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.2em;
    font-size: 0.95rem;
    border: 1px solid var(--color-border-strong);
}

.legal-text th,
.legal-text td {
    text-align: left;
    vertical-align: top;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
}

.legal-text th {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-color: var(--color-primary);
    font-weight: 700;
}

.legal-text tbody tr:nth-child(even) {
    background: var(--color-stripe);
}

.toc {
    margin: 0 0 1.5em;
    padding: 14px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-surface-alt);
}

.toc-title {
    font-weight: 700;
    margin: 0 0 6px;
}

.toc ol {
    margin: 0;
    padding-left: 1.4em;
    columns: 2;
    column-gap: 24px;
}

.toc li {
    margin: 0 0 4px;
    break-inside: avoid;
}

@media (max-width: 640px) {
    .toc ol {
        columns: 1;
    }
}

@media (max-width: 640px) {
    .legal-text table {
        display: block;
        overflow-x: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ---------- QR-Code für die Authenticator-App ---------- */

/* Immer dunkel auf hell, auch im Dark Mode: Kameras lesen das sicherer */
.qr-code-box {
    display: inline-block;
    padding: 8px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    line-height: 0;
}

.qr-code {
    display: block;
    width: 200px;
    height: 200px;
    color: #000000;
}

/* ---------- Kleine Buttons und Reihen ---------- */

.button-small {
    height: 36px;
    padding: 0 14px;
    font-size: 0.9rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.button-small .icon {
    width: 1.1em;
    height: 1.1em;
}

.button-row-end {
    justify-content: flex-end;
}

.button-row-end .button {
    flex: 0 0 auto;
    min-width: 160px;
}

.button-with-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

.button-with-hint .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Markenfarbe von Discord nur beim Hover, der Rest bleibt unser Design */
.button-discord:hover {
    border-color: #5865f2;
    color: #5865f2;
}

.icon-brand {
    fill: currentColor;
}

/* Versteckte Elemente bleiben versteckt, auch wenn eine Klasse display setzt */
[hidden] {
    display: none !important;
}

/* ---------- Rubriken mit Unterpunkten, z.B. Passkeys ---------- */

.item-list li.item-stacked > .item-main {
    flex: 0 0 auto;
    width: 100%;
}

.sub-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0 0 0 16px;
    border-left: 3px solid var(--color-accent);
    width: 100%;
}

.sub-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 0;
    border-top: 1px solid var(--color-border);
}

.sub-list li:first-child {
    border-top: 0;
    padding-top: 0;
}

.sub-box {
    width: 100%;
    margin-top: 14px;
    padding: 14px 16px 4px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
}

.sub-box .field-input {
    background: var(--color-surface);
}

.sub-box .button {
    margin-bottom: 10px;
}

/* ---------- Lange Texte brechen um, nichts läuft über ---------- */

pre {
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------- Rückfrage vor kritischen Handlungen ---------- */

.confirm-dialog {
    width: min(92vw, 460px);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-card);
}

.confirm-dialog::backdrop {
    background: rgba(15, 19, 23, 0.55);
}

.confirm-dialog-inner {
    padding: 24px 28px 28px;
}

.confirm-dialog h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    font-size: 1.15rem;
}

.confirm-dialog h2 .icon {
    color: var(--color-danger);
}

.confirm-dialog p {
    margin: 0 0 8px;
}
