:root {
      --primary: #00b4db;
      --primary-dark: #00508f;
      --pink: #ff5e97;
      --purple: #8b5cf6;
      --gold: #ffc837;
      --text: #ffffff;
      --card-bg: rgba(14, 8, 24, 0.96);
    }
    * {
      box-sizing: border-box;
      user-select: none;
      -webkit-user-select: none;
      margin: 0;
      padding: 0;
      touch-action: manipulation;
    }
    body {
      background: #080b12;
      color: var(--text);
      font-family: 'Fredoka', 'Nunito', sans-serif;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
      width: 100vw;
      overflow: hidden;
      background: radial-gradient(circle at center, #162035 0%, #050811 100%);
    }
    #game-wrapper {
      position: relative;
      width: 100vw;
      height: 100vh;
      background: #150814;
      overflow: hidden;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    @media (min-width: 900px) and (orientation: landscape) {
      #game-wrapper {
        max-width: 840px;
        max-height: 90vh;
        border-radius: 24px;
        box-shadow: 0 20px 50px rgba(0,0,0,0.85), 0 0 0 3px rgba(0, 180, 219, 0.25);
      }
    }
    canvas {
      display: block;
      width: 100%;
      height: 100%;
      touch-action: none;
    }
    
    /* UI Overlays */
    .ui-layer {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      pointer-events: none;
      z-index: 10;
    }
    .modal-screen {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: var(--card-bg);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 16px;
      text-align: center;
      z-index: 50;
      pointer-events: auto;
      transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }
    .modal-screen.hidden {
      display: none !important;
      opacity: 0;
      pointer-events: none !important;
      transform: scale(0.92);
    }

    /* Text-Only Brand Header */
    .brand-header-text {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-bottom: 8px;
    }
    .brand-title-onfocus {
      font-family: 'Nunito', 'Fredoka', sans-serif;
      font-size: 38px;
      font-weight: 900;
      letter-spacing: -0.5px;
      background: linear-gradient(135deg, #00f2fe 0%, #38bdf8 50%, #0088cc 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      text-shadow: 0 4px 15px rgba(0, 180, 219, 0.4);
      line-height: 1;
    }
    .brand-subtitle-onmedical {
      font-family: 'Nunito', sans-serif;
      font-size: 13px;
      font-weight: 800;
      color: #94a3b8;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      margin-top: 4px;
    }
    .brand-subtitle-onmedical span {
      color: #00f2fe;
    }

    /* Welcome Onboarding Modal */
    .welcome-card {
      width: 92%;
      max-width: 380px;
      background: rgba(18, 9, 28, 0.95);
      border: 2px solid #00f2fe;
      border-radius: 24px;
      padding: 22px 18px;
      box-shadow: 0 10px 40px rgba(0,0,0,0.8), 0 0 25px rgba(0, 242, 254, 0.3);
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .title-selector-row {
      display: flex;
      gap: 12px;
      margin: 12px 0 8px;
      width: 100%;
      justify-content: center;
    }
    .title-btn {
      flex: 1;
      padding: 10px 16px;
      border-radius: 16px;
      border: 2px solid rgba(255, 255, 255, 0.25);
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
      font-family: inherit;
      font-size: 16px;
      font-weight: 800;
      cursor: pointer;
      transition: all 0.2s ease;
      touch-action: manipulation;
      pointer-events: auto;
    }
    .title-btn.active {
      background: linear-gradient(135deg, #00b4db, #00508f);
      border-color: #00f2fe;
      box-shadow: 0 0 15px rgba(0, 242, 254, 0.5);
      transform: scale(1.04);
    }

    /* HUD Top Bar */
    .hud-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 14px 6px;
      pointer-events: auto;
      gap: 6px;
    }
    .hud-stats-left {
      display: flex;
      gap: 6px;
    }
    .hud-badge {
      background: rgba(18, 9, 28, 0.85);
      border: 2px solid rgba(255, 255, 255, 0.22);
      border-radius: 20px;
      padding: 5px 12px;
      display: flex;
      align-items: center;
      gap: 5px;
      font-weight: 800;
      font-size: 13.5px;
      box-shadow: 0 4px 15px rgba(0,0,0,0.5);
      backdrop-filter: blur(6px);
      color: #ffffff;
      white-space: nowrap;
    }
    .hud-actions {
      display: flex;
      gap: 6px;
    }
    .hud-btn {
      width: 38px;
      height: 38px;
      background: rgba(255, 255, 255, 0.18);
      border: 2px solid rgba(255, 255, 255, 0.35);
      border-radius: 50%;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      cursor: pointer;
      pointer-events: auto;
      touch-action: manipulation;
      transition: transform 0.1s, background 0.2s;
    }
    .hud-btn:active {
      transform: scale(0.9);
      background: rgba(255, 255, 255, 0.35);
    }

    /* Distance to Vocal Cords Progress Bar */
    .progress-bar-wrap {
      position: absolute;
      top: 64px;
      left: 14px;
      right: 14px;
      height: 14px;
      background: rgba(0, 0, 0, 0.65);
      border-radius: 12px;
      border: 2px solid rgba(255, 255, 255, 0.25);
      overflow: visible;
      pointer-events: none;
    }
    .progress-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #ff5e97, #00f2fe, #ffc837);
      border-radius: 8px;
      transition: width 0.12s linear;
      box-shadow: 0 0 12px rgba(0, 242, 254, 0.7);
    }
    .progress-device-marker {
      position: absolute;
      top: -12px;
      left: 0%;
      transform: translateX(-50%);
      font-size: 18px;
      filter: drop-shadow(0 2px 5px rgba(0,0,0,0.8));
      transition: left 0.12s linear;
    }
    .progress-goal-marker {
      position: absolute;
      right: -10px;
      top: -9px;
      display: flex;
      align-items: center;
      justify-content: center;
      animation: pulseGoal 1.2s infinite ease-in-out;
    }
    @keyframes pulseGoal {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.25); }
    }

    /* Big Level Banner at Start of Level */
    .level-intro-card {
      position: absolute;
      top: 24%;
      left: 50%;
      transform: translateX(-50%);
      width: 90%;
      max-width: 390px;
      background: rgba(14, 8, 22, 0.94);
      border: 2px solid rgba(0, 242, 254, 0.4);
      border-radius: 22px;
      padding: 18px 16px;
      text-align: center;
      box-shadow: 0 15px 35px rgba(0,0,0,0.7), 0 0 25px rgba(0, 242, 254, 0.25);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      z-index: 20;
      pointer-events: none;
      animation: popIn 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    }
    @keyframes popIn {
      from { transform: translate(-50%, -15px) scale(0.9); opacity: 0; }
      to { transform: translate(-50%, 0) scale(1); opacity: 1; }
    }
    .level-intro-badge {
      display: inline-block;
      padding: 4px 12px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: 1px;
      text-transform: uppercase;
      margin-bottom: 8px;
      background: rgba(0, 180, 219, 0.15);
      border: 1px solid rgba(0, 242, 254, 0.3);
      color: #00f2fe;
    }
    .level-intro-title {
      font-size: 19px;
      font-weight: 800;
      line-height: 1.25;
      margin-bottom: 6px;
      color: #ffffff;
      text-shadow: 0 2px 10px rgba(0,0,0,0.6);
    }
    .level-intro-desc {
      font-size: 12.5px;
      color: #cbd5e1;
      margin-bottom: 12px;
    }
    .tap-hint-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: linear-gradient(135deg, #00b4db, #ff5e97);
      color: #fff;
      font-size: 13.5px;
      font-weight: 800;
      padding: 9px 18px;
      border-radius: 25px;
      box-shadow: 0 4px 15px rgba(255, 94, 151, 0.4);
      animation: pulseBtn 1s infinite alternate ease-in-out;
    }
    @keyframes pulseBtn {
      from { transform: scale(0.98); }
      to { transform: scale(1.05); }
    }

    /* Extra Large Rank Congratulation Badge */
    .rank-congrats-wrap {
      margin: 8px 0 10px;
      width: 100%;
      text-align: center;
    }
    .rank-congrats-text {
      font-size: 14px;
      font-weight: 800;
      color: #fef08a;
      text-transform: uppercase;
      letter-spacing: 1px;
      text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    }
    .rank-pill-badge-large {
      display: inline-block;
      margin-top: 6px;
      padding: 10px 22px;
      background: linear-gradient(135deg, #ffe066 0%, #ffc837 50%, #ff8008 100%);
      color: #1a0800;
      font-size: 22px;
      font-weight: 900;
      border-radius: 24px;
      border: 2.5px solid #ffffff;
      box-shadow: 0 6px 20px rgba(255, 200, 55, 0.6), 0 0 15px rgba(255, 200, 55, 0.4);
      letter-spacing: 0.8px;
      animation: rankPulse 1.2s infinite alternate ease-in-out;
    }
    @keyframes rankPulse {
      from { transform: scale(0.98); }
      to { transform: scale(1.05); }
    }

    /* Airway Tip Box in Game Over Screen (DAS Guidelines) */
    .tip-box-das {
      background: rgba(0, 180, 219, 0.12);
      border: 1.5px solid #00f2fe;
      border-radius: 18px;
      padding: 12px 14px;
      margin: 10px 0 12px;
      width: 94%;
      text-align: left;
      box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
    }
    .tip-title-das {
      font-size: 13.5px;
      font-weight: 800;
      color: #fef08a;
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 6px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .tip-content-das {
      font-size: 13px;
      line-height: 1.45;
      color: #f8fafc;
      font-weight: 600;
    }
    .tip-source-das {
      font-size: 11px;
      color: #94a3b8;
      margin-top: 6px;
      font-style: italic;
      border-top: 1px solid rgba(255,255,255,0.15);
      padding-top: 4px;
    }

    /* Typography */
    h1.title {
      font-size: 28px;
      font-weight: 800;
      line-height: 1.1;
      margin-bottom: 2px;
      background: linear-gradient(135deg, #00f2fe 0%, #38bdf8 40%, #ff5e97 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      text-shadow: 0 4px 15px rgba(0,0,0,0.5);
    }
    .subtitle {
      font-size: 13.5px;
      color: #cbd5e1;
      margin-bottom: 12px;
      font-weight: 600;
    }

    /* Buttons */
    .btn {
      background: linear-gradient(180deg, #00b4db 0%, #0083b0 100%);
      color: white;
      border: none;
      border-radius: 28px;
      padding: 12px 22px;
      font-size: 15.5px;
      font-weight: 800;
      font-family: inherit;
      cursor: pointer;
      box-shadow: 0 5px 0 #005b7a, 0 8px 18px rgba(0, 180, 219, 0.4);
      transition: transform 0.1s, box-shadow 0.1s;
      width: 88%;
      max-width: 290px;
      margin: 5px 0;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      touch-action: manipulation;
      pointer-events: auto;
    }
    .btn:active {
      transform: translateY(4px);
      box-shadow: 0 1px 0 #005b7a, 0 4px 8px rgba(0, 180, 219, 0.4);
    }
    .btn-gold {
      background: linear-gradient(180deg, #ffc837 0%, #ff8008 100%);
      box-shadow: 0 5px 0 #b35900, 0 8px 18px rgba(255, 165, 0, 0.4);
      color: #2b1100;
    }
    .btn-gold:active {
      box-shadow: 0 1px 0 #b35900;
    }
    .btn-pink {
      background: linear-gradient(180deg, #ff5e97 0%, #e63946 100%);
      box-shadow: 0 5px 0 #9d1b28, 0 8px 18px rgba(255, 94, 151, 0.4);
    }
    .btn-pink:active {
      box-shadow: 0 1px 0 #9d1b28;
    }
    .btn-purple {
      background: linear-gradient(180deg, #a855f7 0%, #7e22ce 100%);
      box-shadow: 0 5px 0 #581c87, 0 8px 18px rgba(168, 85, 247, 0.4);
    }
    .btn-purple:active {
      box-shadow: 0 1px 0 #581c87;
    }
    .btn-secondary {
      background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
      border: 1.5px solid rgba(255, 255, 255, 0.2);
      box-shadow: 0 5px 0 #020617, 0 6px 14px rgba(0,0,0,0.3);
    }
    .btn-secondary:active {
      box-shadow: 0 1px 0 #020617;
    }
    .btn-share {
      background: linear-gradient(180deg, #10b981 0%, #059669 100%);
      box-shadow: 0 5px 0 #047857, 0 8px 18px rgba(16, 185, 129, 0.4);
    }
    .btn-share:active {
      box-shadow: 0 1px 0 #047857;
    }

    /* Scrollable Level Selector Grid */
    #level-screen {
      justify-content: flex-start;
      padding: 22px 14px 14px;
      overflow: hidden;
    }

    .level-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      width: 100%;
      flex: 1 1 auto;
      min-height: 0;
      max-height: 60vh;
      overflow-y: auto !important;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch !important;
      touch-action: pan-y !important;
      overscroll-behavior-y: contain;
      padding: 4px 6px 36px;
      margin: 6px 0 8px;
    }
    .level-card {
      background: rgba(255, 255, 255, 0.06);
      border: 2px solid rgba(255, 255, 255, 0.16);
      border-radius: 18px;
      padding: 12px 14px;
      display: flex;
      align-items: center;
      gap: 12px;
      text-align: left;
      cursor: pointer;
      transition: transform 0.15s, border-color 0.2s, background 0.2s;
      touch-action: pan-y !important;
      flex-shrink: 0;
      pointer-events: auto;
    }
    .level-card:hover, .level-card:active {
      transform: scale(1.02);
      border-color: #00f2fe;
      background: rgba(0, 242, 254, 0.1);
    }
    .level-card.locked {
      opacity: 0.45;
      filter: grayscale(0.8);
      cursor: not-allowed;
    }
    .level-card.infinite-locked {
      background: rgba(0, 0, 0, 0.7);
      border: 2px dashed rgba(255, 200, 55, 0.35);
      opacity: 0.75;
      cursor: not-allowed;
      justify-content: center;
      padding: 15px 12px;
    }
    .level-card.infinite-unlocked {
      border: 2px solid #ffc837;
      background: rgba(255, 200, 55, 0.14);
      box-shadow: 0 0 16px rgba(255, 200, 55, 0.35);
      animation: glowGold 1.5s infinite alternate ease-in-out;
    }
    @keyframes glowGold {
      from { box-shadow: 0 0 10px rgba(255, 200, 55, 0.2); }
      to { box-shadow: 0 0 20px rgba(255, 200, 55, 0.55); }
    }
    .level-card-icon {
      width: 42px;
      height: 42px;
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      font-size: 19px;
      flex-shrink: 0;
      color: #fff;
      box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    .level-card-details {
      flex: 1;
      min-width: 0;
    }
    .level-card-name {
      font-weight: 800;
      font-size: 13.5px;
      line-height: 1.25;
      color: #f8fafc;
    }
    .level-card-diff {
      font-size: 11.5px;
      color: #fbbf24;
      font-weight: 700;
      margin-top: 3px;
    }

    /* Clean Dark Glass Cards */
    .victory-container, .records-container {
      width: 100%;
      max-height: 84vh;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 2px 4px;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }
    .clean-box {
      background: rgba(0, 0, 0, 0.5);
      border: 2px solid rgba(0, 242, 254, 0.4);
      border-radius: 20px;
      padding: 12px 16px;
      margin: 6px 0;
      width: 94%;
      box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    }
    .score-value {
      font-size: 34px;
      font-weight: 800;
      color: #ffc837;
      text-shadow: 0 2px 12px rgba(255, 200, 55, 0.5);
    }
    .score-label {
      font-size: 11.5px;
      color: #94a3b8;
      text-transform: uppercase;
      letter-spacing: 1px;
      font-weight: 700;
    }
    .device-pill {
      display: inline-block;
      padding: 4px 12px;
      border-radius: 12px;
      background: rgba(0, 242, 254, 0.18);
      border: 1px solid #00f2fe;
      font-size: 11.5px;
      font-weight: 700;
      color: #e0f2fe;
      margin-top: 6px;
    }

    /* Records List Table */
    .records-table {
      width: 100%;
      border-collapse: collapse;
      margin: 8px 0;
      font-size: 12.5px;
      text-align: left;
    }
    .records-table th {
      color: #38bdf8;
      padding: 6px 4px;
      border-bottom: 1.5px solid rgba(0, 242, 254, 0.3);
      font-weight: 800;
    }
    .records-table td {
      padding: 8px 4px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      color: #e2e8f0;
      font-weight: 700;
    }

    /* Name Input Group */
    .name-input-group {
      width: 94%;
      margin: 6px 0;
      text-align: left;
    }
    .name-input-label {
      font-size: 11.5px;
      font-weight: 700;
      color: #38bdf8;
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .name-input {
      width: 100%;
      background: rgba(0, 0, 0, 0.6);
      border: 2px solid #00b4db;
      border-radius: 14px;
      padding: 9px 12px;
      color: #ffffff;
      font-family: inherit;
      font-size: 14px;
      font-weight: 700;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .name-input:focus {
      border-color: #ff5e97;
      box-shadow: 0 0 12px rgba(255, 94, 151, 0.5);
    }

    /* Social Share Buttons Grid */
    .share-buttons-row {
      display: flex;
      gap: 8px;
      width: 94%;
      margin-top: 4px;
      margin-bottom: 6px;
    }
    .share-icon-btn {
      flex: 1;
      background: rgba(255, 255, 255, 0.1);
      border: 1.5px solid rgba(255, 255, 255, 0.25);
      border-radius: 14px;
      padding: 9px 6px;
      color: #fff;
      font-family: inherit;
      font-size: 12.5px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      cursor: pointer;
      touch-action: manipulation;
      transition: transform 0.1s, background 0.2s;
      pointer-events: auto;
    }
    .share-icon-btn:active {
      transform: scale(0.95);
      background: rgba(255, 255, 255, 0.25);
    }

    /* Floating Toast Notification */
    .toast {
      position: absolute;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      background: #10b981;
      color: #fff;
      padding: 10px 20px;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 800;
      box-shadow: 0 5px 20px rgba(0,0,0,0.5);
      z-index: 99;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease;
    }
    .toast.show {
      opacity: 1;
    }

    /* In-game Floating Score popup for Infinite Mode Vocal Cords */
    .floating-text-banner {
      position: absolute;
      top: 18%;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #ffc837, #ff5e97);
      color: #1a0826;
      font-size: 16px;
      font-weight: 900;
      padding: 8px 18px;
      border-radius: 25px;
      box-shadow: 0 4px 20px rgba(255, 200, 55, 0.6);
      pointer-events: none;
      animation: floatUpFade 1.2s ease-out forwards;
      z-index: 30;
      white-space: nowrap;
    }
    @keyframes floatUpFade {
      0% { opacity: 0; transform: translate(-50%, 20px) scale(0.8); }
      20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
      80% { opacity: 1; transform: translate(-50%, -10px) scale(1); }
      100% { opacity: 0; transform: translate(-50%, -30px) scale(0.9); }
    }

    /* Custom scrollbars */
    .level-list::-webkit-scrollbar, .victory-container::-webkit-scrollbar, .records-container::-webkit-scrollbar, .modal-screen::-webkit-scrollbar {
      width: 5px;
    }
    .level-list::-webkit-scrollbar-thumb, .victory-container::-webkit-scrollbar-thumb, .records-container::-webkit-scrollbar-thumb, .modal-screen::-webkit-scrollbar-thumb {
      background: rgba(0, 242, 254, 0.35);
      border-radius: 10px;
    }
