  @import url('/fonts/fonts.css');

  * { margin: 0; padding: 0; box-sizing: border-box; }

  :root {
    --bg: #1a1010;
    --bg2: #2a1a1a;
    --accent: #c0392b;
    --accent2: #e74c3c;
    --gold: #f39c12;
    --text: #f5e6d3;
    --text-dim: #a89080;
    --card-bg: #3a2222;
    --card-border: #5a3333;
    --success: #27ae60;
    --pile-up: #2980b9;
    --pile-down: #8e44ad;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --app-vh: 100dvh;
  }

  html, body { min-height: 100%; }

  body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: var(--app-vh);
    overflow-x: hidden;
    overscroll-behavior-y: auto;
    padding-bottom: var(--safe-b);
    -webkit-text-size-adjust: 100%;
  }

  h1, h2, h3 { font-family: 'Oswald', sans-serif; text-transform: uppercase; }

  .screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
  }
  .screen.active {
    display: flex;
    /* Feste Pixelhöhe via --app-vh (JS), kein height:100% — sonst Zirkel mit Body und Scroll bricht. */
    height: var(--app-vh);
    max-height: var(--app-vh);
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
  }

  /* ── Touch helpers ── */
  .card, .pile, .btn, .btn-action, .btn-ready, .btn-start,
  .player-count-btns button, .chat-input-row button {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
  }

  /* ── MENU SCREEN ── */
  #menu-screen {
    justify-content: flex-start;
    gap: 24px;
    padding: 34px 16px;
    background: radial-gradient(ellipse at center, #2a1515 0%, #1a1010 70%);
  }

  #menu-screen h1 {
    font-size: 3.2rem;
    color: var(--accent2);
    text-shadow: 0 0 30px rgba(231,76,60,0.5);
    letter-spacing: 6px;
  }

  .subtitle {
    font-family: 'Oswald', sans-serif;
    color: var(--gold);
    font-size: 0.95rem;
    letter-spacing: 3px;
    margin-top: -16px;
  }

  .seo-intro {
    width: 100%;
    max-width: 760px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.45;
    margin-top: -10px;
  }

  .seo-intro p + p {
    margin-top: 6px;
  }

  .seo-intro strong {
    color: var(--text);
  }

  .seo-link {
    display: inline-block;
    margin-top: 4px;
    color: var(--gold);
    text-decoration: none;
    font-size: 0.86rem;
    letter-spacing: 0.8px;
    border-bottom: 1px solid rgba(243, 156, 18, 0.28);
    padding-bottom: 1px;
  }

  .seo-link:active {
    opacity: 0.85;
  }

  @media (hover: hover) {
    .seo-link:hover {
      border-bottom-color: rgba(243, 156, 18, 0.75);
    }
  }

  .menu-box {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 400px;
  }

  .menu-box h3 {
    color: var(--gold);
    margin-bottom: 10px;
    font-size: 1rem;
    letter-spacing: 2px;
  }

  .menu-box label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 3px;
    margin-top: 8px;
  }

  .menu-box input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 16px; /* prevents iOS zoom */
  }

  .menu-box input:focus { outline: none; border-color: var(--gold); }

  .menu-box select {
    width: 100%;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 16px;
  }

  .room-visibility-help {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-dim);
  }

  .pro-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.85rem;
    cursor: pointer;
  }

  .pro-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

  .avatar-picker {
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px;
    background: rgba(26, 16, 16, 0.75);
    margin-bottom: 12px;
  }

  .avatar-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .avatar-option {
    border: 2px solid var(--card-border);
    border-radius: 8px;
    background: rgba(42, 26, 26, 0.8);
    padding: 4px;
    cursor: pointer;
    min-height: 56px;
  }

  .avatar-option.selected {
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.35);
  }

  .avatar-option img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    background: #120b0b;
  }

  .avatar-reroll {
    margin-top: 8px;
    min-height: 36px;
    font-size: 0.82rem;
    letter-spacing: 1px;
  }

  .avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: #120b0b;
    object-fit: cover;
    flex-shrink: 0;
  }

  .avatar.avatar-lobby { width: 26px; height: 26px; }
  .avatar.avatar-chip { width: 18px; height: 18px; }
  .avatar.avatar-public { width: 16px; height: 16px; }

  .btn {
    display: inline-block;
    padding: 12px 20px;
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.15s;
    text-transform: uppercase;
    width: 100%;
    margin-top: 12px;
    min-height: 44px;
  }

  .btn:active { transform: scale(0.97); }
  .btn-primary { background: linear-gradient(135deg, var(--accent), #962d22); color: #fff; }
  .btn-success { background: linear-gradient(135deg, var(--success), #1e8449); color: #fff; }
  .btn-secondary {
    background: transparent;
    color: var(--text);
    border: 2px solid var(--card-border);
  }

  .divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin: 14px 0;
    white-space: nowrap;
  }
  .divider::before, .divider::after {
    content: '';
    flex: 1;
    min-width: 24px;
    height: 1px;
    background: var(--card-border);
  }

  .error-msg {
    color: var(--accent2);
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 1.2em;
  }

  .public-rooms {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
  }

  .public-room {
    border: 1px solid var(--card-border);
    background: var(--bg);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .public-room-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .public-room-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .public-room-code {
    font-family: 'Oswald', sans-serif;
    letter-spacing: 2px;
    font-size: 1rem;
    color: var(--gold);
  }

  .public-room-mode {
    font-family: 'Oswald', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 1px;
    border-radius: 4px;
    padding: 2px 6px;
    background: rgba(231, 76, 60, 0.2);
    color: var(--accent2);
  }

  .public-room-mode.pro {
    background: rgba(243, 156, 18, 0.2);
    color: var(--gold);
  }

  .public-room-mode.dev {
    background: rgba(41, 128, 185, 0.2);
    color: #5dade2;
  }

  .public-room-meta {
    font-size: 0.76rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .public-room-host {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    vertical-align: middle;
  }

  .public-room .btn {
    width: auto;
    margin-top: 0;
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.8rem;
    letter-spacing: 1px;
  }

  .public-rooms-empty {
    border: 1px dashed var(--card-border);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
  }

  /* ── LOBBY SCREEN ── */
  #lobby-screen {
    justify-content: center;
    gap: 16px;
    padding: 30px 16px;
    background: radial-gradient(ellipse at center, #2a1515 0%, #1a1010 70%);
  }

  .room-code-display { text-align: center; }

  .room-code-display .label {
    font-family: 'Oswald', sans-serif;
    color: var(--text-dim);
    font-size: 0.85rem;
    letter-spacing: 2px;
  }

  .room-code-display .code {
    font-family: 'Oswald', sans-serif;
    font-size: 3rem;
    color: var(--gold);
    letter-spacing: 10px;
    text-shadow: 0 0 20px rgba(243,156,18,0.3);
    cursor: pointer;
  }

  .room-code-display .hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
  }

  .lobby-players {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    width: 100%;
    max-width: 380px;
  }

  .lobby-players h3 {
    font-family: 'Oswald', sans-serif;
    color: var(--gold);
    margin-bottom: 10px;
    letter-spacing: 2px;
    font-size: 0.95rem;
  }

  .lobby-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: var(--bg);
  }

  .lobby-player-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .lobby-player .name {
    font-weight: 500;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .lobby-player-controls { display: flex; align-items: center; gap: 6px; }
  .lobby-player .badges { display: flex; gap: 4px; }
  .lobby-player .badge {
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 1px;
  }
  .lobby-player .badge.host { background: var(--gold); color: #1a1010; }
  .lobby-player .badge.you { background: var(--accent); color: #fff; }
  .lobby-player .badge.offline { background: var(--text-dim); color: #1a1010; }

  .kick-btn {
    border: 1px solid var(--accent);
    color: #fff;
    background: rgba(192, 57, 43, 0.3);
    border-radius: 5px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 1px;
    padding: 4px 8px;
    min-height: 28px;
    cursor: pointer;
  }

  .kick-btn:active { transform: scale(0.97); }

  .lobby-slot {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    border: 1px dashed var(--card-border);
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
  }

  .lobby-settings {
    width: 100%;
    max-width: 380px;
    background: rgba(42, 26, 26, 0.82);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px 12px;
  }

  .lobby-settings h4 {
    font-family: 'Oswald', sans-serif;
    color: var(--gold);
    letter-spacing: 2px;
    font-size: 0.85rem;
    margin-bottom: 6px;
    text-transform: uppercase;
  }

  .lobby-settings label {
    display: block;
    font-size: 0.74rem;
    color: var(--text-dim);
    margin-top: 6px;
    margin-bottom: 3px;
  }

  .lobby-settings select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
  }

  .lobby-settings .toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--text);
  }

  .lobby-settings .toggle-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent2);
  }

  .waiting-text {
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
    animation: pulse 2s infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }

  /* ── GAME SCREEN ── */
  #game-screen {
    padding: 6px;
    min-height: var(--app-vh);
    background: radial-gradient(ellipse at top, #2a1515 0%, #1a1010 60%);
    gap: 6px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 900px;
    padding: 6px 12px;
    background: var(--bg2);
    border-radius: 8px;
    border: 1px solid var(--card-border);
    flex-shrink: 0;
  }

  .game-header .title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    color: var(--accent2);
    letter-spacing: 3px;
  }

  .game-header .info {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
  }

  .game-header .info span { color: var(--text-dim); }
  .game-header .info strong { color: var(--gold); }

  /* ── Player bar ── */
  .players-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 700px;
  }

  .player-chip {
    padding: 4px 10px;
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    font-size: 0.75rem;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
  }

  .player-chip.current { border-color: var(--gold); background: rgba(243,156,18,0.15); }
  .player-chip.you { color: var(--gold); }
  .player-chip.disconnected { opacity: 0.5; border-style: dashed; }
  .player-chip-label { white-space: nowrap; }
  .player-chip .count {
    background: var(--card-bg);
    padding: 1px 5px;
    border-radius: 8px;
    font-size: 0.7rem;
    color: var(--text-dim);
  }

  /* ── Turn banner ── */
  .turn-banner {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    text-align: center;
    flex-shrink: 0;
  }

  .turn-banner.your-turn {
    color: var(--gold);
    text-shadow: 0 0 15px rgba(243,156,18,0.3);
    animation: your-turn-pulse 1.15s ease-in-out infinite;
  }

  @keyframes your-turn-pulse {
    0%, 100% {
      transform: scale(1);
      text-shadow: 0 0 10px rgba(243,156,18,0.22);
    }
    50% {
      transform: scale(1.04);
      text-shadow: 0 0 20px rgba(243,156,18,0.48);
    }
  }

  .turn-banner.waiting { color: var(--text-dim); font-size: 1rem; }

  .min-cards-info {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-align: center;
    flex-shrink: 0;
  }

  .min-cards-info:not(:empty) {
    margin-bottom: 10px;
  }

  .min-cards-info strong { color: var(--accent2); }

  /* ── Deck Stack ── */
  .deck-zone {
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 12px;
    margin-bottom: 4px;
  }

  .deck-stack-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }

  .deck-stack {
    position: relative;
    width: 86px;
    height: 122px;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.42));
  }

  .deck-layer,
  .deck-top {
    position: absolute;
    inset: 0;
    border-radius: 11px;
    border: 2px solid #7a3b3b;
    background:
      radial-gradient(circle at 22% 16%, rgba(255, 140, 140, 0.2), transparent 42%),
      radial-gradient(circle at 78% 82%, rgba(231, 76, 60, 0.16), transparent 40%),
      linear-gradient(160deg, #340d0f 0%, #19080a 60%, #120609 100%);
    box-shadow:
      inset 0 0 0 1px rgba(231, 76, 60, 0.22),
      inset 0 0 30px rgba(255, 50, 50, 0.05);
  }

  .deck-layer {
    transform: translate(calc(var(--i) * -2px), calc(var(--i) * -1px));
    opacity: calc(0.2 + (var(--i) * 0.08));
  }

  .deck-top::before {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: 8px;
    border: 1px solid rgba(255, 69, 40, 0.6);
    box-shadow: inset 0 0 0 1px rgba(231, 76, 60, 0.2);
  }

  .deck-top::after {
    content: 'THE GAME';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-family: 'Oswald', sans-serif;
    font-size: 1.12rem;
    letter-spacing: 2px;
    color: rgba(255, 68, 41, 0.92);
    text-shadow: 0 0 12px rgba(255, 59, 41, 0.5);
  }

  .deck-remaining {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 34px;
    text-align: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(14, 8, 8, 0.95);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-family: 'Oswald', sans-serif;
    font-size: 0.92rem;
    letter-spacing: 1px;
    z-index: 5;
  }

  .deck-caption {
    font-family: 'Oswald', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: var(--text-dim);
    text-transform: uppercase;
  }

  .deck-stack.empty .deck-top::after {
    content: 'LEER';
    color: rgba(168, 144, 128, 0.88);
    text-shadow: none;
  }

  .deck-stack.empty .deck-remaining {
    border-color: var(--card-border);
    color: var(--text-dim);
  }

  /* ── Piles ── */
  .piles-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: 420px;
    flex-shrink: 0;
  }

  .pile {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
    transition: all 0.15s;
    position: relative;
  }

  .pile .pile-stack {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 250px;
    height: 107px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
    filter: none;
  }

  .pile .pile-stack-layer {
    display: none;
  }

  .pile .pile-stack-top {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    border: 2px solid #7a4545;
    background:
      radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.16), transparent 38%),
      radial-gradient(circle at 80% 88%, rgba(231, 76, 60, 0.2), transparent 42%),
      linear-gradient(160deg, #5d2f2f 0%, #3a1d1d 54%, #271212 100%);
    box-shadow:
      0 8px 14px rgba(0, 0, 0, 0.35),
      inset 0 0 0 1px rgba(255, 120, 90, 0.16);
  }

  .pile .pile-stack-top::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 7px;
    border: 1px solid rgba(255, 150, 110, 0.28);
    pointer-events: none;
  }

  .pile .pile-icon,
  .pile .pile-label,
  .pile .pile-value-row,
  .pile .pile-start {
    position: relative;
    z-index: 1;
  }

  .pile.clickable { cursor: pointer; }
  @media (hover: hover) { .pile.clickable:hover { border-color: var(--gold); } }
  .pile:active.clickable { border-color: var(--gold); }
  .pile.valid-target { border-color: var(--success); box-shadow: 0 0 12px rgba(39,174,96,0.3); }
  .pile.invalid-target { border-color: #333; opacity: 0.5; }
  .pile.has-stack.clickable,
  .pile.has-stack.clickable:hover,
  .pile.has-stack:active.clickable,
  .pile.has-stack.valid-target {
    border-color: var(--card-border);
    box-shadow: none;
  }
  @media (hover: hover) {
    .pile.has-stack.clickable:hover .pile-stack-top {
      border-color: var(--gold);
      box-shadow:
        inset 0 0 0 1px rgba(243, 156, 18, 0.38),
        0 0 16px rgba(243, 156, 18, 0.22);
    }
  }
  .pile.has-stack:active.clickable .pile-stack-top {
    border-color: var(--gold);
    box-shadow:
      inset 0 0 0 1px rgba(243, 156, 18, 0.4),
      0 0 14px rgba(243, 156, 18, 0.2);
  }
  .pile.has-stack.valid-target .pile-stack-top {
    border-color: var(--success);
    box-shadow:
      inset 0 0 0 1px rgba(39, 174, 96, 0.45),
      0 0 16px rgba(39, 174, 96, 0.28);
  }
  .pile.impact {
    box-shadow:
      0 0 0 1px rgba(243, 156, 18, 0.3),
      0 0 20px rgba(243, 156, 18, 0.25);
    transform: translateY(-1px);
  }

  .pile .pile-icon { font-size: 1rem; margin-bottom: 1px; }
  .pile.ascending .pile-icon { color: var(--pile-up); }
  .pile.descending .pile-icon { color: var(--pile-down); }

  .pile .pile-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 1px;
  }

  .pile.ascending .pile-label { color: var(--pile-up); }
  .pile.descending .pile-label { color: var(--pile-down); }

  .pile .pile-value-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
  }

  .pile .pile-transition-prefix {
    display: inline-flex;
    align-items: center;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.6px;
    color: var(--text-dim);
    line-height: 1;
    transform: none;
  }

  .pile .pile-transition-prefix .arrow {
    color: var(--gold);
    padding-left: 2px;
  }

  .pile .pile-value {
    font-family: 'Oswald', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
  }

  .pile.ascending .pile-value { color: var(--pile-up); }
  .pile.descending .pile-value { color: var(--pile-down); }

  .pile .pile-start { font-size: 0.65rem; color: var(--text-dim); }

  .pile .trick-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--gold);
    color: #1a1010;
    font-family: 'Oswald', sans-serif;
    font-size: 0.55rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
  }

  /* ── Turn log ── */
  .turn-log {
    display: none;
  }

  /* ── Actions ── */
  .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    flex-shrink: 0;
  }

  .btn-action {
    padding: 8px 16px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
    background: var(--card-bg);
    color: var(--text);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  @media (hover: hover) { .btn-action:hover { border-color: var(--gold); } }
  .btn-action:active { transform: scale(0.96); }

  .btn-action.end-turn {
    background: linear-gradient(135deg, var(--success), #1e8449);
    border-color: var(--success);
    color: #fff;
    flex: 1;
  }

  .btn-action.end-turn:disabled { opacity: 0.35; cursor: not-allowed; }
  .btn-action.undo { background: var(--bg); }
  .btn-action.abort {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent2);
    font-size: 0.8rem;
    padding: 6px 12px;
    min-height: 36px;
  }

  .btn-action.host-end {
    background: rgba(130, 30, 24, 0.26);
    border-color: #e96b5f;
    color: #ffc2ba;
    font-size: 0.8rem;
    padding: 6px 12px;
    min-height: 36px;
  }

  /* ── Hand ── */
  .hand-area {
    width: 100%;
    max-width: 700px;
    flex-shrink: 1;
    min-height: 0;
  }

  .hand-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 4px;
    letter-spacing: 1px;
    text-align: center;
  }

  .hand {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }

  .card {
    width: 62px;
    height: 90px;
    background:
      radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.16), transparent 38%),
      radial-gradient(circle at 80% 88%, rgba(231, 76, 60, 0.2), transparent 42%),
      linear-gradient(160deg, #5d2f2f 0%, #3a1d1d 54%, #271212 100%);
    border: 2px solid #7a4545;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Oswald', sans-serif;
    font-size: 1.55rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.12s;
    -webkit-user-select: none;
    user-select: none;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow:
      0 8px 14px rgba(0, 0, 0, 0.35),
      inset 0 0 0 1px rgba(255, 120, 90, 0.16);
  }

  .card::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 7px;
    border: 1px solid rgba(255, 150, 110, 0.28);
    pointer-events: none;
  }

  .card-number {
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  }

  .card-rank {
    position: absolute;
    font-family: 'Oswald', sans-serif;
    font-size: 0.62rem;
    letter-spacing: 0.6px;
    color: rgba(245, 230, 211, 0.8);
    line-height: 1;
    z-index: 1;
  }

  .card-rank-top {
    top: 6px;
    left: 7px;
  }

  .card-rank-bottom {
    right: 7px;
    bottom: 6px;
    transform: rotate(180deg);
  }

  @media (hover: hover) {
    .card:hover {
      transform: translateY(-5px);
      border-color: var(--gold);
      box-shadow: 0 6px 14px rgba(0,0,0,0.4);
    }
  }

  .card:active {
    transform: translateY(-3px);
    border-color: var(--gold);
  }

  .card.selected {
    transform: translateY(-8px);
    border-color: var(--gold);
    box-shadow: 0 0 16px rgba(243,156,18,0.4);
    background:
      radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.2), transparent 36%),
      radial-gradient(circle at 78% 88%, rgba(243, 156, 18, 0.25), transparent 40%),
      linear-gradient(160deg, #6a3730 0%, #4c2622 58%, #311714 100%);
  }

  .card.trick-ready {
    border-color: rgba(243, 156, 18, 0.82);
    box-shadow:
      0 8px 14px rgba(0, 0, 0, 0.35),
      inset 0 0 0 1px rgba(255, 120, 90, 0.16),
      0 0 0 2px rgba(243, 156, 18, 0.26);
  }

  .card.trick-ready::after {
    content: '★';
    position: absolute;
    top: 5px;
    right: 6px;
    font-size: 0.64rem;
    color: var(--gold);
    text-shadow:
      0 0 6px rgba(243, 156, 18, 0.75),
      0 1px 2px rgba(0, 0, 0, 0.75);
    z-index: 3;
    pointer-events: none;
  }

  .card.played-this-turn {
    opacity: 0.2;
    pointer-events: none;
    transform: scale(0.82);
  }

  .card.disabled { opacity: 0.45; cursor: default; }
  .card.disabled:hover, .card.disabled:active {
    transform: none;
    border-color: var(--card-border);
    box-shadow: none;
  }

  .card.draw-incoming {
    opacity: 0 !important;
    transform: translateY(8px) scale(0.92);
  }

  .card-anim-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 145;
    overflow: hidden;
  }

  .card-fly-ghost {
    position: fixed !important;
    margin: 0 !important;
    pointer-events: none !important;
    z-index: 1;
    will-change: transform, opacity;
    transform-style: preserve-3d;
    backface-visibility: hidden;
  }

  .card-fly-ghost.play {
    box-shadow:
      0 16px 24px rgba(0, 0, 0, 0.42),
      0 0 0 1px rgba(243, 156, 18, 0.24);
  }

  .card-fly-ghost.play.pile-face-ghost {
    border-radius: 10px;
    border: 2px solid #7a4545;
    background:
      radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.16), transparent 38%),
      radial-gradient(circle at 80% 88%, rgba(231, 76, 60, 0.2), transparent 42%),
      linear-gradient(160deg, #5d2f2f 0%, #3a1d1d 54%, #271212 100%);
    box-shadow:
      0 8px 14px rgba(0, 0, 0, 0.35),
      inset 0 0 0 1px rgba(255, 120, 90, 0.16);
    color: transparent !important;
    text-shadow: none !important;
  }

  .card-fly-ghost.play.pile-face-ghost::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 7px;
    border: 1px solid rgba(255, 150, 110, 0.28);
    pointer-events: none;
  }

  .card-fly-ghost.play.pile-face-ghost .card-number,
  .card-fly-ghost.play.pile-face-ghost .card-rank {
    display: none !important;
  }

  .card-fly-ghost.draw {
    background:
      radial-gradient(circle at 22% 16%, rgba(255, 140, 140, 0.2), transparent 42%),
      radial-gradient(circle at 78% 82%, rgba(231, 76, 60, 0.16), transparent 40%),
      linear-gradient(160deg, #340d0f 0%, #19080a 60%, #120609 100%);
    border-color: #7a3b3b;
    box-shadow:
      0 16px 24px rgba(0, 0, 0, 0.42),
      inset 0 0 0 1px rgba(231, 76, 60, 0.22);
  }

  .card-fly-ghost.draw::after {
    content: 'THE GAME';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-family: 'Oswald', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 1.4px;
    color: rgba(255, 68, 41, 0.92);
    text-shadow: 0 0 8px rgba(255, 59, 41, 0.5);
    z-index: 3;
  }

  /* ── Chat ── */
  .chat-area {
    width: 100%;
    max-width: 420px;
    flex-shrink: 0;
  }

  .chat-toolbar {
    display: none;
    justify-content: flex-end;
    margin-bottom: 5px;
  }

  .chat-expand-toggle {
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: rgba(42, 26, 26, 0.9);
    color: var(--text-dim);
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
    font-size: 0.68rem;
    padding: 4px 10px;
    min-height: 30px;
    cursor: pointer;
  }

  .chat-area.expanded .chat-messages {
    height: 170px;
  }

  .chat-messages {
    background: var(--bg2);
    border: 1px solid var(--card-border);
    border-radius: 8px 8px 0 0;
    padding: 6px 10px;
    height: 72px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    font-size: 0.75rem;
  }

  .chat-msg { margin-bottom: 2px; }
  .chat-msg .chat-name { color: var(--gold); font-weight: 700; }
  .chat-msg .chat-text { color: var(--text-dim); }
  .chat-msg.you .chat-text { color: var(--text); }
  .chat-msg.system { color: var(--accent2); font-style: italic; font-size: 0.7rem; }

  .chat-input-row { display: flex; }

  .chat-input-row input {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 0 0 0 8px;
    color: var(--text);
    font-size: 16px; /* prevents iOS zoom */
    min-height: 44px;
  }

  .chat-input-row input:focus { outline: none; border-color: var(--gold); }

  .chat-input-row button {
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: none;
    border-radius: 0 0 8px 0;
    color: var(--text);
    cursor: pointer;
    font-family: 'Oswald', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 1px;
    min-height: 44px;
    min-width: 60px;
  }

  .chat-hint {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 3px;
    margin-bottom: 4px;
  }

  /* ── GAME OVER ── */
  #gameover-screen {
    justify-content: center;
    gap: 20px;
    padding: 30px 16px;
    background: radial-gradient(ellipse at center, #2a1515 0%, #1a1010 70%);
    text-align: center;
  }

  #gameover-screen h1 { font-size: 2.6rem; letter-spacing: 4px; }
  #gameover-screen .result { font-size: 1.2rem; color: var(--text-dim); }
  #gameover-screen .result strong { color: var(--gold); font-size: 1.8rem; }
  .score-detail { font-size: 0.95rem; color: var(--text-dim); line-height: 1.6; }
  .gameover-actions {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }
  .gameover-actions .btn {
    margin-top: 0;
    min-width: 210px;
  }
  .win h1 { color: var(--success); text-shadow: 0 0 30px rgba(39,174,96,0.5); }
  .lose h1 { color: var(--accent2); text-shadow: 0 0 30px rgba(231,76,60,0.5); }

  /* ── Rules Modal ── */
  .rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 6, 6, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    backdrop-filter: blur(4px);
  }
  .rules-overlay.active { display: flex; }

  .rules-modal {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    width: min(96vw, 540px);
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
  }

  .rules-header h2 {
    font-size: 1.2rem;
    color: var(--gold);
    letter-spacing: 2px;
  }

  .rules-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .rules-close:active { color: var(--text); }

  .rules-body {
    padding: 14px 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text);
  }

  .rules-body h3 {
    color: var(--gold);
    font-size: 0.95rem;
    margin: 14px 0 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .rules-body h3:first-child { margin-top: 0; }
  .rules-body p { margin-bottom: 8px; color: var(--text-dim); }
  .rules-body strong { color: var(--text); }
  .rules-body .rule-example {
    background: var(--bg);
    border-left: 3px solid var(--gold);
    padding: 6px 10px;
    margin: 6px 0 10px;
    border-radius: 0 6px 6px 0;
    font-size: 0.82rem;
  }

  .rules-btn {
    position: fixed;
    left: 10px;
    bottom: calc(8px + var(--safe-b));
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg2);
    border: 1px solid var(--card-border);
    color: var(--gold);
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }

  .rules-btn:active { background: var(--card-bg); }

  /* ── Your Turn Overlay ── */
  .your-turn-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
  }

  .your-turn-overlay.show {
    animation: yourTurnOverlayFade 1.6s ease-out forwards;
  }

  .your-turn-overlay .your-turn-panel {
    position: absolute;
    width: min(88vw, 760px);
    height: clamp(96px, 20vh, 168px);
    border-radius: 18px;
    border: 2px solid rgba(243, 156, 18, 0.5);
    background:
      radial-gradient(circle at 50% 50%, rgba(243, 156, 18, 0.2), rgba(20, 10, 10, 0.9) 72%),
      linear-gradient(165deg, rgba(48, 20, 20, 0.86), rgba(22, 10, 10, 0.86));
    box-shadow:
      0 16px 32px rgba(0, 0, 0, 0.46),
      inset 0 0 0 1px rgba(243, 156, 18, 0.22),
      0 0 32px rgba(243, 156, 18, 0.24);
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }

  .your-turn-overlay.show .your-turn-panel {
    animation: yourTurnPanelFade 1.6s ease-out forwards;
  }

  .your-turn-overlay .your-turn-text {
    position: relative;
    z-index: 2;
    font-family: 'Oswald', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow:
      0 0 26px rgba(243,156,18,0.52),
      0 0 52px rgba(243,156,18,0.2),
      0 4px 12px rgba(0,0,0,0.5);
    letter-spacing: 6px;
    text-transform: uppercase;
    text-align: center;
    opacity: 0;
    transform: scale(0.94) translateY(8px);
    padding: 0 14px;
  }

  .your-turn-overlay.show .your-turn-text {
    animation: yourTurnTextFade 1.6s ease-out forwards;
  }

  @keyframes yourTurnOverlayFade {
    0% { opacity: 0; background: rgba(16, 8, 8, 0); }
    16% { opacity: 1; background: rgba(16, 8, 8, 0.24); }
    70% { opacity: 1; background: rgba(16, 8, 8, 0.18); }
    100% { opacity: 0; background: rgba(16, 8, 8, 0); }
  }

  @keyframes yourTurnPanelFade {
    0% {
      opacity: 0;
      transform: scale(0.92) translateY(10px);
    }
    14% {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
    72% {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
    100% {
      opacity: 0;
      transform: scale(0.98) translateY(2px);
    }
  }

  @keyframes yourTurnTextFade {
    0% {
      opacity: 0;
      transform: scale(0.94) translateY(8px);
    }
    16% {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
    70% {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
    100% {
      opacity: 0;
      transform: scale(1.02) translateY(-2px);
    }
  }

  @media (max-width: 400px) {
    .your-turn-overlay .your-turn-text { font-size: 2.2rem; letter-spacing: 4px; }
    .your-turn-overlay .your-turn-panel {
      width: min(92vw, 460px);
      height: clamp(86px, 18vh, 130px);
      border-radius: 14px;
    }
  }

  /* ── Surrender Vote Overlay ── */
  .surrender-overlay {
    position: fixed;
    inset: 0;
    z-index: 155;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(16, 8, 8, 0.58);
    backdrop-filter: blur(3px);
  }

  .surrender-overlay.active { display: flex; }

  .surrender-card {
    width: min(94vw, 560px);
    border-radius: 14px;
    border: 2px solid rgba(243, 156, 18, 0.58);
    background:
      radial-gradient(circle at 50% 0%, rgba(243, 156, 18, 0.24), rgba(18, 10, 10, 0.92) 66%),
      linear-gradient(160deg, rgba(53, 22, 22, 0.92), rgba(24, 12, 12, 0.92));
    box-shadow:
      0 14px 28px rgba(0, 0, 0, 0.44),
      inset 0 0 0 1px rgba(243, 156, 18, 0.2);
    padding: 16px 14px 14px;
    text-align: center;
  }

  .surrender-title {
    color: var(--gold);
    font-family: 'Oswald', sans-serif;
    font-size: 1.45rem;
    letter-spacing: 2px;
    text-transform: uppercase;
  }

  .surrender-sub {
    margin-top: 5px;
    font-size: 0.9rem;
    color: var(--text);
  }

  .surrender-timer {
    margin-top: 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    color: #ffb347;
    letter-spacing: 1px;
  }

  .surrender-meta {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.4;
  }

  .surrender-votes {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .surrender-vote-chip {
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 3px 9px;
    background: rgba(26, 14, 14, 0.82);
    font-size: 0.76rem;
    color: var(--text);
  }

  .surrender-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .surrender-btn {
    min-height: 40px;
    min-width: 120px;
    padding: 8px 12px;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    cursor: pointer;
    color: #fff;
    background: var(--bg2);
  }

  .surrender-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  .surrender-btn.yes {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(39,174,96,0.9), rgba(25,115,66,0.9));
  }

  .surrender-btn.restart {
    border-color: var(--gold);
    color: #1b0f0f;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
  }

  .surrender-btn.no {
    border-color: var(--accent2);
    background: linear-gradient(135deg, rgba(231,76,60,0.9), rgba(148,49,39,0.9));
  }

  .surrender-note {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-dim);
  }

  @media (max-width: 520px) {
    .surrender-card { padding: 14px 10px 12px; }
    .surrender-title { font-size: 1.2rem; }
    .surrender-sub { font-size: 0.84rem; }
    .surrender-btn { min-width: 100px; font-size: 0.86rem; }
  }

  /* ── Confetti Canvas ── */
  #confetti-canvas {
    position: fixed;
    inset: 0;
    z-index: 180;
    pointer-events: none;
  }

  /* ── Stats Modal ── */
  .stats-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 6, 6, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    backdrop-filter: blur(4px);
  }
  .stats-overlay.active { display: flex; }

  .stats-modal {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    width: min(96vw, 480px);
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
  }

  .stats-header h2 {
    font-size: 1.1rem;
    color: var(--gold);
    letter-spacing: 2px;
  }

  .stats-body {
    padding: 14px 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .stats-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(90,51,51,0.3);
    font-size: 0.88rem;
  }

  .stats-row .stats-label { color: var(--text-dim); }
  .stats-row .stats-value { color: var(--gold); font-family: 'Oswald', sans-serif; letter-spacing: 1px; }

  .stats-best-title {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: 14px;
    margin-bottom: 6px;
    letter-spacing: 1px;
  }

  .stats-leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 0.82rem;
  }

  .stats-leaderboard-entry .rank { color: var(--gold); font-weight: 700; min-width: 24px; }
  .stats-leaderboard-entry .name { color: var(--text); flex: 1; margin: 0 8px; }
  .stats-leaderboard-entry .score { color: var(--text-dim); font-family: 'Oswald', sans-serif; }

  .stats-global-title {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: 14px;
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .stats-global-box {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 8px;
  }

  .stats-global-state {
    font-size: 0.82rem;
    color: var(--text-dim);
    text-align: center;
    padding: 6px 0;
  }

  /* ── Profile Modal (Stern-Button) ── */
  .profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 6, 6, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    backdrop-filter: blur(4px);
  }
  .profile-overlay.active { display: flex; }
  .profile-modal {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    width: min(96vw, 480px);
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
  }
  .profile-header h2 {
    font-size: 1.1rem;
    color: var(--gold);
    letter-spacing: 2px;
  }
  .profile-body {
    padding: 14px 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .profile-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
  }
  .profile-user-row .avatar { width: 48px; height: 48px; border-radius: 8px; }
  .profile-user-row .name {
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    color: var(--gold);
    letter-spacing: 1px;
  }
  .profile-section-title {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin: 10px 0 8px;
    letter-spacing: 1px;
  }
  .profile-section-title:first-of-type { margin-top: 0; }
  .profile-open-auth {
    width: 100%;
    padding: 10px;
    margin-bottom: 14px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--gold);
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
    cursor: pointer;
  }
  .profile-open-auth:hover { border-color: var(--gold); }
  .profile-edit label {
    display: block;
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-bottom: 4px;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
  }
  .profile-edit input[type="text"],
  .profile-password-section input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 6px;
    box-sizing: border-box;
  }
  .profile-password-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .profile-password-section .profile-pw-hint {
    font-size: 0.74rem;
    color: var(--text-dim);
    line-height: 1.4;
    margin-bottom: 10px;
  }
  .profile-name-msg {
    font-size: 0.72rem;
    min-height: 1.2em;
    margin-bottom: 8px;
    color: var(--gold);
  }
  .profile-name-msg.err { color: var(--pile-down); }
  .profile-edit .avatar-options { margin-bottom: 8px; }
  .profile-edit .avatar-reroll {
    margin-bottom: 12px;
    width: 100%;
  }
  .profile-global-details {
    margin-top: 18px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--bg);
  }
  .profile-global-details summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Oswald', sans-serif;
    font-size: 0.88rem;
    color: var(--gold);
    letter-spacing: 1px;
    list-style: none;
  }
  .profile-global-details summary::-webkit-details-marker { display: none; }
  .profile-global-details summary::after {
    content: '▾';
    color: var(--text-dim);
    font-size: 0.82rem;
    transition: transform 0.15s ease;
  }
  .profile-global-details[open] summary::after {
    transform: rotate(180deg);
  }
  .profile-global-details[open] summary { margin-bottom: 8px; }
  .profile-global-details .stats-global-box {
    border: none;
    padding: 0;
  }

  .profile-admin-open {
    width: 100%;
    margin-top: 12px;
  }

  .admin-overlay {
    position: fixed;
    inset: 0;
    z-index: 220;
    background: rgba(8, 5, 5, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    backdrop-filter: blur(4px);
  }
  .admin-overlay.active { display: flex; }
  .admin-modal {
    width: min(98vw, 980px);
    max-height: 88dvh;
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--card-border);
  }
  .admin-header h2 {
    font-size: 1.06rem;
    letter-spacing: 1px;
    color: var(--gold);
  }
  .admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(0,0,0,0.12);
  }
  .admin-tab {
    border: 1px solid var(--card-border);
    background: var(--bg);
    color: var(--text);
    border-radius: 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.8px;
    padding: 7px 10px;
    cursor: pointer;
  }
  .admin-tab.active {
    border-color: var(--gold);
    color: var(--gold);
  }
  .admin-body {
    overflow-y: auto;
    padding: 12px;
  }
  .admin-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .admin-toolbar input {
    flex: 1 1 200px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg);
    color: #fff;
  }
  .admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
  }
  .admin-table th,
  .admin-table td {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 8px 6px;
    text-align: left;
    vertical-align: top;
  }
  .admin-table th {
    color: var(--text-dim);
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.8px;
    font-size: 0.76rem;
  }
  .admin-meta {
    color: var(--text-dim);
    font-size: 0.78rem;
    margin-bottom: 8px;
  }
  .admin-actions-inline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 10rem;
    max-width: 14rem;
  }
  .admin-actions-inline .btn {
    width: 100%;
    text-align: center;
  }
  .admin-state {
    font-size: 0.82rem;
    color: var(--text-dim);
    padding: 10px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg);
  }
  .admin-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text);
    font-size: 0.82rem;
  }

  .stats-btn {
    position: fixed;
    left: 50px;
    bottom: calc(8px + var(--safe-b));
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg2);
    border: 1px solid var(--card-border);
    color: var(--gold);
    font-size: 1rem;
    cursor: pointer;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }

  .stats-btn:active { background: var(--card-bg); }

  /* ── Auth UI ── */
  .auth-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 0.78rem;
    color: var(--text-dim);
    opacity: 0.7;
    transition: opacity 0.2s;
  }
  .auth-bar:hover, .auth-bar.logged-in { opacity: 1; }
  .auth-bar .auth-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gold);
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
  }
  #auth-bar-user {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .auth-bar .auth-user .registered-icon {
    font-size: 0.7rem;
    opacity: 0.7;
  }
  .auth-bar .btn-auth {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-dim);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .auth-bar .btn-auth:hover { border-color: var(--gold); color: var(--gold); }
  .auth-bar .btn-auth.logout { border-color: var(--pile-down); color: var(--pile-down); }
  .auth-bar .btn-auth.logout:hover { background: rgba(231, 76, 60, 0.12); }

  .auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(10, 6, 6, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    backdrop-filter: blur(4px);
  }
  .auth-overlay.active { display: flex; }

  .auth-modal {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    width: min(96vw, 400px);
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .auth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--card-border);
  }
  .auth-header h2 {
    font-size: 1.1rem;
    color: var(--gold);
    letter-spacing: 2px;
  }
  .auth-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 2px 6px;
  }
  .auth-close:hover { color: #fff; }

  .auth-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
  }
  .auth-body label {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
  }
  .auth-body input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: #fff;
    font-size: 0.95rem;
    outline: none;
  }
  .auth-body input:focus { border-color: var(--gold); }
  .auth-body .auth-error {
    color: var(--pile-down);
    font-size: 0.78rem;
    min-height: 1.2em;
  }
  .auth-body .auth-hint {
    color: var(--text-dim);
    font-size: 0.72rem;
    text-align: center;
  }
  .auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--card-border);
  }
  .auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    color: var(--text-dim);
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 1px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
  }
  .auth-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
  }
  .auth-tab:hover { color: var(--accent); }
  .auth-submit {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
  }
  .auth-submit:hover { background: var(--accent2); }
  .auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }
  .auth-name-lock {
    display: none;
    font-size: 0.72rem;
    color: var(--gold);
    opacity: 0.8;
    margin-top: -4px;
  }
  .auth-name-lock.visible { display: block; }

  .menu-name-auth-row { margin-bottom: 6px; }
  .menu-name-split {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: flex-end;
  }
  .menu-name-split .menu-name-col {
    flex: 1 1 160px;
    min-width: 0;
  }
  .menu-name-split label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
  }
  .menu-name-split input[readonly] {
    opacity: 0.92;
    cursor: default;
    background: rgba(0,0,0,0.2);
  }
  .menu-alias-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 6px;
    line-height: 1.35;
    opacity: 0.9;
  }

  /* Alias: Marquee für abgeschnittenen Placeholder/Wert bis Fokus */
  .input-marquee-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
  }
  .input-marquee-wrap > input[type="text"] {
    width: 100%;
  }
  .input-marquee-layer {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    color: var(--text-dim);
    visibility: hidden;
  }
  .input-marquee-wrap.marquee-on:not(:focus-within) .input-marquee-layer {
    visibility: visible;
  }
  .input-marquee-wrap.marquee-on:not(:focus-within) > input[type="text"] {
    color: transparent;
    caret-color: var(--text);
  }
  .input-marquee-wrap.marquee-on:not(:focus-within) > input[type="text"]::placeholder {
    color: transparent;
  }
  .input-marquee-inner {
    display: inline-flex;
    white-space: nowrap;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  .input-marquee-wrap.marquee-on:not(:focus-within) .input-marquee-inner {
    animation: input-marquee-scroll linear infinite;
    animation-duration: var(--marquee-duration, 12s);
  }
  .input-marquee-text:first-child {
    padding-right: 2em;
  }
  @keyframes input-marquee-scroll {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(var(--marquee-shift, -50%), 0, 0); }
  }
  @media (prefers-reduced-motion: reduce) {
    .input-marquee-wrap.marquee-on:not(:focus-within) .input-marquee-inner {
      animation: none !important;
      transform: translate3d(0, 0, 0) !important;
    }
  }

  .registered-badge {
    display: inline-block;
    font-size: 0.6rem;
    color: var(--gold);
    opacity: 0.7;
    margin-left: 3px;
    vertical-align: super;
  }

  .mobile-aux-row {
    display: none;
    width: 100%;
    max-width: 700px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    margin-bottom: 2px;
    padding: 0 4px;
  }

  .mobile-aux-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-aux-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg2);
    border: 1px solid var(--card-border);
    color: var(--gold);
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    cursor: pointer;
    flex-shrink: 0;
  }

  .mobile-aux-version {
    margin-left: auto;
    font-family: 'Oswald', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 1px;
    color: var(--text-dim);
    text-shadow: 0 1px 2px rgba(0,0,0,0.55);
  }

  /* ── Changelog Modal (Desktop) ── */
  .changelog-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(10, 6, 6, 0.86);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;
    backdrop-filter: blur(4px);
  }
  .changelog-overlay.active { display: flex; }

  .changelog-modal {
    background: var(--bg2);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    width: min(90vw, 680px);
    max-height: 86dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
  }

  .changelog-header h2 {
    font-size: 1.05rem;
    color: var(--gold);
    letter-spacing: 2px;
  }

  .changelog-body {
    padding: 14px 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .changelog-version {
    font-family: 'Oswald', sans-serif;
    color: var(--accent2);
    letter-spacing: 1px;
    margin-bottom: 4px;
  }

  .changelog-date {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-bottom: 10px;
  }

  .changelog-section-title {
    font-family: 'Oswald', sans-serif;
    color: var(--gold);
    font-size: 0.86rem;
    letter-spacing: 1px;
    margin: 10px 0 6px;
    text-transform: uppercase;
  }

  .changelog-list {
    margin: 0;
    padding-left: 16px;
    color: var(--text);
  }

  .changelog-list li {
    margin-bottom: 5px;
    color: var(--text-dim);
  }

  .changelog-open-hint {
    color: var(--text-dim);
    font-size: 0.74rem;
    letter-spacing: 0.5px;
  }

  /* ── In-App Confirm Modal ── */
  .inline-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 215;
    background: rgba(10, 6, 6, 0.86);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;
    backdrop-filter: blur(4px);
  }
  .inline-confirm-overlay.active { display: flex; }

  .inline-confirm-modal {
    width: min(92vw, 540px);
    border-radius: 14px;
    border: 2px solid var(--card-border);
    background:
      linear-gradient(160deg, rgba(47, 20, 20, 0.94), rgba(23, 12, 12, 0.94)),
      radial-gradient(circle at 50% 0%, rgba(243, 156, 18, 0.12), rgba(14, 8, 8, 0.85) 70%);
    box-shadow:
      0 14px 30px rgba(0, 0, 0, 0.45),
      inset 0 0 0 1px rgba(243, 156, 18, 0.12);
    padding: 16px 14px 14px;
  }

  .inline-confirm-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 8px;
  }

  .inline-confirm-message {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .inline-confirm-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
  }

  .inline-confirm-btn {
    min-height: 40px;
    min-width: 110px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--bg2);
    color: #fff;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
    cursor: pointer;
  }

  .inline-confirm-btn.cancel {
    border-color: var(--card-border);
    color: var(--text);
    background: rgba(24, 12, 12, 0.9);
  }

  .inline-confirm-btn.ok {
    border-color: var(--gold);
    color: #1b1010;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
  }

  .inline-confirm-btn.ok.danger {
    border-color: var(--accent2);
    color: #fff;
    background: linear-gradient(135deg, #e74c3c, #8c2d23);
  }

  @media (max-width: 520px) {
    .inline-confirm-modal { padding: 14px 10px 12px; }
    .inline-confirm-title { font-size: 1.02rem; }
    .inline-confirm-message { font-size: 0.9rem; }
    .inline-confirm-actions { justify-content: center; }
  }

  /* ── Dev Panel ── */
  .dev-panel {
    background: var(--bg2);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 14px;
    width: 100%;
    max-width: 380px;
    display: none;
  }

  .dev-panel.active { display: block; }

  .dev-panel h4 {
    font-family: 'Oswald', sans-serif;
    color: var(--gold);
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .dev-panel h4::before {
    content: '{ }';
    font-size: 0.75rem;
    background: var(--gold);
    color: #1a1010;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
  }

  .dev-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .dev-btn {
    padding: 8px 6px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    min-height: 40px;
    transition: all 0.12s;
    text-align: center;
  }

  .dev-btn:active { background: var(--card-bg); border-color: var(--gold); }
  @media (hover: hover) { .dev-btn:hover { border-color: var(--gold); } }

  /* ── Toast ── */
  .toast {
    position: fixed;
    bottom: calc(16px + var(--safe-b));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition:
      transform 0.3s ease,
      opacity 0.2s ease,
      visibility 0s linear 0.3s;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
  }

  .toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    transition:
      transform 0.3s ease,
      opacity 0.2s ease;
  }

  @media (max-width: 900px) {
    .toast {
      top: calc(8px + var(--safe-t));
      bottom: auto;
      transform: translateX(-50%) translateY(-120%);
      padding: 8px 12px;
      font-size: 0.78rem;
      max-width: min(92vw, 420px);
      letter-spacing: 0.8px;
      z-index: 140;
    }
  }

  /* ── Connection status ── */
  .conn-status {
    position: fixed;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    z-index: 50;
  }

  .conn-status.disconnected { background: var(--accent2); animation: pulse 1s infinite; }
  .conn-status.reconnecting { background: var(--gold); animation: pulse 1s infinite; }

  @media (max-width: 900px) {
    body.is-game-screen .conn-status:not(.disconnected):not(.reconnecting) {
      display: none;
    }
  }

  .reconnect-banner {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 16, 16, 0.95);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.78rem;
    color: var(--text);
    z-index: 70;
    display: none;
    max-width: min(92vw, 520px);
    text-align: center;
    line-height: 1.35;
  }
  .reconnect-banner strong { color: var(--gold); }

  .app-version {
    position: fixed;
    right: 10px;
    bottom: calc(8px + var(--safe-b));
    font-family: 'Oswald', sans-serif;
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    opacity: 0.85;
    z-index: 60;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.55);
  }

  .app-version.clickable {
    pointer-events: auto;
    cursor: pointer;
    color: var(--gold);
    opacity: 0.95;
  }

  .site-powered {
    width: 100%;
    margin-top: auto;
    padding-top: 16px;
    padding-bottom: calc(10px + var(--safe-b));
    text-align: center;
    font-family: 'Oswald', sans-serif;
    font-size: 0.66rem;
    letter-spacing: 1.1px;
    color: #8e7a6d;
    opacity: 0.9;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,0.55);
  }

  .v2-crosslink {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    padding: 0 12px;
  }

  .v2-crosslink-btn {
    min-width: 220px;
    letter-spacing: 1.5px;
  }

  .v2-crosslink-note {
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #8e7a6d;
    opacity: 0.85;
    text-align: center;
  }

  /* ── Aether Piles Beta Crosslink (Bild + CTA-Button) ───────── */
  .v2-crosslink-card {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: 28px auto 0;
    padding: 0;
    border: 1px solid rgba(186, 124, 79, 0.55);
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(180deg, #1a0f0a 0%, #0e0705 100%);
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.55),
      0 0 0 1px rgba(243, 200, 140, 0.08),
      inset 0 1px 0 rgba(255, 220, 170, 0.06);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .v2-crosslink-card:hover,
  .v2-crosslink-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(243, 200, 140, 0.85);
    box-shadow:
      0 16px 40px rgba(0, 0, 0, 0.65),
      0 0 24px rgba(243, 200, 140, 0.22),
      inset 0 1px 0 rgba(255, 220, 170, 0.12);
    outline: none;
  }

  .v2-crosslink-card:active {
    transform: translateY(0);
  }

  .v2-crosslink-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    background: #0c0614;
  }

  .v2-crosslink-cta {
    display: block;
    width: 100%;
    padding: 16px 14px;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    color: #fff3df;
    background: linear-gradient(
      135deg,
      rgba(243, 156, 18, 0.25) 0%,
      rgba(186, 124, 79, 0.35) 50%,
      rgba(243, 156, 18, 0.25) 100%
    );
    border-top: 1px solid rgba(243, 200, 140, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    transition: background 0.25s ease, letter-spacing 0.25s ease;
  }

  .v2-crosslink-card:hover .v2-crosslink-cta,
  .v2-crosslink-card:focus-visible .v2-crosslink-cta {
    background: linear-gradient(
      135deg,
      rgba(243, 156, 18, 0.45) 0%,
      rgba(255, 200, 140, 0.55) 50%,
      rgba(243, 156, 18, 0.45) 100%
    );
    letter-spacing: 2.4px;
  }

  @media (hover: hover) {
    .app-version.clickable:hover {
      text-shadow:
        0 0 8px rgba(243, 156, 18, 0.5),
        0 1px 2px rgba(0, 0, 0, 0.55);
    }
  }

  .loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
      radial-gradient(circle at 50% 30%, rgba(231, 76, 60, 0.16) 0%, rgba(26, 16, 16, 0.96) 54%),
      linear-gradient(180deg, #120b0b 0%, #1a1010 100%);
    backdrop-filter: blur(3px);
  }

  .loading-overlay.active { display: flex; }

  .loading-card {
    width: min(92vw, 560px);
    border: 1px solid rgba(90, 51, 51, 0.9);
    border-radius: 14px;
    background: rgba(32, 18, 18, 0.9);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
    padding: 20px 18px;
  }

  .loading-title {
    font-family: 'Oswald', sans-serif;
    letter-spacing: 4px;
    color: var(--accent2);
    text-align: center;
    font-size: 2rem;
    margin-bottom: 4px;
    text-transform: uppercase;
  }

  .loading-text {
    font-size: 0.9rem;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 14px;
    min-height: 1.2em;
  }

  .loading-bar-track {
    width: 100%;
    height: 20px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.56);
    box-shadow:
      inset 0 2px 6px rgba(0,0,0,0.6),
      0 2px 8px rgba(0,0,0,0.5);
    overflow: hidden;
  }

  .loading-bar-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 46%, var(--gold) 100%);
    box-shadow: 0 0 14px rgba(231, 76, 60, 0.45);
    transition: width 0.08s linear;
  }

  .loading-percent {
    margin-top: 9px;
    text-align: right;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 1px;
    color: var(--gold);
    font-size: 1rem;
  }

  /* ── Mobile small screens ── */
  @media (max-width: 400px) {
    #menu-screen h1 { font-size: 2.4rem; letter-spacing: 4px; }
    .subtitle { font-size: 0.8rem; }
    .seo-intro { font-size: 0.8rem; line-height: 1.38; }
    .card { width: 52px; height: 74px; font-size: 1.2rem; border-radius: 8px; }
    .card-rank { font-size: 0.54rem; }
    .deck-stack { width: 72px; height: 102px; }
    .deck-zone { margin-top: 10px; margin-bottom: 2px; }
    .deck-remaining { top: 5px; min-width: 30px; font-size: 0.82rem; }
    .hand { gap: 4px; }
    .pile .pile-value { font-size: 1.8rem; }
    .pile { padding: 8px 6px; border-radius: 8px; }
    .pile .pile-stack {
      width: auto; height: auto; left: 0; top: 0;
      transform: none; inset: -1px;
    }
    .pile .pile-stack-top { border-radius: 8px; }
    .pile .pile-stack-top::before { inset: 3px; border-radius: 6px; }
    .piles-area { gap: 6px; }
    .turn-banner { font-size: 1rem; }
    .turn-banner.waiting { font-size: 0.85rem; }
    .room-code-display .code { font-size: 2.2rem; letter-spacing: 6px; }
    .player-chip { font-size: 0.7rem; padding: 3px 8px; }
    .game-header .title { font-size: 0.95rem; }
    .game-header .info { gap: 8px; font-size: 0.7rem; }
    .btn-action { font-size: 0.85rem; padding: 6px 12px; }
    .loading-card { padding: 16px 12px; }
    .loading-title { font-size: 1.5rem; letter-spacing: 3px; }
    .loading-text { font-size: 0.82rem; }
    .loading-bar-track { height: 18px; }
    .loading-percent { font-size: 0.9rem; }
    .gameover-actions .btn { min-width: 100%; }
  }

  @media (max-width: 900px) {
    .screen.active {
      overscroll-behavior-y: contain;
    }
    #game-screen {
      gap: 4px;
      padding: 4px 4px calc(8px + var(--safe-b));
    }
    .game-header { padding: 5px 10px; }
    .players-bar { max-width: 100%; margin-top: 1px; }
    .turn-banner { font-size: 1.02rem; line-height: 1.1; }
    .min-cards-info { font-size: 0.76rem; }
    .min-cards-info:not(:empty) { margin-bottom: 12px; }
    .deck-zone { margin-top: 10px; margin-bottom: 0; }
    .deck-stack { width: 78px; height: 112px; }
    .deck-top::after { font-size: 0.98rem; letter-spacing: 1.8px; }
    .deck-remaining { top: 4px; min-width: 30px; font-size: 0.82rem; padding: 1px 8px; }
    .deck-caption { font-size: 0.68rem; }
    .piles-area { gap: 5px; }
    .pile { padding: 7px 6px; }
    .pile .pile-stack {
      width: auto; height: auto; left: 0; top: 0;
      transform: none; inset: -1px;
    }
    .pile .pile-stack-top { border-radius: 8px; }
    .pile .pile-stack-top::before { inset: 3px; border-radius: 6px; }
    .actions { margin-top: 0; }
    .btn-action { min-height: 40px; padding: 7px 12px; }
    .hand-area { margin-top: 6px; }
    .hand { gap: 5px; }
    .hand-label { margin-bottom: 5px; }
    .chat-area { margin-top: 2px; }
    .chat-toolbar { display: flex; }
    .chat-expand-toggle {
      min-height: 28px;
      font-size: 0.66rem;
      padding: 3px 9px;
    }
    .chat-messages { height: 64px; }
    body.is-game-screen #game-screen .chat-area.expanded .chat-messages { height: 156px; }
    .chat-input-row input, .chat-input-row button { min-height: 40px; }
    .chat-hint { margin-bottom: 2px; }
    .mobile-aux-row { margin-top: 6px; margin-bottom: 2px; }

    body.is-game-screen .rules-btn,
    body.is-game-screen .stats-btn,
    body.is-game-screen .app-version {
      display: none;
    }

    body.is-game-screen .mobile-aux-row {
      display: flex;
    }
  }

  @media (max-width: 900px) and (max-height: 820px) {
    body.is-game-screen #game-screen {
      gap: 2px;
      padding: 3px 3px calc(8px + var(--safe-b));
      /* Immer vertikal scrollen (PC-Fenster halbieren o. ä.); vorher overflow:hidden blockierte das komplett. */
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    body.is-game-screen.chat-expanded #game-screen {
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    body.is-game-screen #game-screen .game-header {
      padding: 3px 8px;
      border-radius: 7px;
    }

    body.is-game-screen #game-screen .game-header .title {
      font-size: 0.88rem;
      letter-spacing: 2px;
    }

    body.is-game-screen #game-screen .game-header .info {
      gap: 7px;
      font-size: 0.66rem;
    }

    body.is-game-screen #game-screen .players-bar {
      max-width: 100%;
      flex-wrap: nowrap;
      justify-content: flex-start;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding: 0 2px;
      gap: 4px;
    }

    body.is-game-screen #game-screen .player-chip {
      min-height: 26px;
      padding: 2px 7px;
      font-size: 0.64rem;
      gap: 4px;
      flex-shrink: 0;
    }

    body.is-game-screen #game-screen .turn-banner {
      font-size: 0.86rem;
      line-height: 1;
    }

    body.is-game-screen #game-screen .min-cards-info {
      font-size: 0.64rem;
      line-height: 1;
    }

    body.is-game-screen #game-screen .min-cards-info:not(:empty) {
      margin-bottom: 10px;
    }

    body.is-game-screen #game-screen .deck-zone {
      margin-top: 10px;
      margin-bottom: 0;
    }

    body.is-game-screen #game-screen .deck-stack {
      width: 60px;
      height: 86px;
    }

    body.is-game-screen #game-screen .deck-remaining {
      top: 3px;
      min-width: 24px;
      font-size: 0.72rem;
      padding: 0 6px;
    }

    body.is-game-screen #game-screen .deck-top::after {
      font-size: 0.78rem;
      letter-spacing: 1.2px;
    }

    body.is-game-screen #game-screen .deck-caption {
      font-size: 0.56rem;
      letter-spacing: 0.8px;
    }

    body.is-game-screen #game-screen .piles-area {
      max-width: 100%;
      gap: 4px;
    }

    body.is-game-screen #game-screen .pile {
      padding: 5px 4px;
      border-radius: 7px;
    }

    body.is-game-screen #game-screen .pile .pile-stack {
      width: auto; height: auto; left: 0; top: 0;
      transform: none; inset: -1px;
    }

    body.is-game-screen #game-screen .pile .pile-stack-top {
      border-radius: 7px;
    }

    body.is-game-screen #game-screen .pile .pile-stack-top::before {
      inset: 2px;
      border-radius: 5px;
    }

    body.is-game-screen #game-screen .pile .pile-icon {
      font-size: 0.84rem;
      margin-bottom: 0;
    }

    body.is-game-screen #game-screen .pile .pile-label {
      font-size: 0.58rem;
    }

    body.is-game-screen #game-screen .pile .pile-value-row {
      min-height: 30px;
      gap: 4px;
    }

    body.is-game-screen #game-screen .pile .pile-transition-prefix {
      font-size: 0.72rem;
    }

    body.is-game-screen #game-screen .pile .pile-value {
      font-size: 1.45rem;
    }

    body.is-game-screen #game-screen .pile .pile-start {
      font-size: 0.54rem;
    }

    body.is-game-screen #game-screen .actions {
      gap: 5px;
      max-width: 100%;
    }

    body.is-game-screen #game-screen .btn-action {
      min-height: 34px;
      padding: 5px 8px;
      font-size: 0.72rem;
    }

    body.is-game-screen #game-screen .btn-action.abort,
    body.is-game-screen #game-screen .btn-action.host-end {
      min-height: 34px;
      font-size: 0.66rem;
      padding: 5px 8px;
    }

    body.is-game-screen #game-screen .hand-area {
      margin-top: 4px;
    }

    body.is-game-screen #game-screen .hand-label {
      margin-bottom: 4px;
      font-size: 0.68rem;
    }

    body.is-game-screen #game-screen .hand {
      flex-wrap: wrap;
      justify-content: center;
      overflow-x: visible;
      padding: 0 2px 2px;
      gap: 4px;
    }

    body.is-game-screen #game-screen .card {
      width: 44px;
      height: 63px;
      font-size: 1rem;
      border-radius: 7px;
    }

    body.is-game-screen #game-screen .card-rank {
      font-size: 0.44rem;
    }

    body.is-game-screen #game-screen .chat-toolbar {
      margin-bottom: 3px;
    }

    body.is-game-screen #game-screen .chat-expand-toggle {
      font-size: 0.62rem;
      min-height: 26px;
      padding: 2px 8px;
    }

    body.is-game-screen #game-screen .mobile-aux-row {
      margin-top: 5px;
      margin-bottom: 0;
    }

    body.is-game-screen #game-screen .chat-area {
      display: flex;
      flex-direction: column;
      max-width: 100%;
      margin-top: 2px;
    }

    body.is-game-screen #game-screen .chat-messages {
      height: 50px;
      padding: 4px 6px;
      font-size: 0.66rem;
    }

    body.is-game-screen #game-screen .chat-area.expanded .chat-messages {
      height: 138px;
    }

    body.is-game-screen #game-screen .chat-input-row input,
    body.is-game-screen #game-screen .chat-input-row button {
      min-height: 34px;
      padding-top: 6px;
      padding-bottom: 6px;
    }

    body.is-game-screen #game-screen .chat-hint {
      font-size: 0.54rem;
      margin-top: 1px;
      margin-bottom: 0;
    }
  }

  @media (min-width: 1000px) {
    #game-screen {
      gap: 4px;
      padding-top: 2px;
    }
    .game-header { max-width: 1060px; }
    .players-bar { max-width: 920px; }
    .piles-area { max-width: 520px; gap: 10px; }
    .deck-zone { max-width: 520px; }
    .chat-area { max-width: 500px; }
    .card {
      width: 68px;
      height: 98px;
      font-size: 1.65rem;
    }
    .deck-stack { width: 94px; height: 132px; }
  }

  @media (min-width: 901px) and (min-height: 860px) {
    /* Kein justify-content: center — bei hohem Inhalt sonst oben/unten abgeschnitten und nicht scrollbar. */
    #menu-screen {
      justify-content: flex-start;
      padding: 30px 16px;
    }
  }

  /* ── Landscape phone ── */
  @media (max-height: 500px) and (orientation: landscape) {
    #game-screen { gap: 3px; padding: 4px; }
    .game-header { padding: 4px 10px; }
    .pile { padding: 6px 4px; }
    .pile .pile-value { font-size: 1.6rem; }
    .pile .pile-stack {
      width: auto; height: auto; left: 0; top: 0;
      transform: none; inset: -1px;
    }
    .pile .pile-stack-top { border-radius: 7px; }
    .pile .pile-stack-top::before { inset: 2px; border-radius: 5px; }
    .card { width: 46px; height: 64px; font-size: 1.05rem; }
    .card-rank { font-size: 0.48rem; }
    .deck-stack { width: 64px; height: 90px; }
    .deck-zone { margin-top: 8px; margin-bottom: 1px; }
    .deck-remaining { font-size: 0.74rem; top: 4px; min-width: 26px; padding: 1px 6px; }
    .deck-caption { font-size: 0.62rem; }
    .turn-banner { font-size: 0.9rem; }
    .chat-messages { height: 50px; }
    .piles-area { max-width: 360px; gap: 4px; }
  }
