:root {
    --color-bg: #434b55;
    --color-bg-alt: #191e23;
    --color-accent: #0073aa;
    --color-accent-hover: #00a0d2;
    --color-text: #f1f1f1;
    --color-border: #32373c;
    --color-red: #d63638;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui,sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    padding: 0;
    line-height: 1.6;
    font-size: 1rem;
    margin: 0;
    height: 100vh;
    background-image: url('sverige.jpg');
    background-repeat: no-repeat;
    background-size: auto 100vh;
    /* Höhe voll ausnutzen, Breite automatisch */
    background-position: right center;
    /* rechter Rand des Bildes = rechter Rand des Fensters */
    background-attachment: fixed;
    /* optional: Bild bleibt beim Scrollen fixiert */;
}

h1 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
}

.heading-red {
    background: var(--color-red);
    color: #fff;
    padding: 0.6rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.2rem;
}

h3 {
    font-size: 1.2rem;
}

form {
    background: var(--color-bg-alt);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin-bottom: 1.5rem;
}

label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
}

input[type="text"], select {
    width: 100%;
    padding: 0.9rem;
    border: 2px solid #ffe680;
    border-radius: 12px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 1rem;
    margin-top: 0.5rem;
}

input[type="text"]:focus, select:focus {
    border-color: #ffe680;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.4);
}

button, .btn, nav li a {
    width: 100%;
    padding: 1.1rem;
    font-size: 1.3rem;
    border-radius: 12px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease;
}

button {
    background: var(--color-accent);
    color: #fff;
    margin-bottom: 0.5rem;
}

button:not(.hint-btn):hover,
button:not(.hint-btn):focus {
    background: var(--color-accent-hover);
}

.btn {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.btn:hover {
    background: var(--color-accent-hover);
}

nav li a {
    background: var(--color-bg-alt);
    color: var(--color-text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    margin-bottom: 0.5rem;
}

nav li a:hover {
    background: var(--color-accent);
}

p {
    margin-bottom: 0rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.result-box {
    background: var(--color-bg-alt);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    display: grid;
    gap: 0.6rem;
}

.result-box b {
    color: var(--color-accent);
}

.result-buttons .btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

nav ul {
    list-style: none;
    gap: 1rem;
}

.feedback {
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.3rem;
}

.useranz {
    text-align: center;
}

.feedback.correct {
    background-color: #28a745;
    color: #fff;
    margin-bottom: 0.5rem;
}

.feedback.wrong {
    background-color: #dc3545;
    color: #fff;
    margin-bottom: 0.5rem;
}

.audio-btn, .speech-btn {
    background: var(--color-accent);
    border: none;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    margin-left: 0.5rem;
    flex-shrink: 0;
    transition: background 0.2s ease;
    position: relative;
    top: 6px;
}

.audio-btn:hover, .speech-btn:hover {
    background: var(--color-accent-hover);
}

.hint-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: none;
    background-color: #ffe680;
    /* Gelber Kreis */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    margin-left: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-image 0.1s ease, background-color 0.1s ease, box-shadow 0.1s ease;
    color: black;
}

/* 🇸🇪 Schweden-Flagge beim Hover */
.flag-de {
    position: relative;
    overflow: hidden;
}

.flag-de::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("flags/se.svg") center/cover no-repeat;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 50%;
}

/* Flagge einblenden beim Hover */
.flag-de:hover::after {
    opacity: 1;
}

/* Glühbirne ausblenden */
.flag-de i {
    transition: opacity 0.4s ease;
}

.flag-de:hover i {
    opacity: 0;
}

/* 🇩🇪 Deutschland-Flagge beim Hover */
.flag-se {
    position: relative;
    overflow: hidden;
}

.flag-se::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("flags/de.svg") center/cover no-repeat;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 50%;
}

/* Flagge einblenden beim Hover */
.flag-se:hover::after {
    opacity: 1;
}

/* Glühbirne ausblenden */
.flag-se i {
    transition: opacity 0.4s ease;
}

.flag-se:hover i {
    opacity: 0;
}

/* =========================
   noUiSlider Mobilfreundlich
   ========================= */

/* Slider-Container */
.noUi-target {
    position: relative;
    direction: ltr;
    border-radius: 6px;
    background: #434b55;
    /* dunkler Hintergrund */
    height: 14px;
    margin: 1rem 0;
    touch-action: none;
}

/* Basis der Schiene */
.noUi-base {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Aktive Strecke zwischen Handles */
.noUi-connect {
    background: #2196F3;
    /* blau für aktive Strecke */
    height: 100%;
    border-radius: 6px;
}

/* Handle / Griff */
.noUi-handle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #2196F3;
    cursor: pointer;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    touch-action: pan-x;
}

