@import url('https://fonts.googleapis.com/css2?family=VT323&family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');
    
    * { margin: 0; padding: 0; box-sizing: border-box; }
    
    html, body {
      width: 100%;
      height: 100%;
    }

    body {
      margin: 0;
      overflow: hidden;
      background: #0a0a0a;
      font-family: 'VT323', monospace;
      color: #00ff00;
    }
    
    canvas { 
      display: block;
      /* NOTE: position:fixed removed — was breaking mini-game canvases (ShellDefense, BeatBop, fishing, sewerrace).
         Full-screen canvases should set position:fixed via an ID-specific rule or inline style instead. */
      outline: none !important;
      -webkit-tap-highlight-color: transparent;
    }
    
    /* FIX: Ensure focused canvas doesn't show browser default focus ring */
    canvas:focus,
    canvas:focus-visible {
      outline: none !important;
      box-shadow: none !important;
    }

/* Tooltips (simple, accessible tooltip using data-tooltip attribute) */
[data-tooltip] { position: relative; }
[data-tooltip]:focus { outline: none; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  background: rgba(0,0,0,0.92);
  color: #e8f9ff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 20000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}
    
    .hud {
      position: absolute;
      pointer-events: none;
      color: #00ff00;
      z-index: 10;
      text-shadow: 0 0 10px #00ff00;
    }
    
    #intro-screen {
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, #000e00 0%, #001a00 40%, #002200 70%, #001100 100%);
      display: var(--intro-display, flex);
      flex-direction: column;
      justify-content: center;
      align-items: center;
      z-index: 1000;
      text-align: center;
      cursor: pointer;
    }
    /* Scanline overlay */
    #intro-screen::before {
      content: '';
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(
        0deg,
        rgba(0,255,0,0.025) 0px,
        transparent 2px,
        transparent 4px
      );
      pointer-events: none;
      z-index: 1;
    }
    #intro-screen > * { position: relative; z-index: 2; }
    
    .title {
      font-family: 'Orbitron', monospace;
      font-size: 5rem;
      font-weight: 900;
      color: #00ff00;
      text-shadow: 
        0 0 20px #00ff00,
        0 0 40px #00ff00,
        0 0 60px #00ff00,
        0 0 80px #00ff00;
      margin-bottom: 2rem;
      animation: glow 2s ease-in-out infinite;
      letter-spacing: 0.3rem;
    }
    
    @keyframes glow {
      0%, 100% { text-shadow: 0 0 20px #00ff00, 0 0 40px #00ff00; }
      50% { text-shadow: 0 0 40px #00ff00, 0 0 80px #00ff00, 0 0 120px #00ff00; }
    }
    
    .subtitle {
      font-size: 2rem;
      color: #00cc00;
      text-shadow: 0 0 10px #00cc00;
      margin-bottom: 3rem;
      font-family: 'VT323', monospace;
    }
    
    .turtle-icon {
      font-size: 6rem;
      margin-bottom: 2rem;
      animation: float 3s ease-in-out infinite;
    }
    
    @keyframes float {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-20px); }
    }
    
    .start-text {
      font-size: 2.5rem;
      color: #00ff00;
      animation: blink 1.5s ease-in-out infinite;
      font-family: 'VT323', monospace;
    }
    
    @keyframes blink {
      0%, 50%, 100% { opacity: 1; }
      25%, 75% { opacity: 0.3; }
    }
    
    /* Username Entry Screen */
    #username-screen {
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, #001a00 0%, #003300 50%, #001100 100%);
      display: none;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      z-index: 1000;
      text-align: center;
      animation: scanlines 8s linear infinite;
    }
    
    #username-screen::before {
      content: '';
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(
        0deg,
        rgba(0,255,0,0.03) 0px,
        transparent 2px,
        transparent 4px
      );
      pointer-events: none;
    }
    
    .username-container {
      background: rgba(0, 0, 0, 0.7);
      border: 3px solid #00ff00;
      border-radius: 15px;
      padding: 40px;
      max-width: 500px;
      box-shadow: 
        0 0 40px rgba(0, 255, 0, 0.5),
        inset 0 0 20px rgba(0, 255, 0, 0.1);
    }
    
    .username-title {
      font-family: 'Orbitron', monospace;
      font-size: 2.5rem;
      font-weight: 900;
      color: #00ff00;
      text-shadow: 
        0 0 20px #00ff00,
        0 0 40px #00ff00;
      margin-bottom: 1rem;
      letter-spacing: 0.2rem;
    }
    
    .username-subtitle {
      font-size: 1.3rem;
      color: #00cc00;
      margin-bottom: 2rem;
      font-family: 'VT323', monospace;
    }
    
    #username-input {
      width: 100%;
      padding: 15px 20px;
      font-size: 1.5rem;
      font-family: 'VT323', monospace;
      background: rgba(0, 0, 0, 0.8);
      border: 2px solid #00ff00;
      border-radius: 8px;
      color: #00ff00;
      text-align: center;
      margin-bottom: 1rem;
      text-shadow: 0 0 10px #00ff00;
      transition: all 0.3s ease;
    }
    
    #username-input:focus {
      outline: none;
      border-color: #00ff00;
      box-shadow: 
        0 0 20px rgba(0, 255, 0, 0.5),
        inset 0 0 10px rgba(0, 255, 0, 0.1);
    }
    
    #username-input::placeholder {
      color: rgba(0, 255, 0, 0.3);
    }
    
    .username-error {
      color: #ff0000;
      font-size: 1.1rem;
      min-height: 25px;
      margin-bottom: 1rem;
      text-shadow: 0 0 10px #ff0000;
    }
    
    #confirm-username-btn {
      width: 100%;
      padding: 15px 30px;
      font-size: 1.5rem;
      font-family: 'VT323', monospace;
      font-weight: bold;
      background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
      color: #000;
      border: 3px solid #00ff00;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
      text-transform: uppercase;
      letter-spacing: 0.1rem;
    }
    
    #confirm-username-btn:hover:not(:disabled) {
      background: linear-gradient(135deg, #00ff00 0%, #00ff00 100%);
      box-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
      transform: translateY(-2px);
    }
    
    #confirm-username-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
      background: rgba(0, 255, 0, 0.2);
    }
    
    .player-name-display {
      color: #00ff00;
      font-weight: bold;
      text-shadow: 0 0 10px #00ff00;
    }
    
    .crosshair {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 40px;
      height: 40px;
      transform: translate(-50%, -50%);
      opacity: 0;
      display: none;
      pointer-events: none;
      transition: opacity 0.3s;
    }
    
    .crosshair.active {
      display: block;
      opacity: 0.8;
    }
    
    .crosshair::before,
    .crosshair::after {
      content: '';
      position: absolute;
      background: #00ff00;
      box-shadow: 0 0 10px #00ff00;
    }
    
    .crosshair::before {
      width: 2px;
      height: 20px;
      left: 50%;
      top: 0;
      transform: translateX(-50%);
    }
    
    .crosshair::after {
      width: 20px;
      height: 2px;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
    }
    
    #location-display {
      top: 20px;
      left: 20px;
      font-size: 2rem;
      background: rgba(0,0,0,0.7);
      padding: 15px 25px;
      border: 2px solid #00ff00;
      border-radius: 10px;
      pointer-events: none;
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-width: 500px;
    }
    
    .location-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 30px;
    }
    
    #building-prompt {
      position: absolute;
      bottom: 100px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 2.5rem;
      background: rgba(0,0,0,0.9);
      padding: 20px 40px;
      border: 3px solid #00ff00;
      border-radius: 15px;
      text-align: center;
      display: none;
      animation: pulse-border 2s ease-in-out infinite;
      pointer-events: auto;
      cursor: pointer;
      z-index: 50;
    }
    
    #building-prompt:hover {
      background: rgba(0,255,0,0.2);
      transform: translateX(-50%) scale(1.05);
    }
    
    @keyframes pulse-border {
      0%, 100% { border-color: #00ff00; box-shadow: 0 0 20px #00ff00; }
      50% { border-color: #00cc00; box-shadow: 0 0 40px #00ff00; }
    }
    
    #instructions {
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 1.5rem;
      text-align: center;
      background: rgba(0,0,0,0.7);
      padding: 10px 20px;
      border-radius: 10px;
    }
    
    #fps-counter {
      top: 20px;
      right: 20px;
      font-size: 1.5rem;
      background: rgba(0,0,0,0.7);
      padding: 10px 15px;
      border-radius: 8px;
    }
    
    .building-info {
      position: absolute;
      bottom: 200px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(0,0,0,0.95);
      padding: 30px 50px;
      border: 3px solid #00ff00;
      border-radius: 20px;
      max-width: 600px;
      display: none;
      text-align: center;
      animation: slideUp 0.5s ease-out;
    }
    
    @keyframes slideUp {
      from { transform: translateX(-50%) translateY(50px); opacity: 0; }
      to { transform: translateX(-50%) translateY(0); opacity: 1; }
    }
    
    .building-info h2 {
      font-family: 'Orbitron', monospace;
      font-size: 2.5rem;
      margin-bottom: 15px;
      color: #00ff00;
      text-shadow: 0 0 20px #00ff00;
    }
    
    .building-info p {
      font-size: 1.8rem;
      color: #00cc00;
      line-height: 1.6;
    }
    
    .sewer-effect {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 5;
      opacity: 0.1;
      background: 
        repeating-linear-gradient(
          90deg,
          transparent 0px,
          rgba(0,255,0,0.05) 1px,
          transparent 2px
        );
    }
    
    .drip {
      position: absolute;
      width: 2px;
      height: 20px;
      background: linear-gradient(180deg, transparent, rgba(143, 216, 255, 0.95));
      animation: drip-fall 3s linear infinite;
      opacity: 0;
      display: none;
      filter: blur(0.25px);
    }
    
    .drip.active {
      display: block;
    }
    
    @keyframes drip-fall {
      0% { transform: translateY(-100vh); opacity: 0; }
      10% { opacity: 0.6; }
      100% { transform: translateY(100vh); opacity: 0; }
    }

    #weather-display {
      font-size: 1.5rem;
      background: transparent;
      padding: 0;
      border: none;
      border-radius: 0;
      position: static;
      text-align: right;
    }

    #time-display {
      font-size: 1.5rem;
      background: transparent;
      padding: 0;
      border: none;
      border-radius: 0;
      position: static;
      text-align: right;
    }

    #exit-button {
      position: absolute;
      top: 20px;
      right: 20px;
      font-size: 2rem;
      background: rgba(255,0,0,0.8);
      color: white;
      padding: 15px 30px;
      border: 3px solid #ff0000;
      border-radius: 10px;
      cursor: pointer;
      display: none;
      z-index: 100;
      font-family: 'VT323', monospace;
      text-shadow: 0 0 10px #ff0000;
      animation: pulse-red 2s ease-in-out infinite;
    }

    @keyframes pulse-red {
      0%, 100% { box-shadow: 0 0 20px #ff0000; }
      50% { box-shadow: 0 0 40px #ff0000; }
    }

    #exit-button:hover {
      background: rgba(255,0,0,1);
      transform: scale(1.05);
    }

    #sewer-return-button {
      position: absolute;
      top: 80px;
      right: 20px;
      font-size: 1.8rem;
      background: rgba(0,255,0,0.9);
      color: #000;
      padding: 12px 25px;
      border: 3px solid #00ff00;
      border-radius: 10px;
      cursor: pointer;
      display: none;
      z-index: 100;
      font-family: 'VT323', monospace;
      text-shadow: 0 0 10px #00ff00;
      animation: pulse-green 2s ease-in-out infinite;
      font-weight: bold;
    }

    @keyframes pulse-green {
      0%, 100% { 
        box-shadow: 0 0 20px #00ff00;
        transform: scale(1);
      }
      50% { 
        box-shadow: 0 0 40px #00ff00;
        transform: scale(1.02);
      }
    }

    #sewer-return-button:hover {
      background: rgba(0,255,0,1);
      transform: scale(1.05);
    }

    /* Chat Box Styles */
    #chat-box {
      position: absolute;
      bottom: 130px;
      left: 20px;
      width: 400px;
      z-index: 30;
      font-family: 'VT323', monospace;
    }

    #chat-toggle {
      padding: 8px 12px;
      background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
      color: #000;
      border: 2px solid #00ff00;
      border-radius: 8px;
      cursor: pointer;
      font-size: 1rem;
      font-weight: bold;
      box-shadow: 0 0 14px rgba(0, 255, 0, 0.45);
      transition: all 0.3s;
    }

    #chat-toggle:hover {
      transform: scale(1.05);
      box-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
    }

    #chat-container {
      display: none;
      background: rgba(0, 20, 0, 0.95);
      border: 3px solid #00ff00;
      border-radius: 15px;
      padding: 15px;
      box-shadow: 0 0 40px rgba(0, 255, 0, 0.8);
      margin-bottom: 10px;
    }

    #chat-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      padding-bottom: 10px;
      border-bottom: 2px solid #00ff00;
    }

    #chat-header h3 {
      margin: 0;
      color: #00ff00;
      font-size: 1.5rem;
      text-shadow: 0 0 10px #00ff00;
    }

    #chat-close {
      background: rgba(255, 0, 0, 0.8);
      color: white;
      border: 2px solid #ff0000;
      border-radius: 5px;
      padding: 5px 10px;
      cursor: pointer;
      font-size: 1rem;
      font-weight: bold;
    }

    #chat-close:hover {
      background: rgba(255, 0, 0, 1);
    }

    #chat-messages {
      height: 250px;
      overflow-y: auto;
      background: rgba(0, 0, 0, 0.6);
      border: 2px solid #00ff00;
      border-radius: 8px;
      padding: 10px;
      margin-bottom: 10px;
      scrollbar-width: thin;
      scrollbar-color: #00ff00 rgba(0, 0, 0, 0.3);
    }

    #chat-messages::-webkit-scrollbar {
      width: 8px;
    }

    #chat-messages::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.3);
      border-radius: 4px;
    }

    #chat-messages::-webkit-scrollbar-thumb {
      background: #00ff00;
      border-radius: 4px;
    }

    .chat-message {
      margin-bottom: 8px;
      padding: 6px 10px;
      background: rgba(0, 255, 0, 0.1);
      border-radius: 5px;
      border-left: 3px solid #00ff00;
    }

    .chat-username {
      color: #00ff00;
      font-weight: bold;
      margin-right: 5px;
    }

    .chat-text {
      color: #cccccc;
    }

    .chat-timestamp {
      color: #888;
      font-size: 0.9rem;
      margin-left: 10px;
    }

    .blockchain-badge {
      display: inline-block;
      padding: 2px 8px;
      margin-left: 8px;
      font-size: 0.85em;
      border-radius: 4px;
      font-weight: bold;
      text-shadow: none;
      vertical-align: middle;
    }
    
    .blockchain-badge.solana {
      background: linear-gradient(135deg, #9945FF, #14F195);
      color: #000;
      border: 1px solid #14F195;
      box-shadow: 0 0 8px rgba(20, 241, 149, 0.5);
    }
    
    .blockchain-badge.ethereum {
      background: linear-gradient(135deg, #627EEA, #8C9EF7);
      color: #fff;
      border: 1px solid #627EEA;
      box-shadow: 0 0 8px rgba(98, 126, 234, 0.5);
    }
    
    .blockchain-badge.cardano {
      background: linear-gradient(135deg, #0033AD, #1A8CFF);
      color: #fff;
      border: 1px solid #1A8CFF;
      box-shadow: 0 0 8px rgba(26, 140, 255, 0.5);
    }
    
    .blockchain-badge.guest {
      background: rgba(100, 100, 100, 0.5);
      color: #999;
      border: 1px solid #666;
    }

    #chat-input-container {
      display: flex;
      gap: 10px;
    }

    #chat-input {
      flex: 1;
      padding: 10px;
      background: rgba(0, 0, 0, 0.8);
      color: #00ff00;
      border: 2px solid #00ff00;
      border-radius: 6px;
      font-family: 'VT323', monospace;
      font-size: 1.1rem;
    }

    #chat-input:focus {
      outline: none;
      border-color: #00ff00;
      box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    }

    #chat-send {
      padding: 10px 20px;
      background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
      color: #000;
      border: 2px solid #00ff00;
      border-radius: 6px;
      cursor: pointer;
      font-size: 1.1rem;
      font-weight: bold;
      transition: all 0.3s;
    }

    #chat-send:hover {
      transform: scale(1.05);
      box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
    }


    .building-label {
      position: absolute;
      color: white;
      font-family: 'VT323', monospace;
      font-size: 18px;
      text-align: center;
      pointer-events: none;
      text-shadow: 
        0 0 10px rgba(0,0,0,0.9), 
        2px 2px 4px rgba(0,0,0,1),
        -1px -1px 2px rgba(0,0,0,1);
      white-space: nowrap;
      z-index: 20;
      font-weight: bold;
      background: rgba(0, 0, 0, 0.7);
      padding: 6px 12px;
      border-radius: 6px;
      border: 2px solid rgba(0, 255, 0, 0.4);
      display: none;
      opacity: 1;
    }

    .building-label.visible {
      display: block;
    }

    .building-label.near {
      font-size: 24px;
      border-color: #00ff00;
      box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
      background: rgba(0, 50, 0, 0.9);
      padding: 8px 16px;
    }

    .building-label.very-near {
      font-size: 28px;
      border-color: #00ff00;
      box-shadow: 0 0 30px rgba(0, 255, 0, 1);
      background: rgba(0, 80, 0, 0.95);
      padding: 10px 20px;
    }

    #minimap {
      position: absolute;
      bottom: 20px;
      right: 20px;
      width: 250px;
      height: 250px;
      background: rgba(0, 20, 0, 0.9);
      border: 3px solid #00ff00;
      border-radius: 10px;
      box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
      pointer-events: none;
      z-index: 30;
    }

    #minimap canvas {
      width: 100%;
      height: 100%;
      border-radius: 7px;
    }

    #legend {
      position: absolute;
      bottom: 330px;
      right: 20px;
      background: rgba(0, 20, 0, 0.95);
      border: 3px solid #00ff00;
      border-radius: 10px;
      box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
      pointer-events: auto;
      z-index: 30;
      overflow: visible;
      transition: all 0.3s ease;
    }

    #legend.collapsed {
      width: 240px;
      height: 50px;
    }

    #legend.expanded {
      width: 320px;
      height: 500px;
    }

    #legend-header {
      padding: 12px 15px;
      background: transparent;
      cursor: pointer;
      font-family: 'Orbitron', monospace;
      font-size: 1.1rem;
      color: #00ff00;
      text-shadow: 0 0 10px #00ff00;
      display: flex;
      justify-content: space-between;
      align-items: center;
      user-select: none;
      pointer-events: auto;
    }

    #legend-header:hover {
      background: rgba(0, 255, 0, 0.1);
    }

    #legend-toggle {
      font-size: 1.5rem;
      transition: transform 0.3s ease;
    }

    #legend.expanded #legend-toggle {
      transform: rotate(180deg);
    }

    #legend-content {
      padding: 15px;
      font-family: 'VT323', monospace;
      font-size: 1.1rem;
      height: calc(100% - 50px);
      overflow-y: auto;
      overflow-x: hidden;
      display: none;
      pointer-events: auto;
    }
    
    /* Custom scrollbar for legend */
    #legend-content::-webkit-scrollbar {
      width: 8px;
    }
    
    #legend-content::-webkit-scrollbar-track {
      background: rgba(0, 100, 0, 0.2);
      border-radius: 4px;
    }
    
    #legend-content::-webkit-scrollbar-thumb {
      background: #00ff00;
      border-radius: 4px;
    }
    
    #legend-content::-webkit-scrollbar-thumb:hover {
      background: #00ff88;
    }

    #legend.expanded #legend-content {
      display: block;
    }

    .legend-category {
      margin-bottom: 15px;
    }

    .legend-category-title {
      color: #00ffff;
      font-weight: bold;
      font-size: 1.2rem;
      margin-bottom: 8px;
      text-shadow: 0 0 5px #00ffff;
    }

    .legend-item {
      display: flex;
      align-items: center;
      margin: 5px 0;
      padding: 3px 5px;
      background: rgba(0, 255, 0, 0.05);
      border-radius: 5px;
    }

    .legend-icon {
      width: 20px;
      height: 20px;
      border-radius: 3px;
      margin-right: 10px;
      box-shadow: 0 0 5px currentColor;
    }

    .legend-text {
      color: #00ff00;
      flex: 1;
    }

    #legend-content::-webkit-scrollbar {
      width: 8px;
    }

    #legend-content::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.3);
      border-radius: 4px;
    }

    #legend-content::-webkit-scrollbar-thumb {
      background: #00ff00;
      border-radius: 4px;
      box-shadow: 0 0 5px #00ff00;
    }

    @media (max-width: 768px) {
      .title { font-size: 3rem; }
      .subtitle { font-size: 1.5rem; }
      .start-text { font-size: 1.8rem; }
      #location-display { font-size: 1.5rem; padding: 10px 15px; }
      #building-prompt { font-size: 1.8rem; padding: 15px 25px; }
      .building-info h2 { font-size: 2rem; }
      .building-info p { font-size: 1.5rem; }
      .building-label { font-size: 16px; padding: 5px 10px; }
      .building-label.near { font-size: 20px; padding: 6px 12px; }
      .building-label.very-near { font-size: 24px; padding: 8px 16px; }
      
      #minimap {
        width: 180px;
        height: 180px;
        bottom: 15px;
        right: 15px;
      }
      
      #legend.collapsed {
        width: 150px;
        height: 45px;
      }
      
      #legend.expanded {
        width: 280px;
        height: 450px;
      }
      
      #legend {
        bottom: 210px;
        right: 15px;
      }
      
      #weather-display {
        bottom: 210px;
        right: 15px;
      }
      
      #time-display {
        bottom: 250px;
        right: 15px;
      }
    }

    /* Solana Academy Integration Styles */
    #solana-academy-container {
      position: fixed;
      inset: 0;
      z-index: 2000;
      display: none;
      background: #000;
    }

    #solana-academy-frame {
      width: 100%;
      height: 100%;
      border: none;
    }

    #exit-academy-btn {
      position: fixed;
      top: 20px;
      left: 20px;
      z-index: 2001;
      background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
      color: #000;
      border: 3px solid #00ff00;
      padding: 15px 30px;
      border-radius: 15px;
      font-family: 'Orbitron', monospace;
      font-size: 1.3rem;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 0 30px rgba(0, 255, 0, 0.6);
      text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
      display: none;
      letter-spacing: 0.1rem;
    }

    #exit-academy-btn:hover {
      background: linear-gradient(135deg, #00cc00 0%, #00ff00 100%);
      box-shadow: 0 0 40px rgba(0, 255, 0, 0.8);
      transform: scale(1.05);
    }

    #academy-loading {
      position: fixed;
      inset: 0;
      z-index: 1999;
      display: none;
      background: linear-gradient(180deg, #0a0014 0%, #1a0028 50%, #0a0014 100%);
      justify-content: center;
      align-items: center;
      flex-direction: column;
    }

    #academy-loading.active {
      display: flex;
    }

    .loading-spinner {
      width: 100px;
      height: 100px;
      border: 5px solid rgba(153, 69, 255, 0.3);
      border-top: 5px solid #9945ff;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 30px;
      box-shadow: 0 0 40px rgba(153, 69, 255, 0.6);
    }

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    .loading-text {
      font-family: 'Orbitron', monospace;
      font-size: 2.5rem;
      color: #14f195;
      text-shadow: 0 0 20px #14f195;
      animation: glow-academy 2s ease-in-out infinite;
    }

    @keyframes glow-academy {
      0%, 100% { text-shadow: 0 0 20px #14f195, 0 0 40px #14f195; }
      50% { text-shadow: 0 0 40px #9945ff, 0 0 80px #9945ff, 0 0 120px #9945ff; }
    }

    /* Comic Creator Container Styles */
    #comic-creator-container {
      position: fixed;
      inset: 0;
      z-index: 2000;
      display: none;
      background: #000;
    }

    #comic-creator-frame {
      width: 100%;
      height: 100%;
      border: none;
    }

    #exit-comic-btn {
      position: fixed;
      top: 20px;
      left: 20px;
      z-index: 2001;
      background: linear-gradient(135deg, #FF1744 0%, #ff0033 100%);
      color: #fff;
      border: 3px solid #FF1744;
      padding: 15px 30px;
      border-radius: 15px;
      font-family: 'Orbitron', monospace;
      font-size: 1.3rem;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 0 30px rgba(255, 23, 68, 0.6);
      text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
      display: none;
      letter-spacing: 0.1rem;
    }

    #exit-comic-btn:hover {
      background: linear-gradient(135deg, #ff0033 0%, #FF1744 100%);
      box-shadow: 0 0 40px rgba(255, 23, 68, 0.8);
      transform: scale(1.05);
    }

    #comic-loading {
      position: fixed;
      inset: 0;
      z-index: 1999;
      display: none;
      background: linear-gradient(180deg, #140a0a 0%, #280a1a 50%, #140a0a 100%);
      justify-content: center;
      align-items: center;
      flex-direction: column;
    }

    #comic-loading.active {
      display: flex;
    }

    #comic-loading .loading-spinner {
      width: 100px;
      height: 100px;
      border: 5px solid rgba(255, 23, 68, 0.3);
      border-top: 5px solid #FF1744;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 30px;
      box-shadow: 0 0 40px rgba(255, 23, 68, 0.6);
    }

    #comic-loading .loading-text {
      font-family: 'Orbitron', monospace;
      font-size: 2.5rem;
      color: #FFEA00;
      text-shadow: 0 0 20px #FFEA00;
      animation: glow-comic 2s ease-in-out infinite;
    }

    @keyframes glow-comic {
      0%, 100% { text-shadow: 0 0 20px #FFEA00, 0 0 40px #FFEA00; }
      50% { text-shadow: 0 0 40px #FF1744, 0 0 80px #FF1744, 0 0 120px #FF1744; }
    }

    /* CardMaker Container Styles */
    #cardmaker-container {
      position: fixed;
      inset: 0;
      z-index: 2000;
      display: none;
      background: #000;
    }

    #cardmaker-frame {
      width: 100%;
      height: 100%;
      border: none;
    }

    #exit-cardmaker-btn {
      position: fixed;
      top: 20px;
      left: 20px;
      z-index: 2001;
      background: linear-gradient(135deg, #0074D9 0%, #005BB5 100%);
      color: #fff;
      border: 3px solid #0074D9;
      padding: 15px 30px;
      border-radius: 15px;
      font-family: 'Orbitron', monospace;
      font-size: 1.3rem;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 0 30px rgba(0, 116, 217, 0.6);
      text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
      display: none;
      letter-spacing: 0.1rem;
    }

    #exit-cardmaker-btn:hover {
      background: linear-gradient(135deg, #005BB5 0%, #0074D9 100%);
      box-shadow: 0 0 40px rgba(0, 116, 217, 0.8);
      transform: scale(1.05);
    }

    #cardmaker-loading {
      position: fixed;
      inset: 0;
      z-index: 1999;
      display: none;
      background: linear-gradient(180deg, #001f3f 0%, #0074D9 50%, #001f3f 100%);
      justify-content: center;
      align-items: center;
      flex-direction: column;
    }

    #cardmaker-loading.active {
      display: flex;
    }

    #cardmaker-loading .loading-spinner {
      width: 100px;
      height: 100px;
      border: 5px solid rgba(0, 116, 217, 0.3);
      border-top: 5px solid #0074D9;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 30px;
      box-shadow: 0 0 40px rgba(0, 116, 217, 0.6);
    }

    #cardmaker-loading .loading-text {
      font-family: 'Orbitron', monospace;
      font-size: 2.5rem;
      color: #7FDBFF;
      text-shadow: 0 0 20px #7FDBFF;
      animation: glow-cardmaker 2s ease-in-out infinite;
    }

    @keyframes glow-cardmaker {
      0%, 100% { text-shadow: 0 0 20px #7FDBFF, 0 0 40px #7FDBFF; }
      50% { text-shadow: 0 0 40px #0074D9, 0 0 80px #0074D9, 0 0 120px #0074D9; }
    }

    @media (max-width: 768px) {
      #exit-academy-btn,
      #exit-comic-btn,
      #exit-cardmaker-btn {
        padding: 8px 14px;
        font-size: 0.75rem;
        border-radius: 10px;
        border-width: 2px;
        top: 10px;
        left: 10px;
        letter-spacing: 0;
      }
    }


/* =========================
   TRTLVille Mobile + Extras
   ========================= */

html, body {
  height: 100%;
  overscroll-behavior: none;
}

canvas {
  touch-action: none;
}

/* Small always-visible token badge */
#tokens-hud {
  position: fixed;
  left: 14px;
  top: 170px;
  z-index: 999;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(127,255,212,0.25);
  color: #eafff7;
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

#tokens-hud.mobile {
  top: calc(env(safe-area-inset-top) + 10px);
}

