
    :root {
      --bg: #091729;
      --bg-dot: rgba(255, 255, 255, 0.05);
      --panel: #0d2540;
      --panel-2: #16365c;
      --panel-3: #05101d;
      --line: rgba(255, 196, 89, 0.4);
      --line-soft: rgba(255, 196, 89, 0.18);
      --amber: #ffb43d;
      --amber-dim: rgba(255, 180, 61, 0.28);
      --pink: #ff6fa5;
      --mint: #5fe8b0;
      --danger: #ff5c5c;
      --danger-dim: rgba(255, 92, 92, 0.28);
      --text: #fdf6ff;
      --text-dim: #9bb7d4;
      --radius: 14px;
    }

    * {
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    html,
    body {
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: hidden;
      background:
        radial-gradient(circle at 1px 1px, var(--bg-dot) 1.4px, transparent 1.4px) 0 0/24px 24px,
        var(--bg);
      color: var(--text);
      font-family: 'Inter', system-ui, sans-serif;
    }

    h1,
    h2,
    h3,
    .display {
      font-family: 'Baloo 2', sans-serif;
      letter-spacing: 0.2px;
      margin: 0;
    }

    .mono {
      font-family: 'IBM Plex Mono', monospace;
    }

    button {
      font-family: 'Baloo 2', sans-serif;
      cursor: pointer;
    }

    .app {
      max-width: 1020px;
      margin: 0 auto;
      height: 100vh;
      height: 100dvh;
      padding: 12px 14px;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
    }

    /* Screen game specific viewport lock — Fullscreen Landscape */
    .app.in-game {
      padding: 0 !important;
      margin: 0 !important;
      max-width: 100vw !important;
      width: 100vw;
      height: 100vh;
      height: 100dvh;
      /* iOS safe area: push content away from notch/home bar */
      padding-left: env(safe-area-inset-left) !important;
      padding-right: env(safe-area-inset-right) !important;
      padding-top: env(safe-area-inset-top) !important;
      padding-bottom: env(safe-area-inset-bottom) !important;
      overflow: hidden;
    }

    .btn {
      background: var(--panel-2);
      border: 2px solid var(--line);
      color: var(--text);
      padding: 10px 16px;
      border-radius: var(--radius);
      font-size: 14px;
      font-weight: 700;
      transition: transform .12s ease, background .15s ease, border-color .15s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .btn:hover {
      background: #1f4a7c;
      border-color: var(--mint);
    }

    .btn:active {
      transform: scale(0.96);
    }

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

    .btn.primary {
      background: var(--amber);
      border-color: var(--amber);
      color: #331b00;
      box-shadow: 0 4px 12px rgba(255, 180, 61, 0.3);
    }

    .btn.primary:hover {
      background: #ffc766;
    }

    .btn.danger {
      background: var(--danger);
      border-color: var(--danger);
      color: #fff;
    }

    .btn.ghost {
      background: transparent;
    }

    .btn.block {
      width: 100%;
    }

    .row {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .row.center {
      align-items: center;
    }

    .spacer {
      flex: 1;
    }

    .panel {
      background: var(--panel);
      border: 2px solid var(--line-soft);
      border-radius: 18px;
      padding: 16px;
    }

    .tag {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11px;
      color: var(--mint);
      border: 1.5px solid var(--line);
      border-radius: 20px;
      padding: 2px 9px;
    }

    input,
    input[type=text],
    input[type=password],
    input[type=email],
    input[type=number] {
      background: var(--panel-3);
      border: 2px solid var(--line);
      color: var(--text);
      padding: 11px 14px;
      border-radius: 12px;
      font-family: 'Inter', system-ui, sans-serif;
      font-size: 14.5px;
      width: 100%;
      box-sizing: border-box;
      transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    }

    input:focus,
    input[type=text]:focus,
    input[type=password]:focus,
    input[type=email]:focus,
    input[type=number]:focus {
      outline: none;
      border-color: var(--amber);
      box-shadow: 0 0 0 3px var(--amber-dim);
      background: rgba(5, 16, 29, 0.95);
    }

    input::placeholder,
    input[type=text]::placeholder,
    input[type=password]::placeholder,
    input[type=email]::placeholder,
    input[type=number]::placeholder {
      color: var(--text-dim);
      font-family: 'Inter', sans-serif;
      letter-spacing: 0;
      opacity: 0.75;
    }

    /* Auth Screen Center Layout */
    .auth-screen {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: calc(100vh - 36px);
      min-height: calc(100dvh - 36px);
      width: 100%;
      max-width: 440px;
      margin: auto;
      padding: 18px 12px;
      box-sizing: border-box;
      animation: modalPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    }

    .auth-hero {
      text-align: center;
      margin-bottom: 18px;
      width: 100%;
    }

    .auth-hero .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--pink);
      font-family: 'IBM Plex Mono', monospace;
      font-size: 12px;
      font-weight: 600;
      background: rgba(255, 111, 165, 0.12);
      padding: 4px 12px;
      border-radius: 20px;
      border: 1.5px solid rgba(255, 111, 165, 0.3);
      margin-bottom: 6px;
    }

    .auth-hero h1 {
      font-size: 38px;
      margin: 4px 0 6px 0;
      color: #ffffff;
      text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
      letter-spacing: 0.5px;
    }

    .auth-hero p {
      color: var(--text-dim);
      font-size: 13.5px;
      line-height: 1.55;
      margin: 0 auto;
      max-width: 380px;
    }

    .auth-card {
      width: 100%;
      background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
      border: 2px solid var(--amber);
      border-radius: 22px;
      padding: 24px 22px;
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 28px rgba(255, 180, 61, 0.2);
      box-sizing: border-box;
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-bottom: 14px;
      text-align: left;
    }

    .form-label {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11.5px;
      font-weight: 600;
      color: var(--mint);
      letter-spacing: 0.3px;
    }

    .auth-alert-error {
      background: rgba(255, 92, 92, 0.15);
      border: 1.5px solid var(--danger);
      color: #ff9b9b;
      padding: 10px 14px;
      border-radius: 12px;
      font-size: 13px;
      margin-top: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      line-height: 1.4;
    }

    .auth-alert-success {
      background: rgba(95, 232, 176, 0.15);
      border: 1.5px solid var(--mint);
      color: var(--mint);
      padding: 10px 14px;
      border-radius: 12px;
      font-size: 13px;
      margin-top: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      line-height: 1.4;
    }

    .hero {
      text-align: left;
      margin-bottom: 14px;
    }

    .hero .eyebrow {
      color: var(--pink);
      font-family: 'IBM Plex Mono', monospace;
      font-size: 12px;
    }

    .hero h1 {
      font-size: 32px;
      margin-top: 4px;
      line-height: 1.15;
    }

    .hero p {
      color: var(--text-dim);
      max-width: 520px;
      margin-top: 6px;
      font-size: 13.5px;
      line-height: 1.5;
    }

    .choice-card {
      padding: 16px;
      border-radius: 16px;
      border: 2px solid var(--line-soft);
      background: var(--panel);
      cursor: pointer;
      transition: border-color .15s, background .15s;
      flex: 1;
      min-width: 220px;
    }

    .choice-card:hover {
      border-color: var(--mint);
      background: var(--panel-2);
    }

    .choice-card h3 {
      font-size: 18px;
      margin-bottom: 6px;
    }

    .choice-card p {
      color: var(--text-dim);
      font-size: 13px;
      line-height: 1.45;
      margin: 0;
    }

    .seat-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px 12px;
      padding: 10px 12px;
      background: var(--panel-3);
      border: 2px solid var(--line-soft);
      border-radius: 12px;
      margin-bottom: 8px;
      overflow: hidden;
    }

    .seat-top {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: 1 1 150px;
      min-width: 140px;
    }

    .seat-controls {
      flex: 1 1 100%;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .seat-avatar {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--panel-2);
      font-size: 18px;
      border: 2px solid var(--line);
      flex-shrink: 0;
      cursor: pointer;
      transition: border-color .15s ease, transform .1s ease;
    }

    .seat-avatar:hover {
      border-color: var(--mint);
    }

    .seat-avatar:active {
      transform: scale(0.92);
    }

    .avatar-pick-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 8px;
      margin: 14px 0;
    }

    .avatar-pick-btn {
      width: 100%;
      aspect-ratio: 1;
      border-radius: 12px;
      font-size: 22px;
      background: var(--panel-3);
      border: 2px solid var(--line-soft);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .avatar-pick-btn:hover {
      border-color: var(--mint);
    }

    .avatar-pick-btn.active {
      border-color: var(--amber);
      box-shadow: 0 0 0 2px var(--amber-dim);
    }

    .avatar-pick-btn.taken {
      opacity: 0.25;
      cursor: not-allowed;
    }

    .profile-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--panel);
      border: 2px solid var(--line-soft);
      border-radius: 14px;
      padding: 8px 10px 8px 8px;
      margin-bottom: 12px;
      cursor: pointer;
      transition: border-color .15s ease, background .15s ease;
    }

    .profile-bar:hover {
      border-color: var(--mint);
      background: var(--panel-2);
    }

    .profile-bar .seat-avatar {
      width: 40px;
      height: 40px;
      font-size: 20px;
      cursor: default;
    }

    .profile-bar-info {
      display: flex;
      flex-direction: column;
      gap: 1px;
      flex: 1;
      min-width: 0;
    }

    .profile-bar-name {
      font-weight: 700;
      font-size: 14.5px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .profile-bar-stats {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11px;
      color: var(--text-dim);
    }

    .profile-bar-edit {
      font-size: 11px;
      color: var(--mint);
      font-family: 'IBM Plex Mono', monospace;
      flex-shrink: 0;
    }

    .seat-name {
      font-weight: 700;
      font-size: 14px;
    }

    .seat-meta {
      color: var(--text-dim);
      font-size: 11.5px;
      margin-top: 1px;
    }

    .diff-pick {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .diff-pick button {
      padding: 5px 9px;
      font-size: 11.5px;
      border-radius: 8px;
    }

    .diff-pick button.diff-easy.active {
      background: #5fe89a;
      color: #0a3320;
      border-color: #5fe89a;
    }

    .diff-pick button.diff-medium.active {
      background: var(--amber);
      color: #331b00;
      border-color: var(--amber);
    }

    .diff-pick button.diff-hard.active {
      background: var(--danger);
      color: #fff;
      border-color: var(--danger);
    }

    .diff-desc {
      flex: 1 1 100%;
      font-size: 11px;
      color: var(--text-dim);
      line-height: 1.45;
      margin-top: 2px;
    }

    .diff-group {
      flex: 1 1 100%;
      display: flex;
      flex-direction: column;
      gap: 7px;
      margin-top: 8px;
      padding-top: 10px;
      border-top: 1px dashed var(--line-soft);
    }

    .seat-toggle {
      display: flex;
      gap: 6px;
    }

    .seat-toggle button {
      padding: 5px 9px;
      font-size: 11.5px;
      border-radius: 8px;
    }

    .room-code-box {
      text-align: center;
      padding: 18px;
      background: var(--panel-3);
      border: 2px dashed var(--line);
      border-radius: 16px;
      margin-bottom: 14px;
    }

    .room-code-box .code {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 34px;
      letter-spacing: 8px;
      color: var(--amber);
      font-weight: 600;
    }

    /* ----------------------------------------------------
       4-DIRECTIONAL CARD TABLE LAYOUT (UNO / 4-COLORS STYLE)
       ---------------------------------------------------- */
    /* ----------------------------------------------------
       4-DIRECTIONAL CARD TABLE LAYOUT (UNO / 4-COLORS STYLE)
       ---------------------------------------------------- */
    .play-table {
      position: relative;
      background: radial-gradient(ellipse at 50% 45%, #0e4e8a 0%, #062b53 55%, #011326 100%);
      border-radius: 0;
      border: none;
      padding: 6px 12px;
      box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.65);
      display: grid;
      grid-template-columns: minmax(80px, 140px) 1fr minmax(80px, 140px);
      grid-template-rows: auto 1fr auto;
      grid-template-areas:
        "left top right"
        "left center right"
        "bottom bottom bottom";
      gap: 4px 8px;
      flex: 1;
      width: 100vw;
      height: 100vh;
      height: 100dvh;
      max-height: 100vh;
      max-width: 100vw;
      margin: 0;
      overflow: hidden;
      box-sizing: border-box;
    }

    .play-table::before {
      content: '';
      position: absolute;
      inset: 0;
      pointer-events: none;
      background: repeating-linear-gradient(98deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 2px, transparent 2px, transparent 12px);
    }

    .play-table>* {
      position: relative;
      z-index: 1;
    }

    /* Table Center Watermark Diamond (UNO Style) */
    .table-center-watermark {
      position: absolute;
      top: 45%;
      left: 50%;
      transform: translate(-50%, -50%) rotate(45deg);
      width: 155px;
      height: 155px;
      border: 3px solid rgba(255, 255, 255, 0.12);
      border-radius: 22px;
      pointer-events: none;
      z-index: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.03);
    }

    .table-center-watermark::before {
      content: '';
      position: absolute;
      width: 110px;
      height: 110px;
      border: 2.5px dashed rgba(255, 255, 255, 0.15);
      border-radius: 16px;
    }

    /* Floating Decor Badges around Center Piles */
    .special-mode-badge {
      position: absolute;
      left: -58px;
      top: 50%;
      transform: translateY(-50%);
      background: linear-gradient(135deg, #0ea5e9, #0284c7);
      border: 2px solid #ffffff;
      border-radius: 20px;
      padding: 4px 8px;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 8.5px;
      font-weight: 800;
      color: #ffffff;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
      white-space: nowrap;
      text-shadow: 0 1px 2px #000;
    }

    .direction-badge {
      position: absolute;
      right: -48px;
      top: 50%;
      transform: translateY(-50%);
      display: flex;
      flex-direction: column;
      gap: 6px;
      align-items: center;
    }

    .dir-chip-diamond {
      width: 18px;
      height: 18px;
      transform: rotate(45deg);
      border: 1.5px solid #fff;
      border-radius: 3px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    }

    .dir-chip-diamond.blue {
      background: #0072ce;
    }

    .dir-chip-diamond.purple {
      background: #8e44ad;
    }

    /* Quit Button in Top Left Corner */
    .table-quit-btn {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 20;
      padding: 5px 12px;
      font-size: 11.5px;
      background: linear-gradient(180deg, #dc2626, #b91c1c);
      border: 2px solid #ffffff;
      color: #fff;
      border-radius: 8px;
      font-weight: 800;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
      cursor: pointer;
    }

    .table-quit-btn:hover {
      background: #ef4444;
      transform: translateY(-1px);
    }

    /* Fullscreen Button in Top Right Corner */
    .table-fullscreen-btn {
      position: absolute;
      top: 10px;
      right: 10px;
      z-index: 20;
      padding: 5px 12px;
      font-size: 11.5px;
      background: linear-gradient(180deg, #0284c7, #0369a1);
      border: 2px solid #ffffff;
      color: #fff;
      border-radius: 8px;
      font-weight: 800;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      transition: background 0.15s ease, transform 0.1s ease;
    }

    .table-fullscreen-btn:hover {
      background: #0ea5e9;
      transform: translateY(-1px);
    }

    /* Hide fullscreen button on touch devices / iOS where API is not supported */
    @media (pointer: coarse) {
      .table-fullscreen-btn {
        display: none !important;
      }
    }

    /* 4-Side Seats Positions */
    .table-seat-top {
      grid-area: top;
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      justify-content: space-evenly;
      gap: 8px;
      width: 100%;
      padding: 0 40px;
    }

    .table-seat-left {
      grid-area: left;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }

    .table-seat-right {
      grid-area: right;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }

    .table-seat-bottom {
      grid-area: bottom;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-end;
      width: 100%;
      overflow: visible;
    }

    .table-center-stage {
      grid-area: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      position: relative;
    }

    /* Opponent Seat Card Header & Avatar Badge */
    .seat-badge {
      background: rgba(5, 16, 29, 0.9);
      border: 2px solid var(--line-soft);
      border-radius: 12px;
      padding: 5px 10px;
      display: flex;
      align-items: center;
      gap: 7px;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
      transition: border-color .2s ease, box-shadow .2s ease;
    }

    .seat-badge.active-turn {
      border-color: var(--amber);
      box-shadow: 0 0 14px rgba(255, 180, 61, 0.7);
      background: #1b4573;
    }

    .seat-badge.out {
      opacity: 0.4;
      filter: grayscale(1);
    }

    .seat-avatar-mini {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: var(--panel-2);
      border: 1.5px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }

    .seat-name-text {
      font-size: 13.5px;
      font-weight: 800;
      color: #fff;
      white-space: nowrap;
      max-width: 110px;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .seat-count-tag {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 12.5px;
      font-weight: 800;
      color: var(--amber);
      background: rgba(255, 180, 61, 0.15);
      padding: 2px 6px;
      border-radius: 6px;
      border: 1px solid rgba(255, 180, 61, 0.3);
    }

    /* ----------------------------------------------------
       VERTICAL & HORIZONTAL FACE-DOWN CARD DECKS (UNO STYLE)
       ---------------------------------------------------- */
    .facedown-stack-h {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 2px;
      max-width: 180px;
      overflow: hidden;
    }

    .facedown-stack-v {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 2px;
      max-height: 200px;
      overflow: hidden;
    }

    /* UNO Face-Down Card Back Styling (Carbon Texture + Red Diamond) */
    .card-back,
    .facedown-card-v,
    .facedown-card-h {
      background: repeating-linear-gradient(135deg, #0a0e14, #0a0e14 3px, #182230 3px, #182230 7px) !important;
      border: 3px solid #ffffff !important;
      border-radius: 12px !important;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55) !important;
      position: relative;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .facedown-card-v {
      width: 68px;
      height: 44px;
      margin-top: -28px;
      flex-shrink: 0;
      border-width: 2.5px !important;
      border-radius: 8px !important;
    }

    .facedown-card-v:first-child {
      margin-top: 0;
    }

    /* Top seat upright face-down cards */
    .facedown-card-h {
      width: 44px;
      height: 64px;
      margin-left: -24px;
      flex-shrink: 0;
      border-width: 2.5px !important;
      border-radius: 8px !important;
    }

    .facedown-card-h:first-child {
      margin-left: 0;
    }

    .card-back {
      width: 96px;
      height: 136px;
      margin: 0 auto;
      cursor: pointer;
      transition: transform .2s ease, box-shadow .2s ease;
    }

    .card-back:hover {
      transform: translateY(-4px) scale(1.04);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px var(--amber) !important;
    }

    .card-back.danger {
      box-shadow: 0 0 20px 6px var(--danger-dim), 0 0 0 3.5px var(--danger) !important;
      border-color: var(--danger) !important;
    }

    .uno-center-badge {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
    }

    .uno-badge-diamond {
      width: 78%;
      height: 56%;
      background: linear-gradient(135deg, #e62b2b 0%, #b91c1c 100%);
      transform: rotate(-18deg);
      border: 2px solid #ffffff;
      border-radius: 7px;
      box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
      position: relative;
      overflow: hidden;
    }

    .uno-badge-diamond::before {
      content: '';
      position: absolute;
      inset: 0;
      background:
        linear-gradient(135deg, #ffb800 50%, transparent 50%),
        linear-gradient(225deg, #0072ce 50%, transparent 50%),
        linear-gradient(45deg, #e62b2b 50%, transparent 50%),
        linear-gradient(315deg, #2bba00 50%, transparent 50%);
      border-radius: 4px;
      opacity: 0.85;
    }

    .uno-badge-text {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      font-family: 'Baloo 2', system-ui, sans-serif;
      font-size: 8.5px;
      font-weight: 800;
      color: #ffffff;
      text-shadow: 0 1px 3px #000, 0 0 4px #000;
      line-height: 1;
      letter-spacing: 0.5px;
      transform: rotate(18deg);
      z-index: 2;
    }

    .uno-badge-text .uno-t {
      color: #ffffff;
      font-size: 8.5px;
    }

    .uno-badge-text .uno-b {
      color: #ffeb3b;
      font-size: 7.5px;
    }

    /* Center Stage (Draw & Discard Piles) */
    .center-piles-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 24px;
      position: relative;
      z-index: 2;
    }

    .pile {
      text-align: center;
    }

    .pile .label {
      font-size: 10px;
      color: var(--text-dim);
      font-family: 'IBM Plex Mono', monospace;
      margin-bottom: 4px;
    }

    .card-back {
      width: 74px;
      height: 102px;
      border-radius: 12px;
      background: repeating-linear-gradient(135deg, var(--panel-2), var(--panel-2) 6px, var(--panel-3) 6px, var(--panel-3) 12px);
      border: 2.5px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 28px;
      position: relative;
      margin: 0 auto;
      transition: box-shadow .3s ease, transform .15s ease;
      cursor: pointer;
    }

    .card-back:hover {
      transform: translateY(-4px);
      border-color: var(--amber);
    }

    .card-back.danger {
      box-shadow: 0 0 20px 5px var(--danger-dim);
      border-color: var(--danger);
    }

    .discard-top {
      width: 74px;
      height: 102px;
      border-radius: 12px;
      background: var(--panel-3);
      border: 2.5px solid var(--line-soft);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 32px;
      margin: 0 auto;
      position: relative;
    }

    .card-back::before,
    .card-back::after,
    .discard-top::before,
    .discard-top::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: 12px;
      background: inherit;
      border: 1.5px solid var(--line-soft);
      z-index: -1;
    }

    .card-back::before,
    .discard-top::before {
      transform: rotate(-6deg) translateY(2px);
    }

    .card-back::after,
    .discard-top::after {
      transform: rotate(6deg) translateY(2px);
    }

    .turn-banner {
      text-align: center;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11.5px;
      font-weight: 600;
      color: var(--mint);
      padding: 5px 12px;
      background: rgba(5, 16, 29, 0.85);
      border-radius: 10px;
      border: 1.5px solid var(--line-soft);
      letter-spacing: 0.3px;
      flex-shrink: 0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }

    /* Hand & Controls Section (Bottom Viewport Fit) */
    .hand-wrap {
      display: flex;
      flex-direction: column;
      gap: 4px;
      flex-shrink: 0;
      background: linear-gradient(180deg, rgba(12, 34, 60, 0.94) 0%, rgba(4, 16, 30, 0.98) 100%);
      border: 2px solid rgba(255, 180, 61, 0.4);
      border-radius: 20px;
      padding: 8px 10px 12px 10px;
      width: 100%;
      box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }

    .hand-label {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .me-avatar-chip {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: var(--panel-2);
      border: 2px solid var(--amber);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      flex-shrink: 0;
    }

    .hand-hint {
      font-size: 10.5px;
      color: var(--mint);
      line-height: 1.2;
    }

    /* Flex-start overflow container to prevent negative left clip */
    .hand-scroll-container {
      width: 100%;
      overflow-x: auto;
      padding: 10px 8px 6px 8px;
      display: flex;
      justify-content: center;
      scrollbar-width: none;
      -ms-overflow-style: none;
    }

    .hand-scroll-container::-webkit-scrollbar {
      display: none;
    }

    .hand {
      display: flex;
      align-items: flex-end;
      justify-content: flex-start;
      padding: 0 10px;
      min-width: min-content;
    }

    /* REDESIGNED PLAYING CARDS (UNO 4-COLORS RICH VIBRANT STYLE) */
    .card-token {
      width: 96px;
      height: 136px;
      min-width: 96px;
      border-radius: 14px;
      border: 3.5px solid #ffffff;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      padding: 5px 6px;
      position: relative;
      flex-shrink: 0;
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55), inset 0 0 12px rgba(0, 0, 0, 0.25);
      transition: transform .2s cubic-bezier(0.175, 0.885, 0.32, 1.275), margin .2s ease, box-shadow .2s ease, border-color .2s ease;
      transform-origin: 50% 120%;
      user-select: none;
      background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }

    /* Integrated Card Face Inner Elements */
    .card-top-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      z-index: 2;
    }

    .card-top-tag {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 9.5px;
      font-weight: 800;
      color: #ffffff;
      background: rgba(0, 0, 0, 0.45);
      padding: 1px 6px;
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.4);
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
      line-height: 1.2;
    }

    .card-corner-icon {
      font-size: 13px;
      filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
      line-height: 1;
    }

    /* UNO White Oval Center Frame */
    .card-center-frame {
      position: relative;
      width: 86%;
      height: 50%;
      margin: 2px auto;
      background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f1f5f9 100%);
      border-radius: 46% / 36%;
      border: 2px solid rgba(255, 255, 255, 0.95);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.3), 0 3px 8px rgba(0, 0, 0, 0.3);
      z-index: 1;
      transform: rotate(-4deg);
    }

    .card-main-icon {
      font-size: 34px;
      text-align: center;
      filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.35));
      line-height: 1;
      transform: rotate(4deg);
    }

    .card-bottom-bar {
      width: 100%;
      z-index: 2;
    }

    .card-bottom-title {
      font-size: 10.5px;
      font-weight: 800;
      text-align: center;
      line-height: 1.2;
      color: #ffffff;
      background: rgba(0, 0, 0, 0.65);
      padding: 3px 2px;
      border-radius: 7px;
      border: 1px solid rgba(255, 255, 255, 0.25);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      width: 100%;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    }

    /* Rich Vivid Card Colors per Type */
    .card-token[data-type="bomb"] {
      background: linear-gradient(135deg, #ef4444 0%, #7f1d1d 100%);
      --card-color: #ff6b6b;
    }

    .card-token[data-type="defuse"] {
      background: linear-gradient(135deg, #10b981 0%, #047857 100%);
      --card-color: #34d399;
    }

    .card-token[data-type="attack"] {
      background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
      --card-color: #fbbf24;
    }

    .card-token[data-type="skip"] {
      background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
      --card-color: #38bdf8;
    }

    .card-token[data-type="shuffle"] {
      background: linear-gradient(135deg, #a855f7 0%, #6b21a8 100%);
      --card-color: #c084fc;
    }

    .card-token[data-type="peek"] {
      background: linear-gradient(135deg, #eab308 0%, #a16207 100%);
      --card-color: #fde047;
    }

    .card-token[data-type="favor"],
    .card-token[data-type="ask"] {
      background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
      --card-color: #f472b6;
    }

    .card-token[data-type="nope"] {
      background: linear-gradient(135deg, #27272a 0%, #09090b 100%);
      border-color: #ef4444 !important;
      --card-color: #ef4444;
    }

    .card-token[data-type="copycat"] {
      background: linear-gradient(135deg, #6366f1 0%, #3730a3 100%);
      --card-color: #818cf8;
    }

    .card-token[data-type="chewer"] {
      background: linear-gradient(135deg, #d97706 0%, #78350f 100%);
      --card-color: #fbbf24;
    }

    .card-token[data-type="number"] {
      background: linear-gradient(135deg, #64748b 0%, #334155 100%);
      --card-color: #cbd5e1;
    }

    /* Sub-types for Number / Junk cards */
    .card-token[data-type="number"][data-sub="carrot"] {
      background: linear-gradient(135deg, #10b981 0%, #065f46 100%);
    }

    .card-token[data-type="number"][data-sub="sock"] {
      background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    }

    .card-token[data-type="number"][data-sub="banana"] {
      background: linear-gradient(135deg, #eab308 0%, #854d0e 100%);
    }

    .card-token[data-type="number"][data-sub="yoyo"] {
      background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    }

    .card-token[data-type="number"][data-sub="balloon"] {
      background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    }

    .card-token.playable {
      cursor: pointer;
    }

    .card-token.playable:hover,
    .card-token.selected {
      z-index: 60 !important;
      transform: translateY(-26px) scale(1.12) !important;
      box-shadow: 0 14px 32px rgba(0, 0, 0, 0.75), 0 0 20px var(--card-color, #ffb43d);
      border-color: #ffffff !important;
    }

    /* Off-turn Grayed Out & Blurred Card Styling */
    .card-token.disabled,
    .hand-wrap.not-my-turn .card-token {
      filter: grayscale(0.9) blur(1px) opacity(0.45) !important;
      cursor: not-allowed !important;
      pointer-events: none !important;
      box-shadow: none !important;
      transition: filter 0.25s ease, opacity 0.25s ease, transform 0.25s ease !important;
    }

    .log-panel {
      max-height: 28px;
      min-height: 24px;
      overflow: hidden;
      font-family: 'IBM Plex Mono', monospace;
      font-size: 10px;
      color: var(--mint);
      background: rgba(5, 16, 29, 0.85);
      border-radius: 12px;
      padding: 4px 12px;
      line-height: 1.2;
      border: 1px solid var(--line-soft);
      flex-shrink: 0;
      width: auto;
      max-width: 90%;
      text-align: center;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }

    .log-panel div:last-child {
      color: #ffffff;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    @keyframes modalPopIn {
      0% {
        opacity: 0;
        transform: scale(0.65) translateY(24px);
      }

      70% {
        transform: scale(1.05) translateY(-3px);
      }

      100% {
        opacity: 1;
        transform: scale(1) translateY(0);
      }
    }

    .overlay {
      position: fixed;
      inset: 0;
      background: rgba(8, 4, 14, 0.82);
      backdrop-filter: blur(6px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      padding: 14px;
    }

    .modal {
      background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
      border: 2.5px solid var(--amber);
      border-radius: 22px;
      padding: 22px 20px;
      max-width: 400px;
      width: 100%;
      text-align: center;
      box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 180, 61, 0.25);
      animation: modalPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    }

    .modal h2 {
      font-size: 22px;
      font-weight: 800;
      color: #ffffff;
      margin-top: 4px;
      margin-bottom: 6px;
      line-height: 1.3;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    }

    .modal p {
      color: #e2e8f0;
      font-size: 14.5px;
      font-weight: 500;
      line-height: 1.5;
      margin: 4px 0 10px 0;
      text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    }

    .peek-cards {
      display: flex;
      gap: 10px;
      justify-content: center;
      margin: 14px 0;
      flex-wrap: wrap;
    }

    .target-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 12px 0;
    }

    .target-btn {
      background: var(--panel-3);
      border: 2px solid var(--line-soft);
      color: var(--text);
      padding: 10px 12px;
      border-radius: 10px;
      text-align: left;
      font-size: 13.5px;
      font-family: 'Inter', sans-serif;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .target-btn:hover {
      border-color: var(--mint);
      background: var(--panel-2);
    }

    .target-btn:disabled {
      opacity: 0.35;
      cursor: not-allowed;
    }

    .bomb-flash {
      font-size: 48px;
      margin-bottom: 4px;
    }

    .footer-note {
      margin-top: 16px;
      text-align: center;
      color: var(--text-dim);
      font-size: 11px;
    }

    .carousel-wrap {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 10px;
    }

    .carousel-arrow {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      flex-shrink: 0;
      background: var(--panel-2);
      border: 2px solid var(--line);
      color: var(--text);
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: border-color .15s ease, background .15s ease;
    }

    .carousel-arrow:hover {
      border-color: var(--mint);
      background: #1f4a7c;
    }

    .carousel-viewport {
      flex: 1;
      overflow: hidden;
    }

    .carousel-card {
      background: var(--panel-3);
      border: 2px solid var(--line-soft);
      border-radius: 16px;
      padding: 16px;
      text-align: center;
      cursor: pointer;
      min-height: 140px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: border-color .2s ease;
    }

    .carousel-card:hover {
      border-color: var(--mint);
    }

    .carousel-card .cc-icon {
      font-size: 32px;
    }

    .cc-junk-grid {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      justify-content: center;
      margin: 4px 0 2px;
    }

    .cc-junk-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      width: 56px;
    }

    .cc-junk-icon {
      font-size: 22px;
    }

    .cc-junk-name {
      font-size: 9.5px;
      color: var(--text-dim);
      text-align: center;
      line-height: 1.2;
    }

    .carousel-card .cc-name {
      font-size: 16px;
      font-weight: 800;
    }

    .carousel-card .cc-tag {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 10px;
      color: var(--mint);
    }

    .carousel-card .cc-desc {
      font-size: 12px;
      color: var(--text-dim);
      line-height: 1.5;
      max-width: 400px;
      margin: 0 auto;
    }

    .carousel-dots {
      display: flex;
      justify-content: center;
      gap: 6px;
      margin-top: 10px;
    }

    .carousel-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--line-soft);
      transition: background .2s ease, transform .2s ease;
    }

    .carousel-dot.active {
      background: var(--amber);
      transform: scale(1.3);
    }

    .seg-control {
      margin-bottom: 6px;
    }

    .seg-label {
      font-family: 'IBM Plex Mono', monospace;
      font-size: 11px;
      color: var(--mint);
      margin-bottom: 7px;
    }

    .seg-options {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
      gap: 6px;
    }

    .seg-btn {
      padding: 10px 4px;
      border-radius: 10px;
      text-align: center;
      background: var(--panel-2);
      border: 2px solid var(--line);
      color: var(--text);
      font-family: 'Baloo 2', sans-serif;
      font-weight: 700;
      font-size: 14px;
      transition: background .15s ease, border-color .15s ease, transform .1s ease;
    }

    .seg-btn:hover {
      border-color: var(--mint);
    }

    .seg-btn.active {
      background: var(--amber);
      border-color: var(--amber);
      color: #331b00;
    }

    /* Smartphone Responsive Tweak (< 960px or Height < 560px for Mobile Landscape) */
    @media (max-height: 560px),
    (max-width: 960px) {
      .hero h1 {
        font-size: 24px;
      }

      .app.in-game {
        padding: 0;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
      }

      /* Mobile: allow hand to overflow table grid cleanly */
      .play-table {
        grid-template-columns: minmax(70px, 92px) 1fr minmax(70px, 92px);
        grid-template-rows: auto 1fr minmax(138px, auto);
        border-radius: 0;
        border: none;
        box-shadow: none;
        padding: 2px 4px;
        gap: 2px;
        overflow: visible;
      }

      .table-seat-top {
        gap: 8px;
      }

      .table-center-stage {
        gap: 2px;
      }

      .hand-wrap {
        padding: 6px 8px max(8px, env(safe-area-inset-bottom)) 8px;
        border-radius: 14px 14px 0 0;
        gap: 3px;
        min-height: 130px;
      }

      .hand-label {
        gap: 4px;
      }

      .hand-hint {
        font-size: 9.5px;
        line-height: 1.1;
      }

      .hand-scroll-container {
        padding: 8px 6px 4px 6px;
        overflow-x: auto !important;
        overflow-y: visible !important;
        touch-action: pan-x;
        min-height: 110px;
        -webkit-overflow-scrolling: touch;
      }

      .card-token {
        width: 68px;
        height: 96px;
        min-width: 68px;
        min-height: 96px;
        border-width: 2.5px;
        border-radius: 10px;
        padding: 3px 4px;
        flex-shrink: 0;
      }

      .card-top-tag {
        font-size: 7.5px;
        padding: 1px 3px;
      }

      .card-corner-icon {
        font-size: 10px;
      }

      .card-main-icon {
        font-size: 22px;
      }

      .card-bottom-title {
        font-size: 8.5px;
        padding: 1px;
      }

      .card-back,
      .discard-top {
        width: 62px;
        height: 88px;
        font-size: 20px;
      }

      .facedown-card-v {
        width: 54px;
        height: 36px;
        margin-top: -22px;
      }

      /* Upright card size for Top seat on mobile */
      .facedown-card-h {
        width: 36px;
        height: 52px;
        margin-left: -20px;
      }

      .seat-name-text {
        max-width: 80px;
        font-size: 11px;
      }

      .seat-badge {
        padding: 3px 7px;
        gap: 5px;
      }

      .seat-avatar-mini {
        width: 24px;
        height: 24px;
        font-size: 13px;
      }

      .seat-count-tag {
        font-size: 10.5px;
        padding: 1px 4px;
      }

      .turn-banner {
        font-size: 9.5px;
        padding: 2px 6px;
      }

      .special-mode-badge {
        left: -48px;
        font-size: 7.5px;
        padding: 3px 6px;
      }

      .direction-badge {
        right: -38px;
      }
    }

    /* ----------------------------------------------------
       SMOOTH ANIMATIONS & FLYING CARDS OVERLAY (UNO STYLE)
       ---------------------------------------------------- */
    .anim-card-fly {
      position: fixed;
      z-index: 99999;
      width: 72px;
      height: 102px;
      border-radius: 12px;
      border: 3px solid #ffffff;
      background: repeating-linear-gradient(135deg, #0a0e14, #0a0e14 3px, #182230 3px, #182230 7px);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 20px var(--amber);
      pointer-events: none;
      transition: left 0.58s cubic-bezier(0.25, 1, 0.5, 1), top 0.58s cubic-bezier(0.25, 1, 0.5, 1), transform 0.58s ease-out;
      transform-origin: center center;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      box-sizing: border-box;
      padding: 4px;
    }

    .anim-card-fly.face-up {
      background: var(--panel);
    }

    @keyframes toastSlideIn {
      0% {
        transform: translate(-50%, -20px) scale(0.85);
        opacity: 0;
      }

      100% {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
      }
    }

    .action-toast {
      position: fixed;
      top: 14px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 99990;
      background: linear-gradient(135deg, rgba(13, 37, 64, 0.95), rgba(5, 16, 29, 0.98));
      border: 2px solid var(--amber);
      border-radius: 20px;
      padding: 8px 20px;
      color: #fff;
      font-family: 'Baloo 2', sans-serif;
      font-size: 14px;
      font-weight: 700;
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), 0 0 14px rgba(255, 180, 61, 0.5);
      display: flex;
      align-items: center;
      gap: 8px;
      pointer-events: none;
      animation: toastSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    /* Card Placement Slam & Glow Animation Effect */
    @keyframes cardPlacePop {
      0% {
        transform: scale(1.35) translateY(-14px) rotate(-6deg);
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 35px var(--amber);
        opacity: 0.7;
      }

      60% {
        transform: scale(0.96) translateY(2px) rotate(2deg);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 15px var(--amber);
      }

      100% {
        transform: scale(1) translateY(0) rotate(0deg);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
        opacity: 1;
      }
    }

    .card-token.just-placed-card {
      animation: cardPlacePop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    }

    /* ----------------------------------------------------
       SMARTPHONE LANDSCAPE FORCE OVERLAY (UNO MOBILE STYLE)
       ---------------------------------------------------- */
    .orientation-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 99999;
      background: linear-gradient(135deg, #091729 0%, #05101d 100%);
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
      text-align: center;
      backdrop-filter: blur(8px);
    }

    /* Show overlay on mobile portrait viewports */
    @media (max-width: 900px) and (orientation: portrait) {
      .orientation-overlay {
        display: flex !important;
      }
    }

    .rotate-phone-icon {
      font-size: 64px;
      margin-bottom: 16px;
      animation: phoneRotate 2.2s ease-in-out infinite;
      filter: drop-shadow(0 4px 12px rgba(255, 180, 61, 0.4));
    }

    @keyframes phoneRotate {

      0%,
      100% {
        transform: rotate(0deg);
      }

      30%,
      70% {
        transform: rotate(-90deg);
      }
    }

    .orientation-overlay h2 {
      font-size: 22px;
      color: var(--amber);
      margin-bottom: 10px;
      font-weight: 800;
    }

    .orientation-overlay p {
      font-size: 13.5px;
      color: var(--text-dim);
      max-width: 320px;
      line-height: 1.5;
      margin-bottom: 18px;
    }

    .orientation-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 14px;
      border-radius: 20px;
      background: rgba(255, 180, 61, 0.15);
      border: 1.5px solid var(--amber);
      color: var(--amber);
      font-size: 12px;
      font-weight: 700;
    }
  