    :root {
      --cab-bg: #0f172a;
      --cab-panel: #111827;
      --cab-border: #334155;
      --cab-text: #f8fafc;
      --cab-muted: #94a3b8;
      --accent-green: #34d399;
      --accent-cyan: #38bdf8;
      --accent-amber: #fbbf24;
      --accent-rose: #fb7185;
    }
    * {
      box-sizing: border-box;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }
    html {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: hidden;
      background: #060913;
    }
    body {
      margin: 0;
      padding: 0;
      width: 100vw;
      height: 100vh;
      height: 100dvh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background-color: var(--background, #060913);
      background: radial-gradient(circle at 50% 30%, #0c1527 0%, #060913 80%);
      color: var(--foreground, #f8fafc);
      touch-action: none;
      font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      overflow: hidden;
    }
    .cabinet {
      position: relative;
      width: 100vw;
      height: 100vh;
      height: 100dvh;
      max-width: 100vw;
      max-height: 100vh;
      background: var(--cab-bg);
      color: var(--cab-text);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      border: none;
      border-radius: 0;
      box-shadow: none;
    }
    /* 풀스크린 가상 클래스 또는 전체 화면 모드 지원 */
    :fullscreen .cabinet,
    :-webkit-full-screen .cabinet {
      width: 100vw !important;
      height: 100vh !important;
      max-width: 100vw !important;
      max-height: 100vh !important;
      border: none !important;
      border-radius: 0 !important;
      box-shadow: none !important;
    }
    :fullscreen body,
    :-webkit-full-screen body {
      padding: 0 !important;
      background: #050811 !important;
    }
    .hud-top {
      background: #0b1120;
      border-bottom: 1px solid #1e293b;
      padding: max(8px, env(safe-area-inset-top, 8px)) 12px 6px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      z-index: 20;
      flex-shrink: 0;
    }
    .score-group {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .score-label {
      font-size: 9px;
      font-weight: 800;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--accent-green);
    }
    .score-label.hi {
      color: var(--accent-amber);
    }
    .score-val {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 16px;
      font-weight: 900;
      line-height: 1.05;
      font-variant-numeric: tabular-nums;
    }
    .score-val.hi {
      color: #fde68a;
    }
    .top-actions {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .stage-pill {
      padding: 3px 7px;
      border-radius: 6px;
      background: #082f49;
      border: 1px solid rgba(56, 189, 248, 0.4);
      color: #7dd3fc;
      font-family: ui-monospace, monospace;
      font-weight: 800;
      font-size: 11px;
      white-space: nowrap;
    }
    .icon-btn {
      height: 27px;
      min-width: 27px;
      padding: 0 6px;
      border-radius: 7px;
      background: #1e293b;
      border: 1px solid #334155;
      color: #e2e8f0;
      font-size: 10.5px;
      font-weight: 800;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: background 0.12s, transform 0.06s;
    }
    .icon-btn:hover { background: #334155; }
    .icon-btn:active { transform: scale(0.93); }

    .hud-sub {
      background: #070b14;
      border-bottom: 1px solid #1e293b;
      padding: 5px 11px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      font-size: 11px;
      z-index: 20;
    }
    .lives-wrap {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .life-pip {
      width: 11px;
      height: 11px;
      border-radius: 50%;
      background: var(--accent-green);
      border: 1.5px solid #ffffff;
      box-shadow: 0 0 5px rgba(52, 211, 153, 0.5);
    }
    .fever-wrap {
      display: flex;
      align-items: center;
      gap: 2px;
      font-family: ui-monospace, monospace;
      font-weight: 900;
      font-size: 10px;
    }
    .fever-slot {
      padding: 1px 4px;
      border-radius: 4px;
      background: #1e293b;
      color: #475569;
      transition: all 0.15s;
    }
    .upg-wrap {
      display: flex;
      align-items: center;
      gap: 4px;
      font-family: ui-monospace, monospace;
      font-size: 10px;
      font-weight: 800;
    }
    .upg-badge {
      padding: 1px 4px;
      border-radius: 4px;
      border: 1px solid #334155;
      background: #0f172a;
      color: #64748b;
    }
    .upg-badge.on {
      border-color: #38bdf8;
      background: #082f49;
      color: #bae6fd;
    }
    .upg-badge.wpn {
      border-color: #f59e0b;
      background: #451a03;
      color: #fde68a;
    }

    .viewport {
      position: relative;
      width: 100%;
      flex: 1 1 0%;
      min-height: 0;
      background: #050811;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    canvas#gameCanvas {
      width: 100%;
      height: 100%;
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      display: block;
      image-rendering: pixelated;
    }

    .overlay {
      position: absolute;
      inset: 0;
      background: rgba(5, 8, 18, 0.92);
      backdrop-filter: blur(4px);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 14px;
      text-align: center;
      z-index: 30;
    }
    .title-badge {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.12em;
      color: #38bdf8;
      margin-bottom: 3px;
    }
    .main-title {
      font-size: 24px;
      font-weight: 900;
      letter-spacing: -0.02em;
      margin: 0 0 4px 0;
      color: #ffffff;
    }
    .main-title span {
      color: var(--accent-green);
    }
    .sub-desc {
      font-size: 11.5px;
      color: #cbd5e1;
      margin: 0 0 10px 0;
      max-width: 360px;
      line-height: 1.4;
    }

    .hero-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      width: 100%;
      max-width: 1100px;
      margin-bottom: 12px;
    }
    @media (max-width: 768px) {
      .hero-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }
    .hero-card {
      position: relative;
      background: #0f172a;
      border: 1.5px solid #263349;
      border-radius: 11px;
      padding: 7px 8px;
      display: flex;
      align-items: center;
      gap: 8px;
      text-align: left;
      cursor: pointer;
      transition: transform 0.1s, border-color 0.12s, background 0.12s;
    }
    .hero-card:hover {
      border-color: #475569;
    }
    .hero-card.selected {
      background: #0d233a;
      border-color: #38bdf8;
      box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 6px 16px rgba(2, 132, 199, 0.22);
    }
    .hero-preview {
      width: 42px;
      height: 42px;
      flex-shrink: 0;
      background: #070b14;
      border-radius: 9px;
      border: 1px solid #1e293b;
    }
    .hero-info {
      min-width: 0;
      flex: 1;
    }
    .hero-name {
      font-size: 12px;
      font-weight: 900;
      color: #f8fafc;
      line-height: 1.15;
    }
    .hero-tool {
      font-size: 10px;
      font-weight: 700;
      color: #38bdf8;
      margin-top: 1px;
    }
    .hero-trait {
      font-size: 9.5px;
      color: #94a3b8;
      margin-top: 2px;
      line-height: 1.2;
    }

    .land-select-row {
      display: flex;
      align-items: center;
      gap: 5px;
      margin-bottom: 11px;
      font-size: 11px;
    }
    .land-chip {
      padding: 4px 8px;
      border-radius: 7px;
      background: #1e293b;
      border: 1px solid #334155;
      color: #cbd5e1;
      font-size: 10.5px;
      font-weight: 800;
      cursor: pointer;
    }
    .land-chip.active {
      background: #064e3b;
      border-color: #34d399;
      color: #a7f3d0;
    }

    .cta-btn {
      padding: 11px 26px;
      border-radius: 12px;
      border: none;
      background: #10b981;
      color: #022c22;
      font-size: 13.5px;
      font-weight: 900;
      letter-spacing: 0.02em;
      cursor: pointer;
      box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
      transition: transform 0.07s, filter 0.12s;
    }
    .cta-btn:hover { filter: brightness(1.08); }
    .cta-btn:active { transform: scale(0.95) translateY(1px); }
    .cta-btn.amber {
      background: #fbbf24;
      color: #1e1b04;
      box-shadow: 0 6px 20px rgba(251, 191, 36, 0.3);
    }

    .hint-line {
      margin-top: 8px;
      font-size: 10.5px;
      color: #94a3b8;
      font-family: ui-monospace, monospace;
    }

    .pad-footer {
      background: #0b1120;
      border-top: 1.5px solid #1e293b;
      padding: 8px 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 20;
      flex-shrink: 0;
    }
    .pc-key-guide {
      width: 100%;
      max-width: 1020px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      font-size: 11.5px;
    }
    .key-pill-group {
      display: flex;
      align-items: center;
      gap: 6px;
      background: #070b14;
      padding: 4px 10px;
      border-radius: 8px;
      border: 1px solid #1e293b;
    }
    .key-pill-group.sys {
      background: transparent;
      border: none;
      padding: 0;
    }
    .p-badge {
      font-size: 10px;
      font-weight: 900;
      padding: 2px 6px;
      border-radius: 4px;
    }
    .p-badge.p1 {
      background: #065f46;
      color: #34d399;
    }
    .p-badge.p2 {
      background: #78350f;
      color: #fde047;
    }
    .k-tag {
      color: #cbd5e1;
      font-size: 11px;
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    kbd {
      background: #1e293b;
      border: 1px solid #475569;
      border-bottom: 2px solid #0f172a;
      border-radius: 4px;
      padding: 1px 5px;
      font-family: ui-monospace, monospace;
      font-size: 10px;
      font-weight: 800;
      color: #f8fafc;
      box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    }
    .dpad-group, .act-group {
      display: flex;
      align-items: center;
      gap: 7px;
    }
    .dpad-group {
      touch-action: none;
      user-select: none;
      -webkit-user-select: none;
      background: #090e1a;
      padding: 3px;
      border-radius: 16px;
      border: 1px solid #1e293b;
    }
    .pad-btn {
      height: 56px;
      border-radius: 13px;
      border: 1.5px solid #334155;
      border-bottom: 5px solid #020617;
      background: #1e293b;
      color: #f8fafc;
      font-weight: 900;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: transform 0.04s, filter 0.08s, background 0.08s;
      -webkit-tap-highlight-color: transparent;
    }
    .pad-btn.dir {
      width: 58px;
      height: 52px;
      font-size: 19px;
      background: #131d31;
      border-color: #2a3a54;
      border-bottom-color: #080d16;
    }
    .pad-btn.sub {
      width: 58px;
      background: #78350f;
      border-color: #f59e0b;
      border-bottom-color: #451a03;
      color: #fef3c7;
    }
    .pad-btn.atk {
      width: 68px;
      background: #0284c7;
      border-color: #38bdf8;
      border-bottom-color: #0c4a6e;
      color: #f0f9ff;
    }
    .pad-btn.jmp {
      width: 70px;
      background: #059669;
      border-color: #34d399;
      border-bottom-color: #064e3b;
      color: #ecfdf5;
    }
    .pad-btn:active, .pad-btn.pressed {
      transform: scale(0.92) translateY(3px);
      filter: brightness(1.25);
      border-bottom-width: 2px;
    }
    .pad-btn.dir.pressed {
      background: #0369a1;
      border-color: #38bdf8;
      color: #ffffff;
      box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
    }
    .pad-main-lbl {
      font-size: 13px;
      font-weight: 900;
      line-height: 1;
    }
    .pad-sub-lbl {
      font-size: 8.5px;
      font-weight: 700;
      opacity: 0.85;
      margin-top: 3px;
    }

    .stat-box {
      width: 100%;
      max-width: 290px;
      background: #0f172a;
      border: 1px solid #1e293b;
      border-radius: 12px;
      padding: 12px;
      margin-bottom: 14px;
      font-size: 12px;
    }
    .stat-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 5px 0;
    }
    .stat-row + .stat-row {
      border-top: 1px solid #1e293b;
    }
    .guide-card {
      width: 100%;
      max-width: 380px;
      background: #0f172a;
      border: 1px solid #334155;
      border-radius: 14px;
      padding: 14px;
      text-align: left;
      font-size: 11.5px;
      line-height: 1.5;
      color: #cbd5e1;
    }

    /* =========================================================================
       레벨 에디터 & 맵 매니저 & 시네마틱 도트 아트 스플래시 스타일
       ========================================================================= */
    .icon-btn.edit-on {
      background: #7c2d12 !important;
      border-color: #f97316 !important;
      color: #ffedd5 !important;
      box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
    }
    .editor-toolbar {
      position: absolute;
      top: 4px;
      left: 6px;
      right: 6px;
      background: rgba(11, 17, 32, 0.94);
      border: 1px solid #334155;
      border-radius: 10px;
      padding: 5px 8px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 5px;
      z-index: 25;
      backdrop-filter: blur(4px);
    }
    .edit-tools-group {
      display: flex;
      align-items: center;
      gap: 4px;
      flex-wrap: wrap;
    }
    .tool-chip {
      height: 25px;
      padding: 0 6px;
      border-radius: 6px;
      background: #1e293b;
      border: 1px solid #334155;
      color: #cbd5e1;
      font-size: 10px;
      font-weight: 800;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .tool-chip.active {
      background: #0284c7;
      border-color: #38bdf8;
      color: #ffffff;
      box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
    }
    .tool-chip.sub-act {
      background: #064e3b;
      border-color: #10b981;
      color: #a7f3d0;
    }
    .tool-chip.sub-warn {
      background: #451a03;
      border-color: #f59e0b;
      color: #fde68a;
    }
    .edit-modal {
      position: absolute;
      inset: 8px;
      background: rgba(11, 17, 32, 0.96);
      border: 1.5px solid #38bdf8;
      border-radius: 12px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      z-index: 35;
      color: #f8fafc;
      box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    }
    .edit-modal textarea {
      width: 100%;
      flex: 1;
      background: #070b14;
      border: 1px solid #334155;
      border-radius: 8px;
      color: #7dd3fc;
      font-family: monospace;
      font-size: 10px;
      padding: 8px;
      resize: none;
      margin: 8px 0;
      white-space: pre;
    }


    /* =========================================================================
       모바일 액션 버튼 전용 컬러 리플(물결 파동) 이펙트 애니메이션
       ========================================================================= */
    .pad-btn {
      position: relative;
      overflow: visible !important;
    }
    .btn-ripple {
      position: absolute;
      inset: -6px;
      border-radius: 18px;
      border: 3.5px solid currentColor;
      pointer-events: none;
      opacity: 0.95;
      transform: scale(0.92);
      animation: btnRippleAnim 0.42s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
      z-index: 10;
    }
    @keyframes btnRippleAnim {
      0% {
        transform: scale(0.92);
        opacity: 0.95;
        box-shadow: 0 0 0 0 currentColor;
      }
      50% {
        opacity: 0.65;
        box-shadow: 0 0 16px 4px currentColor;
      }
      100% {
        transform: scale(1.42);
        opacity: 0;
        box-shadow: 0 0 28px 8px currentColor;
      }
    }


    /* =========================================================================
       4~6인 P2P 멀티플레이어 대기실(Lobby) & 네트워크 인디케이터 스타일
       ========================================================================= */
    .net-pill {
      padding: 3px 6px;
      border-radius: 6px;
      background: #14532d;
      border: 1px solid #22c55e;
      color: #bbf7d0;
      font-family: ui-monospace, monospace;
      font-size: 10px;
      font-weight: 800;
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .net-pill.client {
      background: #1e3a8a;
      border-color: #3b82f6;
      color: #bfdbfe;
    }
    .screen-panel {
      position: absolute;
      inset: 0;
      background: #050811;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      z-index: 50;
      color: #f8fafc;
      overflow-y: auto;
      box-sizing: border-box;
    }
    .screen-header {
      width: 100%;
      max-width: 1100px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid #1e293b;
      padding-bottom: 10px;
      margin-bottom: 8px;
    }
    .screen-body {
      width: 100%;
      max-width: 1100px;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 14px;
      justify-content: center;
    }
    .screen-footer {
      width: 100%;
      max-width: 1100px;
      padding-top: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .hero-select-row {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 6px;
      width: 100%;
    }
    .hero-btn-chip {
      padding: 8px 4px;
      border-radius: 10px;
      border: 1.5px solid #263349;
      background: #0f172a;
      color: #94a3b8;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      transition: all 0.1s;
    }
    .hero-btn-chip.selected {
      border-color: #38bdf8;
      background: #0d233a;
      color: #ffffff;
      box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    }
    .lobby-players-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      background: #070b14;
      border: 1px solid #1e293b;
      border-radius: 10px;
      padding: 8px;
      max-height: 180px;
      overflow-y: auto;
    }
    .lobby-player-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 5px 8px;
      border-radius: 6px;
      background: #0f172a;
      border: 1px solid #334155;
      font-size: 11px;
    }
    .lobby-player-row.me {
      border-color: #38bdf8;
      background: #0d233a;
    }
    .p-tag {
      padding: 1px 5px;
      border-radius: 4px;
      font-weight: 900;
      font-size: 9px;
      color: #050811;
    }
    .mode-select-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      width: 100%;
      max-width: 360px;
      margin-top: 6px;
    }
    .mode-card-btn {
      padding: 11px 14px;
      border-radius: 12px;
      border: 1.5px solid #334155;
      background: #0f172a;
      color: #f8fafc;
      font-size: 13px;
      font-weight: 800;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      transition: all 0.1s;
    }
    .mode-card-btn:hover {
      border-color: #38bdf8;
      background: #1e293b;
    }
    .mode-card-btn.primary {
      border-color: #10b981;
      background: #064e3b;
      color: #a7f3d0;
    }
    .mode-card-btn.host {
      border-color: #38bdf8;
      background: #0c4a6e;
      color: #bae6fd;
    }
    .mode-card-btn.join {
      border-color: #f59e0b;
      background: #78350f;
      color: #fef3c7;
    }