/* Floating quests button (desktop + mobile) */
#quests-fab {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 999;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(127,255,212,0.25);
  background: rgba(0,0,0,0.55);
  color: #eafff7;
  font-family: 'Orbitron', monospace;
  cursor: pointer;
}

#quests-fab:hover { transform: translateY(-1px); }

/* Zone hint (dance circles) */
#zone-hint {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  z-index: 998;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,0,255,0.25);
  color: #fff;
  font-family: 'Orbitron', monospace;
  display: none;
  align-items: center;
  gap: 10px;
}

#zone-hint.show { display: flex; }

#zone-hint .zone-action {
  pointer-events: auto;
  background: rgba(255,0,255,0.18);
  border: 1px solid rgba(255,0,255,0.35);
  color: #fff;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}

/* Leaderboard hint near posterboard */
#leaderboard-hint {
  position: fixed;
  left: 50%;
  top: 70px;
  transform: translateX(-50%);
  z-index: 998;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(127,255,212,0.25);
  color: #eafff7;
  font-family: 'Orbitron', monospace;
  display: none;
}

#leaderboard-hint.show { display: block; }

/* Leaderboard panel */
#leaderboard-panel {
  position: fixed;
  right: 14px;
  top: 170px;
  width: min(420px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 120px));
  z-index: 900;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(127,255,212,0.25);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  color: #eafff7;
  font-family: 'Orbitron', monospace;
  display: none;
  overflow: hidden;
}

