﻿  /* ============================================================
     RESET & BASE
  ============================================================ */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    /* base — warmer Stein/Holz statt kaltem Grün-Schwarz */
    --bg:        #1a1712;
    --bg2:       #241f18;   /* Overlays/Panels (vorher undefiniert) */
    --bg3:       #14110c;   /* tiefste Vertiefung (vorher undefiniert) */
    --surface:   #241f18;
    --surface2:  #2f2820;
    --wood:      #6b4a2c;
    --wood-dark: #46301c;
    --border:    #3a2f22;
    /* Text */
    --text:      #efe7d6;
    --text1:     #efe7d6;   /* Alias (vorher undefiniert) */
    --text2:     #b3a98f;
    /* Akzente */
    --gold:      #c8a84b;
    --gold2:     #f0d080;
    --accent:    #e0b24a;   /* warmer interaktiver Akzent (vorher undefiniert) */
    --green:     #2f7d46;
    --green2:    #46b86a;
    --red:       #c0392b;
    --danger:    #c0392b;   /* Alias (vorher undefiniert) */
    --rare:      #b07bd6;   /* ausgewählte Karte / seltene Items */
    /* Kartenflächen — Pergament statt reinweiß */
    --card-bg:   #efe6d2;
    --card-txt:  #211c14;
    --hearts:    #b03030;
    --diamonds:  #b03030;
    --spades:    #211c14;
    --clubs:     #211c14;
    /* Edition-Farben (unverändert) */
    --foil-color:  #4fc3f7;
    --holo-color:  #ffd700;
    --wild-color:  #ce93d8;
    /* Material-Helfer */
    --panel-shadow: 0 4px 16px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.06);
    --bevel: inset 0 2px 0 rgba(255,255,255,.12), inset 0 -3px 0 rgba(0,0,0,.35);
    --r-sm: 5px; --r-md: 9px; --r-lg: 14px;
  }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Georgia', serif;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-x: hidden;
  }
  button {
    cursor: pointer;
    border: none;
    font-family: inherit;
  }
  button:disabled { opacity: 0.4; cursor: not-allowed; }

  /* ============================================================
     SCREENS (nur jeweils einer sichtbar)
  ============================================================ */
  .screen {
    display: none;
    width: 100%;
    max-width: 1280px;
    padding: 20px;
    flex-direction: column;
    align-items: center;
  }
  .screen.active { display: flex; }

  /* ============================================================
     TITLE SCREEN
  ============================================================ */
  #screen-title {
    justify-content: center;
    min-height: 100vh;
    gap: 20px;
    background: radial-gradient(ellipse at center, #2e2415 0%, var(--bg3) 70%);
  }
  .title-logo {
    font-size: 4rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(200,168,75,0.55), 0 0 60px rgba(200,168,75,0.25);
    letter-spacing: 0.15em;
    text-align: center;
  }
  .title-subtitle {
    font-size: 1.1rem;
    color: var(--text2);
    text-align: center;
    letter-spacing: 0.05em;
  }
  .online-count {
    font-size: 0.95rem;
    color: var(--gold2);
    font-weight: bold;
    min-height: 1.2em;
  }
  /* Flavor-Text: Lore statt Funktion - bewusst klein und nach unten gestuft (order) */
  .title-flavor {
    max-width: 460px;
    text-align: center;
    color: var(--text2);
    line-height: 1.5;
    font-size: 0.85rem;
    font-style: italic;
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--surface);
  }

  /* ---- Element-Reihenfolge (Phase: Hauptmenü-Neuanordnung) ----
     Login/Account-Status vor den Buttons, Sekundäraktionen als Leiste,
     Flavor-Text ans Ende - alles per CSS order, keine DOM-Verschiebung nötig. */
  #screen-title .title-suits:first-child { order: 0; }
  .title-logo            { order: 1; }
  .title-subtitle        { order: 2; }
  .online-count           { order: 3; }
  #auth-panel, #forgot-password-panel, #reset-password-panel,
  #verify-email-panel, .logged-panel { order: 4; }
  #btn-guest              { order: 5; }
  .title-secondary-row   { order: 6; }
  .title-flavor          { order: 7; }
  #screen-title .title-suits:last-child  { order: 8; }

  .title-secondary-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 520px;
  }
  .title-secondary-row .btn-secondary { flex: 1 1 110px; }
  .btn-primary {
    background: linear-gradient(180deg, var(--gold2), var(--gold) 45%, #8a6020);
    color: #1a1000;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 14px 48px;
    border-radius: var(--r-md);
    letter-spacing: 0.08em;
    transition: transform .12s, box-shadow .2s, filter .2s;
    box-shadow: var(--bevel), 0 4px 0 #6e4a16, 0 8px 18px rgba(0,0,0,0.5);
  }
  .btn-primary:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: var(--bevel), 0 6px 0 #6e4a16, 0 12px 24px rgba(0,0,0,0.55);
  }
  .btn-primary:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: var(--bevel), 0 1px 0 #6e4a16, 0 3px 8px rgba(0,0,0,0.5);
  }
  .title-suits {
    font-size: 2rem;
    color: var(--gold);
    letter-spacing: 1rem;
    opacity: 0.5;
  }

  /* ---- Account-Panel im Titel-Screen ---- */
  .auth-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 32px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .auth-panel h3 {
    color: var(--gold);
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 4px;
  }
  .auth-panel input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
  }
  .auth-panel input:focus { border-color: var(--gold); }
  .auth-panel input::placeholder { color: var(--text2); }
  .auth-error {
    color: var(--red);
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2em;
  }
  .auth-tabs {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
  }
  .auth-tab {
    flex: 1;
    padding: 8px;
    background: var(--surface2);
    color: var(--text2);
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    transition: all 0.15s;
    text-align: center;
    cursor: pointer;
    border: none;
  }
  .auth-tab.active {
    background: var(--green);
    color: #d0ffd0;
  }

  /* Eingeloggt-Panel */
  .logged-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 28px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  .logged-user {
    font-size: 1.2rem;
    color: var(--gold);
    font-weight: bold;
    text-align: center;
  }
  .logged-elo {
    font-size: 0.9rem;
    color: var(--text2);
    text-align: center;
  }
  .logged-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .btn-secondary {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: bold;
    padding: 10px 24px;
    border-radius: 6px;
    letter-spacing: 0.05em;
    transition: all 0.15s;
  }
  .btn-secondary:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
  }
  .btn-danger {
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    font-size: 0.85rem;
    padding: 7px 16px;
    border-radius: 5px;
    transition: all 0.15s;
  }
  .btn-danger:hover:not(:disabled) {
    background: var(--red);
    color: white;
  }

  /* ============================================================
     HUD (Spielbereich oben)
  ============================================================ */
  #screen-game { gap: 12px; min-height: 100vh; padding-bottom: 30px; }

  #hud {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    align-items: center;
  }
  .hud-block { display: flex; flex-direction: column; gap: 4px; }
  .hud-label { font-size: 0.7rem; color: var(--text2); letter-spacing: 0.08em; text-transform: uppercase; }
  .hud-value { font-size: 1.3rem; color: var(--gold); font-weight: bold; }
  .hud-center { align-items: center; text-align: center; }
  .hud-right { align-items: flex-end; text-align: right; }

  /* Progress bar */
  .progress-wrap { width: 100%; background: var(--bg3); border-radius: 4px; height: 12px; overflow: hidden; border: 1px solid var(--border); box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }
  .progress-bar { height: 100%; background: linear-gradient(180deg, var(--green2), var(--green)); border-radius: 4px; transition: width 0.4s ease; box-shadow: inset 0 1px 0 rgba(255,255,255,0.3); }

  /* Million bar */
  .million-wrap { width: 100%; background: var(--bg3); border-radius: 4px; height: 8px; overflow: hidden; border: 1px solid var(--border); box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }
  .million-bar { height: 100%; background: linear-gradient(180deg, var(--gold2), var(--gold)); border-radius: 4px; transition: width 0.4s ease; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35); }

  /* Beste Hand Anzeige */
  .hud-best-hand {
    font-size: 0.72rem;
    color: var(--text2);
    font-style: italic;
    margin-top: 2px;
  }
  .hud-best-hand span { color: var(--gold2); font-weight: bold; }

  /* Resources */
  .resources {
    display: flex; gap: 16px; justify-content: center; align-items: center;
    flex-wrap: wrap;
  }
  .res-item {
    display: flex; align-items: center; gap: 6px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 14px;
    font-size: 0.95rem;
  }
  .res-icon { font-size: 1.1rem; }
  .res-val { color: var(--gold); font-weight: bold; font-size: 1.1rem; }

  /* Relics strip */
  #relics-strip {
    width: 100%;
    display: flex; gap: 8px; flex-wrap: wrap;
    min-height: 36px;
    align-items: center;
  }
  .relic-chip {
    background: linear-gradient(180deg, var(--surface2), var(--wood-dark));
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.78rem;
    color: var(--gold2);
    cursor: help;
    white-space: nowrap;
    box-shadow: var(--bevel);
    transition: transform .12s, box-shadow .15s;
  }
  .relic-chip:hover { transform: translateY(-2px); box-shadow: var(--bevel), 0 4px 12px rgba(0,0,0,0.5); }

  /* Score flash */
  #score-flash {
    width: 100%;
    text-align: center;
    min-height: 64px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
  }
  .flash-combo { font-size: 1.3rem; color: var(--gold2); font-weight: bold; letter-spacing: 0.05em; }
  .flash-calc { font-size: 1.1rem; color: var(--text); }
  .flash-total { font-size: 1.8rem; color: var(--green2); font-weight: bold; }
  .flash-besthand { font-size: 0.82rem; color: var(--gold); font-style: italic; margin-top: 4px; }
  @keyframes flashIn {
    0%   { opacity: 0; transform: scale(0.7) translateY(10px); }
    60%  { opacity: 1; transform: scale(1.08) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
  }
  .flash-anim { animation: flashIn 0.35s ease forwards; }

  /* ============================================================
     DUEL-HUD (zusätzlich im Duell-Modus)
  ============================================================ */
  #duel-hud {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 10px 20px;
    display: none;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  #duel-hud.active { display: flex; }
  .duel-player-info {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 140px;
  }
  .duel-player-name {
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: bold;
  }
  .duel-player-score {
    font-size: 1.1rem;
    color: var(--green2);
    font-weight: bold;
  }
  .duel-timer {
    font-size: 1.5rem;
    color: var(--gold);
    font-weight: bold;
    text-align: center;
    min-width: 80px;
  }
  .duel-timer.urgent { color: var(--red); animation: timerPulse 1s infinite; }
  @keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }
  .opp-hand-indicator {
    font-size: 0.78rem;
    color: var(--text2);
    margin-top: 4px;
    min-height: 1.1em;
    letter-spacing: 1px;
  }
  .opp-hand-indicator.reveal {
    color: var(--gold);
    font-weight: 600;
    letter-spacing: normal;
    animation: oppHandPop 0.25s ease-out;
  }
  @keyframes oppHandPop {
    0% { transform: scale(0.9); opacity: 0.4; }
    100% { transform: scale(1); opacity: 1; }
  }
  .duel-vs { color: var(--text2); font-size: 0.85rem; text-align: center; }
  .duel-round-badge {
    background: var(--gold);
    color: #1a1000;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 0.8rem;
    font-weight: bold;
  }

  /* Shop-Countdown im Duell */
  #shop-duel-info {
    display: none;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 10px 16px;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  #shop-duel-info.active { display: flex; }

  /* ============================================================
     SORTIER-BUTTONS
  ============================================================ */
  #sort-area {
    width: 100%;
    display: flex; gap: 8px; justify-content: center; align-items: center;
    margin-bottom: 4px;
  }
  .btn-sort {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text2);
    border-radius: 5px;
    padding: 5px 16px;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    transition: all 0.15s;
  }
  .btn-sort:hover { border-color: var(--gold); color: var(--gold); }
  .btn-sort.active { border-color: var(--gold); color: var(--gold); background: #1e2a1e; }

  /* ============================================================
     HAND / CARDS
  ============================================================ */
  #hand-area {
    width: 100%;
    display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
    min-height: 160px; align-items: flex-end;
  }

  .card {
    width: 80px; height: 120px;
    background: linear-gradient(160deg, #f5ecd8 0%, #e7d9be 100%);
    border-radius: 8px;
    border: 2px solid #cdbf9e;
    display: flex; flex-direction: column;
    justify-content: space-between;
    padding: 5px 7px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    user-select: none;
    position: relative;
    box-shadow: 0 4px 14px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.5);
  }
  .card:hover { transform: translateY(-10px); box-shadow: 0 12px 24px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.4); }
  /* .card.selected (Farb-Glow je Suit) steht weiter unten bei --sel-glow */
  .card.hearts   .card-val, .card.hearts   .card-suit-big { color: var(--hearts); }
  .card.diamonds .card-val, .card.diamonds .card-suit-big { color: var(--diamonds); }
  .card.spades   .card-val, .card.spades   .card-suit-big { color: var(--spades); }
  .card.clubs    .card-val, .card.clubs    .card-suit-big { color: var(--clubs); }
  /* Auswahl-Glow je Farbe (rot für Herz/Karo, gold für Pik/Kreuz) */
  .card.hearts, .card.diamonds { --sel-glow: 176,48,48; }
  .card.spades, .card.clubs    { --sel-glow: 200,168,75; }
  .card-top { font-size: 0.85rem; font-weight: bold; line-height: 1; display: flex; flex-direction: column; align-items: flex-start; }
  .card-val { font-size: 1rem; font-weight: bold; line-height: 1; }
  .card-suit-small { font-size: 0.8rem; line-height: 1; }
  .card-suit-big { font-size: 2rem; text-align: center; line-height: 1; }
  .card-bot { font-size: 0.85rem; font-weight: bold; transform: rotate(180deg); line-height: 1; display: flex; flex-direction: column; align-items: flex-start; }

  /* Editions-Rahmen & Label */
  .card.edition-foil {
    border-color: var(--foil-color) !important;
    box-shadow: 0 0 10px rgba(79,195,247,0.55), 0 3px 10px rgba(0,0,0,0.5);
  }
  .card.edition-foil.selected {
    box-shadow: 0 0 22px rgba(79,195,247,0.9);
  }
  .card.edition-holo {
    border-color: var(--holo-color) !important;
    box-shadow: 0 0 10px rgba(255,215,0,0.55), 0 3px 10px rgba(0,0,0,0.5);
  }
  .card.edition-holo.selected {
    box-shadow: 0 0 22px rgba(255,215,0,0.9);
  }
  .card.edition-wild {
    border-color: var(--wild-color) !important;
    box-shadow: 0 0 10px rgba(206,147,216,0.55), 0 3px 10px rgba(0,0,0,0.5);
  }
  .card.edition-wild.selected {
    box-shadow: 0 0 22px rgba(206,147,216,0.9);
  }
  /* Editions-Badge oben rechts auf der Karte */
  .edition-badge {
    position: absolute;
    top: 3px; right: 4px;
    font-size: 0.55rem;
    font-weight: bold;
    border-radius: 3px;
    padding: 1px 3px;
    line-height: 1.2;
    pointer-events: none;
    z-index: 2;
  }
  .edition-badge.foil  { background: var(--foil-color);  color: #002a3a; }
  .edition-badge.holo  { background: var(--holo-color);  color: #3a2800; }
  .edition-badge.wild  { background: var(--wild-color);  color: #1e003a; }

  /* Combo preview badge */
  #combo-preview {
    font-size: 0.95rem;
    color: var(--gold);
    min-height: 22px;
    text-align: center;
    font-style: italic;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
  }
  .combo-preview-text { font-style: italic; }
  .combo-goal-bar-wrap {
    position: relative; width: 160px; height: 5px;
    background: var(--border); border-radius: 3px; overflow: hidden;
  }
  .combo-goal-bar { height: 100%; border-radius: 3px; transition: width 0.2s ease; }
  .combo-goal-label {
    position: absolute; right: -26px; top: -4px;
    font-size: 0.62rem; color: var(--text2); font-style: normal;
  }

  /* Hand-Rang-Tafel — Holz-Plakette, links gedockt auf breiten Desktops */
  #hand-rank { display: none; }
  .rank-title {
    text-align: center; font-size: 0.72rem; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--gold2); font-weight: bold;
    padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--wood-dark);
  }
  .rank-row {
    font-size: 0.78rem; color: var(--text2);
    padding: 4px 8px; border-radius: var(--r-sm);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background .12s, color .12s;
  }
  .rank-row.active {
    color: #1a1000; font-weight: bold;
    background: linear-gradient(180deg, var(--gold2), var(--gold));
    box-shadow: 0 0 12px rgba(200,168,75,0.6);
  }
  @media (min-width: 1600px) {
    #hand-rank {
      display: block;
      position: fixed;
      left: 14px; top: 50%; transform: translateY(-50%);
      width: 150px;
      background: linear-gradient(180deg, var(--wood), var(--wood-dark));
      border: 2px solid var(--wood-dark);
      border-radius: var(--r-lg);
      padding: 10px 8px;
      box-shadow: var(--panel-shadow);
      z-index: 5;
    }
  }

  /* ============================================================
     ACTION BUTTONS
  ============================================================ */
  #action-area {
    display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  }
  .btn-action {
    padding: 12px 32px;
    border-radius: var(--r-md);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    transition: transform .12s, box-shadow .2s, filter .2s;
  }
  .btn-play {
    background: linear-gradient(180deg, var(--green2), var(--green) 50%, #145228);
    color: #eafff0;
    box-shadow: var(--bevel), 0 4px 0 #0e3a1c, 0 6px 16px rgba(0,0,0,0.5);
  }
  .btn-play:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-2px); box-shadow: var(--bevel), 0 6px 0 #0e3a1c, 0 10px 22px rgba(0,0,0,0.55); }
  .btn-play:active:not(:disabled) { transform: translateY(2px); box-shadow: var(--bevel), 0 1px 0 #0e3a1c, 0 3px 8px rgba(0,0,0,0.5); }
  .btn-discard {
    background: linear-gradient(180deg, #8a4a18, #6a3a10 50%, #3a1a08);
    color: #ffe2bd;
    box-shadow: var(--bevel), 0 4px 0 #2a1404, 0 6px 16px rgba(0,0,0,0.45);
  }
  .btn-discard:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); box-shadow: var(--bevel), 0 6px 0 #2a1404, 0 10px 22px rgba(0,0,0,0.5); }
  .btn-discard:active:not(:disabled) { transform: translateY(2px); box-shadow: var(--bevel), 0 1px 0 #2a1404, 0 3px 8px rgba(0,0,0,0.45); }

  /* ============================================================
     SHOP SCREEN
  ============================================================ */
  #screen-shop { gap: 20px; min-height: 100vh; }
  .shop-header { text-align: center; }
  .shop-title { font-size: 2rem; color: var(--gold); font-weight: bold; }
  .shop-money { font-size: 1.2rem; color: var(--green2); margin-top: 4px; }
  .shop-section { width: 100%; }
  .shop-section-title {
    font-size: 0.85rem; color: var(--text2); letter-spacing: 0.1em; text-transform: uppercase;
    border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 12px;
  }
  .shop-items { display: flex; gap: 14px; flex-wrap: wrap; }

  .shop-card {
    background: linear-gradient(180deg, var(--surface), var(--surface2));
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px;
    width: 160px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    transition: transform .12s, border-color .15s, box-shadow .15s;
    position: relative;
    box-shadow: var(--panel-shadow);
  }
  .shop-card:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--panel-shadow), 0 8px 18px rgba(0,0,0,0.4); }
  .shop-card .card { pointer-events: none; }
  .shop-card .price-tag {
    background: linear-gradient(180deg, var(--gold2), var(--gold));
    color: #1a1000;
    border-radius: 6px;
    padding: 3px 14px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: var(--bevel);
  }
  .btn-buy {
    background: linear-gradient(180deg, var(--green2), var(--green));
    color: #eafff0;
    border-radius: var(--r-sm);
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: bold;
    width: 100%;
    box-shadow: var(--bevel);
    transition: filter .15s, transform .1s;
  }
  .btn-buy:hover:not(:disabled) { filter: brightness(1.1); }
  .btn-buy:active:not(:disabled) { transform: translateY(1px); }

  /* Edition-Beschriftung im Shop */
  .shop-edition-label {
    font-size: 0.78rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
  }
  .shop-edition-label.foil  { background: var(--foil-color); color: #002a3a; }
  .shop-edition-label.holo  { background: var(--holo-color); color: #3a2800; }
  .shop-edition-label.wild  { background: var(--wild-color); color: #1e003a; }
  .shop-edition-desc { font-size: 0.7rem; color: var(--text2); text-align: center; font-style: italic; }

  .relic-shop {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 14px;
    width: 200px;
    display: flex; flex-direction: column; gap: 8px;
  }
  .relic-name { color: var(--gold); font-weight: bold; font-size: 1rem; }
  .relic-desc { color: var(--text2); font-size: 0.82rem; line-height: 1.4; }

  /* Deck-Slim Section */
  .deck-cards {
    display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow-y: auto;
  }
  .deck-card-mini {
    width: 60px; height: 90px;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid #cdbf9e;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    position: relative;
  }
  .deck-card-mini:hover { border-color: var(--red); transform: scale(1.05); }
  .deck-card-mini .cv { font-size: 0.9rem; font-weight: bold; }
  .deck-card-mini .cs { font-size: 1.2rem; }
  .deck-card-mini.hearts   .cv, .deck-card-mini.hearts   .cs { color: var(--hearts); }
  .deck-card-mini.diamonds .cv, .deck-card-mini.diamonds .cs { color: var(--diamonds); }
  .deck-card-mini.spades   .cv, .deck-card-mini.spades   .cs { color: var(--spades); }
  .deck-card-mini.clubs    .cv, .deck-card-mini.clubs    .cs { color: var(--clubs); }
  .slim-price { font-size: 0.65rem; color: var(--red); position: absolute; bottom: 3px; right: 4px; }
  /* Editions-Rahmen auch bei Mini-Karten */
  .deck-card-mini.edition-foil  { border-color: var(--foil-color); box-shadow: 0 0 6px rgba(79,195,247,0.5); }
  .deck-card-mini.edition-holo  { border-color: var(--holo-color); box-shadow: 0 0 6px rgba(255,215,0,0.5); }
  .deck-card-mini.edition-wild  { border-color: var(--wild-color); box-shadow: 0 0 6px rgba(206,147,216,0.5); }

  .btn-continue {
    background: linear-gradient(135deg, var(--gold), #8a6020);
    color: #1a1000;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 12px 40px;
    border-radius: 6px;
    letter-spacing: 0.06em;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(200,168,75,0.4);
    margin-top: 10px;
  }
  .btn-continue:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(200,168,75,0.6); }

  /* ============================================================
     BOSS SCREEN (Phase 3.2)
  ============================================================ */
  #screen-boss {
    position: relative; overflow: hidden;
    justify-content: center; align-items: center; min-height: 100vh;
  }
  .boss-backdrop {
    position: absolute; inset: 0; z-index: 0;
    background: radial-gradient(ellipse at center, #2e0c0c 0%, #0a0303 70%);
    animation: boss-pulse 3s ease-in-out infinite;
  }
  @keyframes boss-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
  }
  .boss-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    max-width: 480px; width: 100%; padding: 32px 24px; text-align: center;
    border: 1px solid rgba(220,70,60,0.22);
    border-radius: var(--r-lg);
    background: rgba(40,12,12,0.35);
    box-shadow: inset 0 0 60px rgba(180,40,30,0.15);
  }
  .boss-round-info { font-size: 0.8rem; color: var(--text2); }
  .boss-eyebrow {
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.15em;
    color: #ff6b6b; text-transform: uppercase;
    animation: boss-flicker 1.8s ease-in-out infinite;
  }
  @keyframes boss-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
  }
  .boss-icon-wrap {
    width: 96px; height: 96px; border-radius: 50%;
    background: radial-gradient(circle, #5a0e0e, #2a0606);
    border: 2px solid rgba(220, 70, 60, 0.65);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 40px rgba(220, 60, 50, 0.5);
    animation: boss-glow 2s ease-in-out infinite;
  }
  @keyframes boss-glow {
    0%, 100% { box-shadow: 0 0 40px rgba(220, 60, 50, 0.5); }
    50% { box-shadow: 0 0 70px rgba(230, 70, 60, 0.9); }
  }
  .boss-icon { font-size: 3rem; }
  .boss-name {
    font-size: 2rem; font-weight: 800; color: #ff9a82;
    text-shadow: 0 0 20px rgba(220, 60, 50, 0.7);
  }
  .boss-desc {
    font-size: 1rem; color: var(--text2); line-height: 1.6;
    padding: 14px 18px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(220,70,60,0.3); border-radius: 10px;
  }
  .boss-bonus-note {
    font-size: 0.85rem; color: var(--gold); font-weight: 600;
    padding: 8px 14px; background: rgba(200,168,75,0.12);
    border: 1px solid rgba(200,168,75,0.3); border-radius: 8px;
  }
  .boss-accept-btn {
    font-size: 1.1rem; padding: 14px 32px;
    background: linear-gradient(180deg, #e0564a, var(--red) 50%, #7a1d15);
    border: none; color: #fff1ee; cursor: pointer; border-radius: var(--r-md);
    box-shadow: var(--bevel), 0 4px 0 #5a140d, 0 6px 18px rgba(0,0,0,0.5);
    transition: transform .12s, box-shadow .2s, filter .2s;
  }
  .boss-accept-btn:hover {
    filter: brightness(1.08); transform: translateY(-2px);
    box-shadow: var(--bevel), 0 6px 0 #5a140d, 0 10px 24px rgba(0,0,0,0.55);
  }
  .boss-accept-btn:active {
    transform: translateY(2px);
    box-shadow: var(--bevel), 0 1px 0 #5a140d, 0 3px 8px rgba(0,0,0,0.5);
  }
  .boss-escape-note { font-size: 0.75rem; color: #8a6a64; font-style: italic; }

  /* ============================================================
     WIN / LOSE SCREENS
  ============================================================ */
  #screen-win, #screen-lose {
    justify-content: center; min-height: 100vh; gap: 24px;
    background: radial-gradient(ellipse at center, #2e2415 0%, var(--bg3) 70%);
  }
  .end-title { font-size: 3.5rem; font-weight: bold; text-align: center; }
  .win-title { color: var(--gold); text-shadow: 0 0 40px rgba(200,168,75,0.6); }
  .lose-title { color: var(--red); text-shadow: 0 0 40px rgba(192,57,43,0.6); }
  .end-subtitle { font-size: 1.3rem; color: var(--text2); text-align: center; }
  .end-stats {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 20px 40px;
    display: flex; flex-direction: column; gap: 10px;
    min-width: 320px;
  }
  .stat-row { display: flex; justify-content: space-between; gap: 30px; }
  .stat-label { color: var(--text2); }
  .stat-value { color: var(--gold); font-weight: bold; }

  .lose-combo-stats {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 20px;
    min-width: 320px; display: flex; flex-direction: column; gap: 8px;
  }
  .lose-combo-title { font-size: 0.8rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
  .lose-combo-row { display: flex; align-items: center; gap: 10px; }
  .lose-combo-name { font-size: 0.85rem; color: var(--text1); min-width: 90px; }
  .lose-combo-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
  .lose-combo-bar { height: 100%; background: var(--red); border-radius: 3px; transition: width 0.4s ease; }
  .lose-combo-count { font-size: 0.8rem; color: var(--text2); min-width: 28px; text-align: right; }

  /* ============================================================
     LOBBY SCREEN
  ============================================================ */
  #screen-lobby {
    gap: 24px;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #2e2415 0%, var(--bg3) 70%);
    justify-content: flex-start;
    padding-top: 40px;
  }
  .lobby-title {
    font-size: 2rem;
    color: var(--gold);
    font-weight: bold;
    text-align: center;
  }
  .lobby-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
    width: 100%;
    max-width: 600px;
  }
  .lobby-section h3 {
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
  }
  .queue-buttons {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start;
  }
  .queue-mode {
    display: flex; flex-direction: column; gap: 4px; max-width: 220px;
  }
  .queue-mode-desc {
    font-size: 0.74rem; color: var(--text2); line-height: 1.3;
  }
  .btn-queue {
    background: linear-gradient(135deg, var(--green), #145228);
    color: #d0ffd0;
    font-size: 1rem;
    font-weight: bold;
    padding: 12px 28px;
    border-radius: 6px;
    letter-spacing: 0.05em;
    transition: all 0.15s;
    box-shadow: 0 3px 12px rgba(30,107,58,0.4);
  }
  .btn-queue:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--green2), var(--green));
    transform: translateY(-1px);
  }
  .queue-status {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text2);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .queue-spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
  }
  .queue-spinner.active { display: block; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Stats-Tabelle */
  .stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
  }
  .stats-grid .stat-label { font-size: 0.82rem; color: var(--text2); }
  .stats-grid .stat-value { font-size: 0.95rem; color: var(--gold); font-weight: bold; }

  /* Leaderboard */
  .leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
  }
  .leaderboard-table th {
    color: var(--text2);
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
  }
  .leaderboard-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--surface2);
    color: var(--text);
  }
  .leaderboard-table tr.me td { color: var(--gold); font-weight: bold; }
  .leaderboard-scroll {
    max-height: 300px;
    overflow-y: auto;
  }

  /* ============================================================
     MATCH-ENDE SCREEN
  ============================================================ */
  #screen-match-end {
    justify-content: center; min-height: 100vh; gap: 24px;
    background: radial-gradient(ellipse at center, #2e2415 0%, var(--bg3) 70%);
  }
  .match-end-result {
    font-size: 3.5rem;
    font-weight: bold;
    text-align: center;
  }
  .match-end-result.win   { color: var(--gold);  text-shadow: 0 0 40px rgba(200,168,75,0.6); }
  .match-end-result.loss  { color: var(--red);   text-shadow: 0 0 40px rgba(192,57,43,0.6); }
  .match-end-result.draw  { color: var(--text2); }
  .match-end-result.abort { color: var(--text2); }

  /* ============================================================
     MISC UTILITIES
  ============================================================ */
  .divider {
    width: 100%; border: none; border-top: 1px solid var(--border); margin: 4px 0;
  }
  .gold { color: var(--gold); }
  .green2 { color: var(--green2); }
  .red { color: var(--red); }
  .small { font-size: 0.82rem; color: var(--text2); }

  /* scrollbar style */
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: var(--surface); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  /* ============================================================
     P1 TUTORIAL-OVERLAY
  ============================================================ */
  #how-to-play-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(0,0,0,0.82);
    align-items: center;
    justify-content: center;
    padding: 16px;
  }
  #how-to-play-overlay.active { display: flex; }
  .htp-modal {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 28px 32px;
    max-width: 680px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
  }
  .htp-title {
    font-size: 1.7rem;
    color: var(--gold);
    font-weight: bold;
    text-align: center;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
  }
  .htp-section-title {
    font-size: 1rem;
    color: var(--gold2);
    font-weight: bold;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
    margin-bottom: 8px;
  }
  .htp-text {
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.65;
  }
  .htp-combo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
  }
  .htp-combo-table th {
    color: var(--text2);
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .htp-combo-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--surface2);
    color: var(--text);
  }
  .htp-combo-table td:first-child { color: var(--gold); font-weight: bold; }
  .htp-close-btn {
    position: absolute;
    top: 14px; right: 18px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text2);
    border-radius: 5px;
    padding: 4px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
  }
  .htp-close-btn:hover { border-color: var(--gold); color: var(--gold); }
  .htp-quickrules {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--surface2);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
  }
  .htp-footer-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.5;
    border-top: 1px solid var(--surface2);
    padding-top: 10px;
  }

  /* ============================================================
     MOBILE OPTIMIERUNGEN
  ============================================================ */
  * { -webkit-tap-highlight-color: transparent; }
  .card, button, .deck-remove-card { touch-action: manipulation; user-select: none; }

  @media (max-width: 768px) {
    #hud { gap: 8px; padding: 8px 10px; }
    .hud-value { font-size: 1.2rem; }
    .hud-label { font-size: 0.68rem; }
    .million-wrap, .progress-wrap { height: 5px; }
    #hud-best-hand { font-size: 0.68rem; }
    .res-val { font-size: 1rem; }

    .card {
      width: 62px; height: 92px;
      padding: 3px 5px;
      border-radius: 6px;
    }
    .card-suit-big { font-size: 1.4rem; }
    .card-val { font-size: 0.82rem; }
    .card-suit-small { font-size: 0.65rem; }
    #hand-area { gap: 5px; min-height: 110px; }

    .btn-action { padding: 12px 20px; font-size: 0.9rem; min-height: 44px; }
    .btn-primary, .btn-continue { min-height: 44px; }
    .btn-sort { min-height: 36px; padding: 6px 12px; }

    .shop-card { width: 130px; padding: 10px; }
    .shop-title { font-size: 1.4rem; }
    .title-logo { font-size: clamp(2.5rem, 12vw, 5rem); }

    .card.selected { transform: translateY(-14px); }
  }

  /* ============================================================
     C3-Q: KOSMETIK — CSS-Klassen-Map (id → Klasse, H-XSS-2)
     Kartenrücken, Tisch-Theme, Profilrahmen, Namensfarbe
  ============================================================ */

  /* --- Kartenrücken --- */
  .cb-back_classic  { --card-back-color: #c0392b; }
  .cb-back_midnight { --card-back-color: #1a237e; }
  .cb-back_emerald  { --card-back-color: #1b5e20; }
  .cb-back_gold     { --card-back-color: #f9a825; }
  .cb-back_neon     { --card-back-color: #00e5ff; }

  /* --- Tisch-Themes (body-Klasse) --- */
  .tt-table_green    { --bg: #0a160a; --surface: #0e1e0e; --green: #1e6b3a; }
  .tt-table_crimson  { --bg: #160a0a; --surface: #1e0e0e; --green: #6b1e2a; }
  .tt-table_obsidian { --bg: #0a0a10; --surface: #0e0e18; --green: #2a2a4a; }
  .tt-table_royal    { --bg: #100a16; --surface: #180e1e; --green: #4a1e6b; }

  /* --- Profilrahmen --- */
  .fr-frame_none    { --profile-frame: none; }
  .fr-frame_bronze  { --profile-frame: 2px solid #cd7f32; }
  .fr-frame_silver  { --profile-frame: 2px solid #c0c0c0; }
  .fr-frame_diamond { --profile-frame: 2px solid #b9f2ff; box-shadow: 0 0 8px #b9f2ff88; }

  /* --- Namensfarben (H-XSS-2: ausschließlich über Klassen, nie roher Style-String) --- */
  .nc-color_white   { color: #e8e8d8; }
  .nc-color_gold    { color: #c8a84b; }
  .nc-color_crimson { color: #c0392b; }

  /* ============================================================
     C3-Q: FREUNDE-SCREEN
  ============================================================ */
  #screen-friends {
    gap: 16px;
    min-height: 100vh;
  }
  .friends-title {
    font-size: 1.8rem;
    color: var(--gold);
    font-weight: bold;
    letter-spacing: 0.08em;
    text-align: center;
  }
  .friends-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    width: 100%;
    max-width: 640px;
  }
  .friends-tab {
    flex: 1;
    background: transparent;
    color: var(--text2);
    font-size: 0.95rem;
    padding: 10px 8px;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.04em;
  }
  .friends-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    font-weight: bold;
  }
  .friends-tab:hover:not(.active) { color: var(--text); }
  .friends-panel {
    display: none;
    width: 100%;
    max-width: 640px;
    flex-direction: column;
    gap: 10px;
  }
  .friends-panel.active { display: flex; }
  .friend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
  }
  .friend-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--surface2);
    border: var(--profile-frame, 1px solid var(--border));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
  }
  .friend-info { flex: 1; min-width: 0; }
  .friend-name {
    font-weight: bold;
    font-size: 0.95rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .friend-meta { font-size: 0.78rem; color: var(--text2); }
  .friend-online  { color: var(--green2); font-weight: bold; }
  .friend-offline { color: var(--text2); }
  .friend-actions { display: flex; gap: 6px; flex-shrink: 0; }
  .friend-actions button {
    font-size: 0.82rem;
    padding: 5px 12px;
    border-radius: 5px;
  }
  .friends-empty {
    text-align: center;
    color: var(--text2);
    font-size: 0.9rem;
    padding: 24px 0;
  }
  .friends-search-row {
    display: flex; gap: 8px; align-items: center;
  }
  .friends-search-row input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 9px 12px;
    font-family: inherit;
    font-size: 0.95rem;
  }
  .friends-search-row input::placeholder { color: var(--text2); }
  .friends-search-row input:focus {
    outline: none;
    border-color: var(--gold);
  }
  .friends-msg {
    font-size: 0.85rem;
    min-height: 1.2em;
    padding: 2px 0;
  }
  .friends-msg.ok  { color: var(--green2); }
  .friends-msg.err { color: var(--red); }

  /* ============================================================
     C3-Q: KOSMETIK-SHOP-SCREEN
  ============================================================ */
  #screen-cosmeticshop {
    gap: 16px;
    min-height: 100vh;
  }
  .cshop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 860px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .cshop-title {
    font-size: 1.8rem;
    color: var(--gold);
    font-weight: bold;
    letter-spacing: 0.08em;
  }
  .cshop-coins {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 1rem;
    color: var(--gold);
    font-weight: bold;
  }
  .cshop-tabs {
    display: flex; gap: 0;
    border-bottom: 2px solid var(--border);
    width: 100%; max-width: 860px;
  }
  .cshop-tab {
    flex: 1;
    background: transparent;
    color: var(--text2);
    font-size: 0.95rem;
    padding: 10px 8px;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.04em;
  }
  .cshop-tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: bold; }
  .cshop-tab:hover:not(.active) { color: var(--text); }
  .cshop-panel { display: none; width: 100%; max-width: 860px; flex-direction: column; gap: 16px; }
  .cshop-panel.active { display: flex; }
  .cshop-type-section { display: flex; flex-direction: column; gap: 8px; }
  .cshop-type-title {
    font-size: 0.85rem;
    color: var(--gold2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
  }
  .cshop-items { display: flex; flex-wrap: wrap; gap: 10px; }
  .cshop-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    min-width: 140px;
    max-width: 200px;
    flex: 1 1 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s;
    position: relative;
  }
  .cshop-item.owned  { border-color: var(--green2); }
  .cshop-item.equipped { border-color: var(--gold); box-shadow: 0 0 8px rgba(200,168,75,0.3); }
  /* Shop-Audit 2026-06-23: Rarity-Kennzeichnung schon in der Übersicht, nicht erst im Preview */
  .cshop-item.premium {
    border-color: var(--gold2);
    background: linear-gradient(160deg, var(--surface) 60%, rgba(200,168,75,0.08));
    position: relative;
    overflow: hidden;
  }
  .cshop-item.premium::before {
    content: '';
    position: absolute;
    top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,0.12), transparent);
    animation: cshopShimmer 3.5s ease-in-out infinite;
    pointer-events: none;
  }
  @keyframes cshopShimmer {
    0%   { left: -60%; }
    50%  { left: 130%; }
    100% { left: 130%; }
  }
  .cshop-item-name { font-weight: bold; font-size: 0.92rem; color: var(--text); }
  .cshop-item-price { font-size: 0.82rem; color: var(--gold); }
  .cshop-item-premium { font-size: 0.72rem; color: var(--gold2); font-weight: bold; }
  .cshop-item-status { font-size: 0.78rem; color: var(--green2); font-weight: bold; }
  .cshop-item-btns { display: flex; gap: 6px; flex-wrap: wrap; }
  .cshop-item-btns button { font-size: 0.8rem; padding: 5px 10px; border-radius: 4px; }
  /* Münz-Pakete */
  .cshop-pack {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .cshop-pack-name { font-weight: bold; font-size: 1rem; color: var(--gold); }
  .cshop-pack-coins { font-size: 0.9rem; color: var(--text); }
  .cshop-pack-btn { font-size: 0.9rem; padding: 8px 18px; border-radius: 6px; }

  /* Shop-Audit 2026-06-23: Erstkäufer-Angebot optisch hervorheben */
  .cshop-pack-featured {
    position: relative;
    border-color: var(--gold);
    box-shadow: 0 0 16px rgba(200,168,75,0.3), var(--bevel, none);
  }
  .cshop-pack-badge {
    position: absolute;
    top: -10px; left: 16px;
    background: linear-gradient(180deg, var(--gold2), var(--gold));
    color: #1a1000;
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 4px;
  }
  .cshop-sim-notice {
    background: var(--surface2);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--gold2);
    text-align: center;
  }

  /* ============================================================
     C3-Q: PROFIL-ANSICHT (innerhalb Freunde-Screen)
  ============================================================ */
  .profile-view {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 640px;
  }
  .profile-view-header {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .profile-view-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--surface2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
  }
  .profile-view-name { font-size: 1.3rem; font-weight: bold; }
  .profile-view-elo  { font-size: 0.9rem; color: var(--gold); }
  .profile-view-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 0.88rem; }
  .profile-view-stats .stat-label { color: var(--text2); }
  .profile-view-stats .stat-value { color: var(--gold); font-weight: bold; }

/* ================================================================
   MATCH-HINTERGRÜNDE (matchBg Kosmetik)
   ================================================================ */

/* Static */
.mb-bg_static_default { /* Standard — kein Override */ }
.mb-bg_static_forest  { background: linear-gradient(135deg, #050e06 0%, #091508 100%) !important; }
.mb-bg_static_void    { background: linear-gradient(135deg, #050512 0%, #0a0a1c 100%) !important; }
.mb-bg_static_desert  { background: linear-gradient(135deg, #0e0802 0%, #180e04 100%) !important; }

/* Animiert — Hintergrund-Gradient bewegt sich */
.mb-bg_anim_nebula {
  background: linear-gradient(135deg, #0c0030, #001030, #0c0020, #000c28) !important;
  background-size: 300% 300% !important;
  animation: mbNebula 8s ease infinite;
}
@keyframes mbNebula {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.mb-bg_anim_matrix {
  background: linear-gradient(160deg, #001200, #000800, #001a00, #000d00) !important;
  background-size: 300% 300% !important;
  animation: mbMatrix 5s ease infinite;
}
@keyframes mbMatrix {
  0%   { background-position: 0% 0%;   filter: brightness(1); }
  50%  { background-position: 100% 100%; filter: brightness(1.25); }
  100% { background-position: 0% 0%;   filter: brightness(1); }
}

.mb-bg_anim_fire {
  background: linear-gradient(180deg, #0c0000 0%, #250800 40%, #120300 100%) !important;
  background-size: 100% 300% !important;
  animation: mbFire 3s ease-in-out infinite;
}
@keyframes mbFire {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

.mb-bg_anim_aurora {
  background: linear-gradient(135deg, #000c0a, #001810, #001214, #000e0a) !important;
  background-size: 400% 400% !important;
  animation: mbAurora 10s ease infinite;
}
@keyframes mbAurora {
  0%   { background-position: 0% 50%; }
  33%  { background-position: 100% 0%; }
  66%  { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

/* ================================================================
   HAND-ANIMATIONS-EFFEKTE (handAnim Kosmetik)
   Werden als CSS-Klassen auf #hand-area gesetzt und nach der
   Animation automatisch per JS entfernt.
   ================================================================ */

@keyframes haFlash {
  0%   { filter: brightness(1); }
  25%  { filter: brightness(3) saturate(2); }
  100% { filter: brightness(1); }
}
.ha-ha_flash { animation: haFlash 0.4s ease-out; }

@keyframes haRipple {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.07); }
  65%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.ha-ha_ripple { animation: haRipple 0.5s ease-out; }

@keyframes haExplode {
  0%   { transform: scale(1);    opacity: 1; }
  40%  { transform: scale(1.18); opacity: 0.7; }
  70%  { transform: scale(0.95); opacity: 0.95; }
  100% { transform: scale(1);    opacity: 1; }
}
.ha-ha_explode { animation: haExplode 0.6s ease-out; }

@keyframes haRainbow {
  0%   { filter: hue-rotate(0deg)   saturate(1); }
  50%  { filter: hue-rotate(180deg) saturate(2); }
  100% { filter: hue-rotate(360deg) saturate(1); }
}
.ha-ha_rainbow { animation: haRainbow 0.55s linear; }

/* ================================================================
   WERBUNGS-OVERLAY + DSGVO-BANNER
   ================================================================ */
#ad-overlay.visible      { display: flex !important; }
#consent-banner.visible  { display: flex !important; }

/* Ad-Close-Button: aktiviert wenn Countdown abgelaufen */
#ad-close-btn:not(:disabled) {
  opacity: 1;
  cursor: pointer;
}
#ad-close-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ================================================================
   PHASE 2 — SETTINGS SCREEN (2.5)
   ================================================================ */

#screen-settings {
  gap: 16px;
  min-height: 100vh;
  padding-top: 32px;
}
/* ---- Settings top bar ---- */
.settings-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  padding-bottom: 8px;
  gap: 12px;
}
.settings-back-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.settings-back-btn:hover { border-color: var(--gold); color: var(--gold); }
.settings-title {
  font-size: 1.4rem;
  color: var(--gold);
  font-weight: bold;
  letter-spacing: 0.06em;
  flex: 1;
  text-align: center;
}
.settings-profile-mini {
  font-size: 0.8rem;
  color: var(--text2);
  text-align: right;
  white-space: nowrap;
  min-width: 80px;
}
.settings-profile-mini strong { color: var(--text); display: block; }

/* ---- Tab bar ---- */
.settings-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  width: 100%;
  max-width: 600px;
}
.settings-tab {
  flex: 1;
  background: transparent;
  color: var(--text2);
  font-size: 0.82rem;
  padding: 8px 4px 6px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s;
}
.settings-tab .tab-icon { font-size: 1.15rem; line-height: 1; }
.settings-tab .tab-label { font-size: 0.75rem; letter-spacing: 0.02em; }
.settings-tab.active {
  background: var(--surface);
  color: var(--gold);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.settings-tab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.04); }

/* ---- Settings body & cards ---- */
.settings-body {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.settings-panel { display: none; width: 100%; flex-direction: column; gap: 12px; padding-top: 12px; }
.settings-panel.active { display: flex; }
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-card-label {
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}
.settings-card-desc {
  font-size: 0.82rem;
  color: var(--text2);
  margin-top: -4px;
}

/* ---- Toggle group (sort / anim) ---- */
.settings-toggle-group {
  display: flex;
  gap: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
  margin-top: 4px;
}
.stg-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  border-radius: 6px;
  padding: 7px 20px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.stg-btn.active {
  background: var(--surface);
  color: var(--gold);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.stg-btn:hover:not(.active) { color: var(--text); }

/* ---- Hotkey grid ---- */
.rebind-hint-bar {
  background: rgba(200,168,75,0.12);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--gold);
  text-align: center;
}
.hk-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  align-items: center;
}
.hk-label { font-size: 0.9rem; color: var(--text2); }
.hk-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--gold);
  cursor: pointer;
  min-width: 60px;
  text-align: center;
  transition: all 0.15s;
  user-select: none;
  box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}
.hk-badge:hover { border-color: var(--gold); transform: translateY(-1px); }
.hk-badge:active { transform: translateY(0); box-shadow: none; }
.hk-badge.rebinding { border-color: var(--gold); color: var(--gold2); animation: pulse 0.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.hk-cards-row { display: flex; gap: 4px; flex-wrap: wrap; }
.hk-small { min-width: 32px; padding: 4px 6px; font-size: 0.78rem; }
.settings-reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  align-self: flex-start;
}
.settings-reset-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ---- Language selector ---- */
.settings-lang-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.settings-lang-globe { font-size: 1.2rem; }
.settings-lang-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  flex: 1;
  transition: border-color 0.15s;
}
.settings-lang-select:focus { outline: none; border-color: var(--gold); }

/* ---- Account cards ---- */
.settings-expand-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}
.settings-expand-btn:hover { border-color: var(--gold); color: var(--gold); }
.settings-expand-danger {
  border-color: rgba(231,76,60,0.4);
  color: var(--red);
}
.settings-expand-danger:hover { border-color: var(--red); background: rgba(231,76,60,0.08); }
.settings-danger-zone { border-color: rgba(231,76,60,0.3); }
.settings-danger-label {
  font-size: 0.82rem;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.settings-danger-warning {
  font-size: 0.85rem;
  color: var(--red);
  padding: 8px 0 4px;
}
/* Account sub-forms */
.settings-subform {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
}
.settings-subform input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.settings-subform input:focus { border-color: var(--gold); }
.settings-subform input::placeholder { color: var(--text2); }

/* ================================================================
   PHASE 2 — COSMETICS PREVIEW OVERLAY (2.4)
   ================================================================ */

#cosmetic-preview-overlay.visible { display: flex !important; }
.cosmetic-preview-modal {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.cp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cp-item-name {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 0.06em;
}
.cp-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}
.cp-close:hover { border-color: var(--gold); color: var(--gold); }
.cp-preview-area {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.cp-item-desc { font-size: 0.88rem; color: var(--text2); line-height: 1.5; }
.cp-price { font-size: 1rem; color: var(--gold); font-weight: bold; }
.cp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-actions button { flex: 1; min-width: 100px; }

/* ================================================================
   PHASE 3.1 — SOUL WIDGET (Meta-Progression)
   ================================================================ */

.soul-widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.soul-icon { font-size: 1.2rem; }
.soul-title {
  font-size: 0.82rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 1;
}
.soul-level-badge {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: 0.05em;
}
.soul-progress-bar-wrap {
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.soul-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.soul-progress-label {
  font-size: 0.78rem;
  color: var(--text2);
  margin-top: 4px;
  text-align: right;
}
.soul-bonus-text {
  font-size: 0.82rem;
  color: #a855f7;
  margin-top: 6px;
  font-style: italic;
}

/* ================================================================
   PHASE 3.5 — DECK-DOSSIER
   ================================================================ */
.dossier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text1);
  margin-bottom: 12px;
}
.dossier-count {
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 400;
}
.dossier-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dossier-suit-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dossier-suit-label {
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.dossier-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dossier-card {
  width: 28px;
  height: 38px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--text2);
  gap: 1px;
  position: relative;
  transition: border-color 0.15s;
}
.dossier-card.has-foil  { border-color: #60a5fa; }
.dossier-card.has-gold  { border-color: var(--gold); }
.dossier-card.has-wild  { border-color: #c084fc; }
.dossier-card.fully-discovered { background: var(--surface2); }
.dossier-card-value { font-size: 0.68rem; font-weight: 700; color: var(--text1); }
.dossier-edition-dots {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.dossier-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border);
}
.dossier-dot.foil { background: #60a5fa; }
.dossier-dot.gold { background: var(--gold); }
.dossier-dot.wild { background: #c084fc; }

/* ================================================================
   PHASE 2 — FREUNDE-WIDGET IN LOBBY (2.3)
   ================================================================ */

.lobby-friends-widget {
  background: var(--surface);
  border: 1px solid var(--green);
  border-radius: 10px;
  padding: 14px 18px;
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lfw-title {
  font-size: 0.9rem;
  color: var(--green2);
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lfw-count {
  background: var(--green);
  color: #d0ffd0;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 0.75rem;
}
.lfw-list { display: flex; gap: 8px; flex-wrap: wrap; }
.lfw-item {
  background: var(--surface2);
  border: 1px solid var(--green);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lfw-item .lfw-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green2);
  flex-shrink: 0;
}
.lfw-item .lfw-name { color: var(--text); font-weight: bold; }
.lfw-item .lfw-elo { color: var(--text2); font-size: 0.78rem; }
.lfw-item .lfw-invite {
  background: var(--green);
  color: #d0ffd0;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.lfw-item .lfw-invite:hover { background: var(--green2); }

/* ================================================================
   PHASE 2 — LAYOUT IMPROVEMENTS (2.2)
   ================================================================ */

/* Screen transitions */
.screen { transition: opacity 0.15s ease; }

/* Leaderboard alternating rows */
.leaderboard-table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}
.leaderboard-table tbody tr:hover td {
  background: rgba(200,168,75,0.06);
}

/* Screen transition opacity */
.screen.active { animation: screenFadeIn 0.15s ease; }
@keyframes screenFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Stronger selected card glow */
.card.selected {
  transform: translateY(-22px);
  border-color: rgba(var(--sel-glow, 200,168,75), 0.95);
  box-shadow: 0 0 22px rgba(var(--sel-glow, 200,168,75), 0.85), 0 8px 20px rgba(0,0,0,0.6);
}

/* CSS variable for animation speed override */
[data-anim="fast"] .card { transition: transform 0.08s, box-shadow 0.08s, border-color 0.08s; }
[data-anim="fast"] .progress-bar, [data-anim="fast"] .million-bar { transition: width 0.1s ease; }
[data-anim="off"]  .card { transition: none; }
[data-anim="off"]  .progress-bar, [data-anim="off"] .million-bar { transition: none; }
[data-anim="off"]  .screen.active { animation: none; }
[data-anim="off"]  .cshop-item.premium::before { animation: none; }

/* OS-level reduced-motion (independent of the in-game data-anim setting) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Keyboard-focus ring — visible only for keyboard nav, not mouse clicks */
:focus-visible {
  outline: 2px solid var(--gold2);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ================================================================
   PHASE 2 — DESKTOP LAYOUT (2.1) — min-width: 1024px
   ================================================================ */

@media (min-width: 1024px) {
  /* Lobby: 2-column grid */
  #screen-lobby.active {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto;
    align-items: start;
    column-gap: 24px;
    max-width: 1100px;
    padding-top: 32px;
  }
  #screen-lobby .lobby-title {
    grid-column: 1 / -1;
  }
  #screen-lobby .lobby-friends-widget {
    grid-column: 1 / -1;
    max-width: none;
  }
  /* Left column: Queue + Stats + Social + Private room + Back */
  #screen-lobby .lobby-section:nth-of-type(1),
  #screen-lobby .lobby-section:nth-of-type(2),
  #screen-lobby .lobby-section:nth-of-type(4),
  #screen-lobby #private-room-section,
  #screen-lobby > .btn-secondary:last-of-type {
    grid-column: 1;
    max-width: none;
  }
  /* Right column: Leaderboard */
  #screen-lobby .lobby-section:nth-of-type(3) {
    grid-column: 2;
    grid-row: 2 / 8;
    max-width: none;
  }
  #screen-lobby .lobby-section:nth-of-type(3) .leaderboard-scroll {
    max-height: 520px;
  }

  /* Cosmetics shop: 4-column grid at desktop */
  .cshop-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  .cshop-item { max-width: none; flex: none; }

  /* Settings screen: wider */
  #screen-settings .settings-panel { max-width: 680px; }
  #screen-settings .settings-tabs  { max-width: 680px; }

  /* Friends widget horizontal scroll on desktop when many friends */
  .lfw-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
}

/* ================================================================
   PHASE 3.4 — CUSTOM CARD SKINS
   ================================================================ */

/* Card border accent: active when any cb-* body class is set */
body[class*="cb-"] .card:not(.selected):not(.edition-foil):not(.edition-holo):not(.edition-wild) {
  border-color: var(--card-back-color, var(--border));
}

/* Custom skin designer v2 */
.skin-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.skin-editor h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gold);
  text-align: center;
}

/* Preview — centered above controls */
.skin-preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0 0;
}
.skin-preview-card-wrap {
  transform: scale(1.45);
  transform-origin: center center;
  margin: 28px 0 34px;
}
#skin-preview-card {
  pointer-events: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.skin-preview-label {
  font-size: 0.72rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Controls */
.skin-editor-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skin-ctrl-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.skin-ctrl-label {
  font-size: 0.84rem;
  color: var(--text2);
  min-width: 90px;
  flex-shrink: 0;
}
.skin-ctrl-text {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.9rem;
}
.skin-ctrl-text:focus, .skin-hex-input:focus {
  outline: none;
  border-color: var(--accent);
}
.skin-color-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.skin-color-pair input[type="color"] {
  width: 48px;
  height: 38px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}
.skin-color-pair input[type="color"]:hover {
  border-color: var(--accent);
}
.skin-hex-input {
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.88rem;
  font-family: monospace;
}
.skin-ctrl-row--pattern {
  align-items: flex-start;
  gap: 10px;
}
.skin-ctrl-row--pattern .skin-ctrl-label {
  padding-top: 6px;
}
.skin-pattern-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.skin-pat-btn {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg2);
  color: var(--text2);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.skin-pat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.skin-pat-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.skin-save-btn {
  width: 100%;
  margin-top: 2px;
}
.skin-saved-list {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.skin-saved-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.skin-saved-swatch {
  width: 36px; height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.15);
}
.skin-saved-info { flex: 1; }
.skin-saved-name { font-weight: bold; font-size: 0.9rem; }
.skin-saved-pat  { font-size: 0.78rem; color: var(--text2); text-transform: capitalize; }
.skin-saved-btns { display: flex; gap: 6px; }
.btn-danger {
  background: var(--red, #c0392b);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: bold;
}
.btn-danger:hover { filter: brightness(1.2); }

/* ================================================================
   PHASE 4.1 — SEASON SYSTEM
   ================================================================ */
#season-widget { transition: all 0.3s; }
.season-lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.season-lb-row:last-child { border-bottom: none; }
.season-lb-rank  { min-width: 26px; color: var(--text2); font-weight: bold; }
.season-lb-name  { flex: 1; font-weight: 600; }
.season-lb-badge { font-size: 0.78rem; }
.season-lb-elo   { min-width: 36px; text-align: right; color: var(--text2); }

/* ================================================================
   PHASE 4.3 — CLAN SYSTEM
   ================================================================ */
#clan-widget { transition: all 0.3s; }
.clan-lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.clan-lb-row:last-child { border-bottom: none; }
.clan-lb-rank    { min-width: 26px; color: var(--text2); font-weight: bold; }
.clan-lb-name    { flex: 1; font-weight: 600; }
.clan-lb-members { min-width: 32px; text-align: center; color: var(--text2); font-size: 0.78rem; }
.clan-lb-elo     { min-width: 60px; text-align: right; color: var(--text2); }

/* Clan recommendations (no-clan panel) */
.clan-rec-header {
  font-size: 0.75rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.clan-rec-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}
.clan-rec-row:last-child { border-bottom: none; }
.clan-rec-tag  { color: var(--accent); font-weight: 700; font-size: 0.78rem; flex-shrink: 0; }
.clan-rec-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-rec-meta { color: var(--text2); font-size: 0.76rem; flex-shrink: 0; white-space: nowrap; }

/* ================================================================
   TEAM-DUELL HUD (4.2)
   ================================================================ */
#team-hud {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  background: linear-gradient(180deg, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0) 100%);
  padding: 6px 10px 10px;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  pointer-events: none;
}
#team-hud.active { display: flex; }

.team-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.team-side:last-child { align-items: flex-end; text-align: right; }

.team-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  min-width: 64px;
}

.team-side-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin-bottom: 2px;
}

.team-player-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.team-side:last-child .team-player-row { flex-direction: row-reverse; }

.team-pname {
  font-weight: 600;
  color: var(--text);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-ally .team-pname { color: var(--green2); }

.team-pscore {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.team-total {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
  margin-top: 2px;
}

.team-round-badge {
  font-size: 0.72rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#team-timer {
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
#team-timer.urgent { color: var(--red); animation: pulse-red 0.6s ease infinite alternate; }

/* Emoji Quick Chat */
#team-emoji-bar {
  display: none;
  position: fixed;
  bottom: 70px;
  right: 10px;
  flex-direction: column;
  gap: 6px;
  z-index: 950;
}

.team-emoji-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.1s;
  pointer-events: all;
}
.team-emoji-btn:hover { background: var(--accent); transform: scale(1.15); }

#team-chat-toast {
  display: none;
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 1.1rem;
  z-index: 960;
  pointer-events: none;
  white-space: nowrap;
}

/* Team Room Overlay */
#team-room-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

#team-room-code-display {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

#team-room-status {
  color: var(--text2);
  font-size: 0.9rem;
}

/* Team queue status in lobby */
#team-queue-status {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
}

/* Team section in lobby */
#team-room-section {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Match-end team rows */
#match-team-rows {
  display: none;
}