/* Hover */
.noUi-handle:hover {
    background: #f0f0f0;
}

/* Tooltip */
.noUi-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #2196F3;
    color: #fff;
    padding: 2px 6px;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
}

/* Pips / Marker */
.noUi-pips {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 20px;
    font-size: 0.7rem;
    color: #ddd;
}

.noUi-marker {
    display: inline-block;
    width: 2px;
    height: 8px;
    background: var(--muted-2);
    position: absolute;
}

.noUi-marker-large {
    height: 12px;
    background: #fff;
}

/* Horizontal / Vertikal */
.noUi-horizontal .noUi-marker {
    top: 0;
}

.noUi-vertical .noUi-marker {
    left: 0;
}

/* Mobilanpassung */
@media (max-width: 768px) {
    .noUi-handle {
        height: 28px;
    width: 28px;
}

.noUi-tooltip {
    font-size: 0.95rem;
    top: -40px;
}

}

/* =========================
   Theme-Variablen (Dark UI)
   ========================= */
:root {
    --bg-elev: #434b55;
    /* dunkle Kachel / Scrollbox */
  --track: #2f3a45;
    /* Slider-Grundlinie */
  --accent: #2196F3;
    /* Akzentfarbe (wie deine Switches) */
  --text: #ffffff;
    /* Primärtext auf dunklem Bg */
  --muted: #a9b2bd;
    /* Dezente UI-Elemente */
  --muted-2: #7e8a97;
    /* dunklere Variante */
  --border: #bbbbbb;
    /* helle Ränder auf Dunkel */
  --radius: 6px;
    /* einheitliche Rundung */
  --shadow-1: 0 1px 2px rgba(0,0,0,.25);
    --shadow-2: 0 2px 10px rgba(0,0,0,.25);
}

/* =========================
   noUiSlider – Basis + Theme
   (ersetzt CDN-CSS vollständig)
   ========================= */

/* Resets & Interaktion */
.noUi-target,
.noUi-target * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: none;
}

.noUi-target {
    position: relative;
    border-radius: var(--radius);
    background: var(--track);
    /* Linienfarbe der Strecke */
  box-shadow: var(--shadow-1);
    touch-action: pan-y !important;
}

/* Größe/Orientierung */
.noUi-horizontal {
    height: 6px;
}

.noUi-vertical {
    width: 6px;
    height: 160px;
}

/* Innenleben */
.noUi-base,
.noUi-connects {
    position: relative;
    width: 100%;
    height: 100%;
}

.noUi-connects {
    overflow: hidden;
    border-radius: var(--radius);
}

.noUi-connect {
    background: var(--accent);
}

/* Handle (Griff) */
.noUi-handle {
    position: absolute;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: var(--shadow-2);
    cursor: grab;
    outline: none;
}

.noUi-active .noUi-handle {
    cursor: grabbing;
}

/* Exakte Handle-Positionierung für horizontal */
.noUi-horizontal .noUi-handle {
    width: 22px;
    height: 22px;
    top: -7px;
    /* mittig zur 6px-Linie */
  right: -11px;
}

/* Exakte Handle-Positionierung für vertikal (falls benötigt) */
.noUi-vertical .noUi-handle {
    width: 22px;
    height: 22px;
    left: -8px;
    top: -11px;
}

/* Deko-Linien im Handle entfernen */
.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

/* Tastatur-/Focus-Style (A11y) */
.noUi-handle:focus-visible {
    box-shadow: 0 0 0 3px rgba(33,150,243,0.35), /* Akzent-Focusring */
    var(--shadow-2);
}

/* Disabled-Zustand */
.noUi-disabled,
.noUi-target[disabled] {
    opacity: .55;
    pointer-events: none;
}

/* (Optional) Tooltips, falls du sie später aktivierst */
.noUi-tooltip {
    display: inline-block;
    position: absolute;
    bottom: 130%;
    transform: translateX(-50%);
    left: 50%;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: #0f1720;
    background: #e8f4ff;
    border: 1px solid #c9e4ff;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* (Optional) Pips/Marken – nur relevant, falls genutzt */
.noUi-pips {
    position: relative;
    color: var(--muted);
}

.noUi-pips-horizontal {
    height: 36px;
    padding-top: 8px;
}

.noUi-marker-horizontal.noUi-marker {
    width: 2px;
    height: 8px;
    transform: translateX(-1px);
}

.noUi-value {
    position: absolute;
    font-size: 0.8rem;
    color: var(--muted);
    transform: translateX(-50%);
}

/* Container des Sliders (damit er nicht an den Rand “klebt”) */
#rangSlider {
    margin: 8px 4px 6px;
}