#leaderboard-panel.show { display: block; }



#leaderboard-panel .lb-title { font-size: 16px; }
#leaderboard-panel .lb-sub { padding: 8px 12px; font-size: 12px; opacity: 0.85; }

#leaderboard-panel .lb-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #eafff7;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

#leaderboard-panel .lb-list {
  padding: 8px 12px;
  overflow: auto;
  max-height: 380px;
}

#leaderboard-panel .lb-row {
  display: grid;
  grid-template-columns: 54px 1fr 70px 86px;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(127,255,212,0.12);
  font-size: 12px;
}

#leaderboard-panel .lb-row:last-child { border-bottom: 0; }
#leaderboard-panel .lb-score { text-align: right; }
#leaderboard-panel .lb-chain { text-align: right; opacity: 0.85; }

#leaderboard-panel .lb-empty { padding: 12px 0; opacity: 0.9; }
#leaderboard-panel .lb-actions { padding: 10px 12px 14px 12px; }
#leaderboard-panel .lb-submit {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(127,255,212,0.25);
  background: rgba(127,255,212,0.12);
  color: #eafff7;
  font-family: 'Orbitron', monospace;
  cursor: pointer;
}

/* Quests panel */
#quests-panel {
  position: fixed;
  left: 14px;
  bottom: 30px;
  width: min(420px, calc(100vw - 28px));
  max-height: min(460px, calc(100vh - 120px));
  z-index: 1200;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(127,255,212,0.25);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  color: #eafff7;
  font-family: 'Orbitron', monospace;
  display: none;
  overflow: hidden;
}

