@import url('https://fonts.googleapis.com/css2?family=Huninn&family=Orbitron:wght@400;700;900&display=swap');

    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    :root {
      --bg: #0a0c10;
      --panel: #2b1c10;
      --panel-deep: #1d120a;
      --border: #8a6230;
      --border-bright: #d19a45;
      --accent: #f2c46b;
      --accent-hot: #ffe0a0;
      --danger: #d46a4c;
      --ok: #8faa69;
      --spider: #7e9b4e;
      --text: #ead8b7;
      --dim: #a98555;
      --shadow: rgba(8, 5, 2, 0.72);
    }

    body {
      background-color: var(--bg);
      background-image:
        repeating-linear-gradient(
          60deg,
          transparent 0 38px,
          rgba(200, 215, 195, 0.018) 38px 39px
        ),
        repeating-linear-gradient(
          -60deg,
          transparent 0 38px,
          rgba(200, 215, 195, 0.018) 38px 39px
        ),
        radial-gradient(ellipse 90% 55% at 50% -8%, rgba(126, 155, 78, 0.14) 0%, transparent 62%),
        radial-gradient(circle at 12% 88%, rgba(126, 155, 78, 0.09) 0%, transparent 32%),
        radial-gradient(circle at 90% 82%, rgba(126, 155, 78, 0.07) 0%, transparent 28%),
        linear-gradient(180deg, #12161e 0%, var(--bg) 40%, #050608 100%);
      color: var(--text);
      font-family: 'Huninn', sans-serif;
      display: flex;
      flex-direction: column;
      align-items: center;
      min-height: 100vh;
      padding: 20px;
      overflow-x: hidden;
    }

    body::before {
      content: '';
      position: fixed;
      inset: 0;
      background:
        repeating-conic-gradient(
          from 0deg at 50% -2%,
          transparent 0deg 11.25deg,
          rgba(220, 230, 210, 0.05) 11.25deg 12deg
        ),
        repeating-conic-gradient(
          from 18deg at 8% 78%,
          transparent 0deg 14deg,
          rgba(126, 155, 78, 0.04) 14deg 14.8deg
        ),
        repeating-conic-gradient(
          from -12deg at 93% 74%,
          transparent 0deg 13deg,
          rgba(126, 155, 78, 0.035) 13deg 13.7deg
        ),
        repeating-radial-gradient(
          circle at 50% -2%,
          transparent 0 52px,
          rgba(210, 220, 200, 0.045) 52px 53px,
          transparent 53px 104px
        ),
        repeating-radial-gradient(
          circle at 8% 78%,
          transparent 0 40px,
          rgba(126, 155, 78, 0.04) 40px 41px,
          transparent 41px 80px
        ),
        repeating-radial-gradient(
          circle at 93% 74%,
          transparent 0 34px,
          rgba(126, 155, 78, 0.035) 34px 35px,
          transparent 35px 68px
        ),
        linear-gradient(180deg, rgba(126, 155, 78, 0.07), transparent 30%, rgba(0, 0, 0, 0.5));
      pointer-events: none;
      z-index: 0;
    }

    h1 {
      font-family: 'Orbitron', sans-serif;
      font-size: 2rem;
      font-weight: 900;
      color: var(--accent);
      letter-spacing: 0.3em;
      text-transform: uppercase;
      margin-bottom: 8px;
      text-shadow: 0 0 18px rgba(242, 196, 107, 0.48), 0 3px 0 rgba(64, 35, 13, 0.75);
      position: relative;
      z-index: 1;
    }

    .subtitle {
      font-size: 0.75rem;
      color: var(--dim);
      letter-spacing: 0.2em;
      margin-bottom: 16px;
      position: relative;
      z-index: 1;
    }

    .game-wrapper {
      position: relative;
      z-index: 1;
    }


    #canvas-container {
      position: relative;
      border: 1px solid var(--border);
      outline: 1px solid rgba(255, 224, 160, 0.16);
      outline-offset: 4px;
      background: var(--panel-deep);
      box-shadow: 0 18px 44px var(--shadow), 0 0 34px rgba(209, 154, 69, 0.18), inset 0 0 40px rgba(0, 0, 0, 0.5);
    }

    canvas {
      display: block;
      cursor: crosshair;
    }

    #overlay {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background:
        linear-gradient(180deg, rgba(46, 29, 14, 0.95), rgba(18, 11, 6, 0.96)),
        repeating-linear-gradient(45deg, rgba(255, 224, 160, 0.05) 0 1px, transparent 1px 12px);
      z-index: 10;
    }

    .gameover-images {
      position: relative;
      width: 60%;
      height: 50%;
      margin: 20px 0;
      overflow: hidden;
    }

    .gameover-images img {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .gameover-images .death-text {
      z-index: 1;
      animation: slideDown 0.8s ease-out forwards;
    }

    @keyframes slideDown {
      from {
        transform: translateY(-100%);
        opacity: 0;
      }
      to {
        transform: translateY(0);
        opacity: 1;
      }
    }

    #overlay h2 {
      font-family: 'Orbitron', sans-serif;
      font-size: 2.5rem;
      font-weight: 900;
      margin-bottom: 16px;
      text-shadow: 0 0 24px rgba(242, 196, 107, 0.42), 0 2px 0 rgba(55, 31, 12, 0.9);
    }

    #overlay p {
      font-size: 0.85rem;
      color: var(--dim);
      margin-bottom: 8px;
      letter-spacing: 0.1em;
    }

    .btn {
      margin-top: 20px;
      padding: 12px 32px;
      background: linear-gradient(180deg, rgba(255, 224, 160, 0.1), rgba(91, 48, 20, 0.2));
      border: 2px solid var(--accent);
      color: var(--accent);
      font-family: 'Orbitron', sans-serif;
      font-size: 0.85rem;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      cursor: pointer;
      transition: all 0.2s;
      border-radius: 2px;
    }

    .btn:hover {
      color: var(--accent-hot);
      border-color: var(--accent-hot);
      background: linear-gradient(180deg, rgba(255, 224, 160, 0.18), rgba(130, 78, 31, 0.32));
      box-shadow: 0 0 20px rgba(242, 196, 107, 0.26), inset 0 0 16px rgba(255, 224, 160, 0.08);
    }

    .rules {
      max-width: 720px;
      margin-top: 20px;
      padding: 24px 32px;
      background:
        linear-gradient(180deg, rgba(55, 35, 17, 0.96), rgba(31, 19, 10, 0.97)),
        repeating-linear-gradient(90deg, rgba(255, 224, 160, 0.04) 0 1px, transparent 1px 16px);
      border: 1px solid var(--border);
      border-radius: 4px;
      text-align: center;
      position: relative;
      z-index: 1;
      box-shadow: 0 12px 34px var(--shadow), inset 0 1px 0 rgba(255, 224, 160, 0.1);
    }

    .rules h3 {
      font-family: 'Orbitron', sans-serif;
      font-size: 0.9rem;
      color: var(--accent);
      letter-spacing: 0.2em;
      margin-bottom: 16px;
    }

    .rules-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px 32px;
      text-align: left;
    }

    .rule-item {
      font-size: 0.75rem;
      color: var(--text);
      line-height: 1.6;
    }

    .rule-item strong {
      color: var(--accent);
    }

    .rule-item .danger {
      color: var(--danger);
    }

    .rule-item .ok {
      color: var(--ok);
    }

    @media (max-width: 600px) {
      .rules-grid {
        grid-template-columns: 1fr;
      }
    }

    .credits {
      max-width: 720px;
      margin-top: 20px;
      padding: 16px 32px;
      background:
        linear-gradient(180deg, rgba(55, 35, 17, 0.96), rgba(31, 19, 10, 0.97)),
        repeating-linear-gradient(90deg, rgba(255, 224, 160, 0.04) 0 1px, transparent 1px 16px);
      border: 1px solid var(--border);
      border-radius: 4px;
      text-align: center;
      position: relative;
      z-index: 1;
      box-shadow: 0 12px 34px var(--shadow), inset 0 1px 0 rgba(255, 224, 160, 0.1);
    }

    .credits p {
      font-size: 0.7rem;
      color: var(--accent);
      letter-spacing: 0.15em;
      margin-bottom: 12px;
    }

    .credits a {
      display: block;
      font-size: 0.65rem;
      color: var(--dim);
      text-decoration: none;
      margin-bottom: 4px;
      transition: color 0.15s;
    }

    .credits a:hover {
      color: var(--accent);
    }

    #upgrade-popup {
      position: absolute;
      top: 60px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(31, 19, 10, 0.95);
      border: 2px solid var(--accent-hot);
      border-radius: 4px;
      padding: 10px 22px;
      font-family: 'Orbitron', sans-serif;
      font-size: 0.8rem;
      color: var(--accent-hot);
      letter-spacing: 0.15em;
      text-transform: uppercase;
      text-align: center;
      pointer-events: none;
      z-index: 20;
      opacity: 0;
      transition: opacity 0.2s;
      text-shadow: 0 0 12px rgba(255, 224, 160, 0.6);
      box-shadow: 0 0 20px rgba(242, 196, 107, 0.25);
      white-space: nowrap;
    }

    #upgrade-popup.visible {
      opacity: 1;
    }

    #fullscreen-btn {
      position: absolute;
      bottom: 8px;
      right: 8px;
      width: 32px;
      height: 32px;
      background: rgba(31, 19, 10, 0.78);
      border: 1px solid var(--border);
      border-radius: 3px;
      color: var(--dim);
      font-size: 1.1rem;
      line-height: 1;
      cursor: pointer;
      z-index: 15;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: color 0.15s, border-color 0.15s, background 0.15s;
      padding: 0;
    }

    #fullscreen-btn:hover {
      color: var(--accent-hot);
      border-color: var(--accent-hot);
      background: rgba(242, 196, 107, 0.14);
    }

    :fullscreen #fullscreen-btn,
    :-webkit-full-screen #fullscreen-btn {
      bottom: 12px;
      right: 12px;
    }

    :fullscreen #canvas-container,
    :-webkit-full-screen #canvas-container {
      border: none;
      box-shadow: none;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100vw !important;
      height: 100vh !important;
      background: #000;
    }

    :fullscreen canvas,
    :-webkit-full-screen canvas {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