/* =========================
   Switch-Styles (aus Inline <style> extrahiert)
   ========================= */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    margin: 0 6px;
    top: 5px;
}

.switch input {
    display: none;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #9aa3ad;
    /* neutral off */
  transition: .25s;
    border-radius: 24px;
    box-shadow: var(--shadow-1);
}

.switch .slider::before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: .25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.35);
}

.switch input:checked + .slider {
    background: var(--accent);
}

.switch input:checked + .slider::before {
    transform: translateX(22px);
}

/* Fokus-Style für Switch (A11y) */
.switch input:focus-visible + .slider {
    outline: 2px solid rgba(33,150,243,0.6);
    outline-offset: 2px;
}

/* =========================
   Scrollbox + Suchfeld (aus Inline <style> extrahiert)
   ========================= */
#kapitelSearch {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    color: #111;
}

.scrollbox {
    max-height: 200px;
    overflow-y: auto;
    background: #434b55;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-1);
}

.scrollbox label {
    display: block;
    margin: 2px 0;
    font-size: 1.2rem;
    padding-bottom: 0.4rem;
    color: white;
}

/* Custom Scrollbar (WebKit) */
.scrollbox::-webkit-scrollbar {
    width: 12px;
}

.scrollbox::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

.scrollbox::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* (Optional) Firefox scrollbar colors */
.scrollbox {
    scrollbar-color: #76808a transparent;
    scrollbar-width: thin;
}

/* Fix für die Connect-/Origin-Geometrie (entscheidend für Positionierung) */
.noUi-origin,
.noUi-connect {
    will-change: transform;
    transform-origin: 0 0;
}

/* Abstand wie beim Rang-Slider */
#paketSlider {
    margin: 8px 4px 6px;
}

/* Fix für Chrome Mobile */
.noUi-horizontal {
    height: 14px !important;
}

.noUi-horizontal .noUi-handle {
    top: -7px !important;
}

.noUi-handle {
    touch-action: pan-x !important;
}

/* Kapitel-Liste (Scrollbox) */
.scrollbox {
    max-height: 200px;
    /* begrenzt die Höhe der Box */
  overflow-y: auto;
    /* eigener Scroll innerhalb der Box */
  background: var(--bg-elev, #434b55);
    padding: 4px 8px;
    border-radius: var(--radius, 6px);
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
    scrollbar-color: #76808a transparent;
    /* Firefox */
  scrollbar-width: thin;
}

/* WebKit Scrollbar Styling (optional, hübscher) */
.scrollbox::-webkit-scrollbar {
    width: 12px;
}

/* Suchfeld über der Liste (falls gewünscht, wieder zentral) */
#kapitelSearch {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border, #bbbbbb);
    border-radius: var(--radius, 6px);
    background: #ffffff;
    color: #111;
    outline: none;
}

@media (max-width:430px) {
    h1,.heading-red{font-size: 1.8rem;
}

button,.btn,nav li a,input[type="text"],select {
    font-size: 1.2rem;
    padding: 1rem;
}

p,.result-box,.feedback,label {
    font-size: 1.2rem;
}

}

    .switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    margin: 0 6px;
    top: 5px;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

#kapitelSearch {
    width: 100%;
    padding: 6px;
    margin-bottom: 6px;
    border: 1px solid #bbb;
    border-radius: 6px;
}

.scrollbox::-webkit-scrollbar {
    width: 12px;
}

.logout-btn {
    background: #ff6b6b;
    color: #000;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
    margin-top: -2px;
    height: 4rem;
}

.logout-btn:hover {
    background: #e55050;
}

.liga-container {
    margin-top: 2rem;
    border-radius: 12px;
    overflow: hidden;
    background-color: #2f3a45;
}

.liga-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 1.2rem;
    font-weight: 600;
}

.liga-entry:last-child {
    border-bottom: none;
}

.liga-self {
    background: var(--color-bg);
    border: 2px solid #ffe680;
    border-radius: 12px;
    padding: 0.9rem;
    color: var(--color-text);
    font-size: 1.3rem;
    margin-top: 0.5rem;
}

.liga-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.liga-rank {
    width: 2rem;
    text-align: left;
    font-weight: bold;
}

.liga-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.liga-stars {
    margin-left: 0.4rem;
}

.liga-stars i {
    color: #bbb;
}

.liga-stars i.active {
    color: gold;
}

.liga-right {
    text-align: right;
    min-width: 6rem;
    font-weight: 700;
}

body > :not(h1) {
    margin-left: 20px;
    margin-right: 20px;
}