#quests-panel.show { display: block; }

#quests-panel .qp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px 6px 12px;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(127,255,212,0.15);
}

#quests-panel .qp-title { font-size: 16px; }
#quests-panel .qp-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #eafff7;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

#quests-panel .qp-list {
  padding: 8px 12px;
  overflow: auto;
  max-height: 320px;
}

#quests-panel .qp-row {
  display: grid;
  grid-template-columns: 30px 1fr 70px;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(127,255,212,0.12);
  font-size: 12px;
}

#quests-panel .qp-row.done { opacity: 0.9; }
#quests-panel .qp-prog { text-align: right; opacity: 0.9; }
#quests-panel .qp-foot { padding: 10px 12px 14px 12px; font-size: 11px; opacity: 0.75; }

#leaderboard-backdrop,
#leaderboard-dimmer,
#leaderboard-bg,
.leaderboard-backdrop,
.lb-backdrop {
  display: none !important;
}


/* Hide crosshair on mobile */
@media (max-width: 900px) {
  #crosshair { display: none !important; }
  #fps-counter { transform: scale(0.92); transform-origin: top right; }
}

/* Multiplayer UI: MP player count is merged into the FPS/Players HUD (#fps-counter).
   Hide any legacy standalone MP badge if a cached build still injects it. */
#mp-status { display: none !important; }
/* ── Universal "Back to $TRTLVille" button ────────────────────────────────
   Injected by trtl-common.js on every building page.
   Position: top-left, always visible, consistent across all OS/browsers.    */
#trtl-back-btn, .trtl-back-btn {
  position: fixed !important;
  top: max(14px, env(safe-area-inset-top, 14px)) !important;
  left: max(14px, env(safe-area-inset-left, 14px)) !important;
  z-index: 999999 !important;
  padding: 10px 18px !important;
  font-family: 'VT323', 'Share Tech Mono', monospace !important;
  font-size: 1.15rem !important;
  color: #000 !important;
  background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%) !important;
  border: 2px solid #00ff00 !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  letter-spacing: 0.04em !important;
  box-shadow: 0 0 14px rgba(0,255,0,0.45) !important;
  transition: box-shadow 0.15s ease, transform 0.1s ease !important;
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  white-space: nowrap !important;
}
#trtl-back-btn:hover, .trtl-back-btn:hover {
  box-shadow: 0 0 24px rgba(0,255,0,0.7) !important;
  transform: translateY(-1px) !important;
}
#trtl-back-btn:active, .trtl-back-btn:active {
  transform: translateY(0) scale(0.97) !important;
}
@media (max-width: 600px) {
  #trtl-back-btn, .trtl-back-btn { font-size: 1rem !important; padding: 9px 14px !important; }
}
