﻿    /* â”€â”€ Reset & base â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      background: #0a0a0a;
      color: #c4b08a;
      font-family: Georgia, 'Times New Roman', serif;
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px 16px;
      line-height: 1.7;
    }

    /* â”€â”€ Screens (only .active is shown) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .screen { display: none; width: 100%; max-width: 700px; }
    .screen.active { display: block; }

    /* â”€â”€ Typography â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    h1 {
      font-size: 2.2em;
      color: #d4a84b;
      text-align: center;
      letter-spacing: 0.08em;
      margin-bottom: 6px;
    }
    .tagline {
      text-align: center;
      color: #6a5a3a;
      font-style: italic;
      margin-bottom: 36px;
    }
    label {
      display: block;
      color: #8a7050;
      font-size: 0.82em;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      margin-bottom: 6px;
    }

    /* â”€â”€ Form controls â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    input[type="password"],
    input[type="text"],
    textarea {
      width: 100%;
      background: #141414;
      border: 1px solid #2e2416;
      color: #c4b08a;
      padding: 10px 14px;
      font: inherit;
      font-size: 0.97em;
      border-radius: 4px;
      outline: none;
      margin-bottom: 22px;
      transition: border-color 0.2s;
    }
    input[type="password"]:focus,
    input[type="text"]:focus,
    textarea:focus { border-color: #5a421e; }
    textarea { resize: vertical; min-height: 110px; }

    /* â”€â”€ Buttons â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    button { font: inherit; cursor: pointer; border: none; border-radius: 4px; transition: 0.15s; }

    .btn-primary {
      width: 100%;
      padding: 13px;
      background: #2a1e0a;
      color: #d4a84b;
      border: 1px solid #5a421e;
      font-size: 1em;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }
    .btn-primary:hover:not(:disabled) { background: #3a2a10; }
    .btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

    /* â”€â”€ Auth screen: Log In / Sign Up tabs â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .auth-tabs {
      display: flex;
      gap: 0;
      margin-bottom: 22px;
      border-bottom: 1px solid #2e2416;
    }
    .auth-tab {
      flex: 1;
      background: transparent;
      color: #8a7050;
      border: none;
      padding: 10px 0;
      font: inherit;
      font-size: 0.95em;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: color 0.15s, border-color 0.15s;
    }
    .auth-tab:hover { color: #c4b08a; }
    .auth-tab.active { color: #d4a84b; border-bottom-color: #d4a84b; }

    /* "Signed in as you@email.com â€” Sign Out" strip on logged-in screens */
    .auth-strip {
      text-align: right;
      font-size: 0.82em;
      color: #6a5a3a;
      margin-bottom: 14px;
    }
    .auth-strip .btn-link {
      background: none;
      border: none;
      color: #8a7050;
      cursor: pointer;
      font: inherit;
      text-decoration: underline;
      padding: 0 0 0 8px;
    }
    .auth-strip .btn-link:hover { color: #d4a84b; }

    /* â”€â”€ Error messages â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .error { color: #b04040; font-size: 0.88em; margin-top: 8px; display: none; }
    .error.success { color: #7ec88f; }   /* same element, success tone (green) */

    /* â”€â”€ Story screen header â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .story-header {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: 18px;
    }
    .story-header h2 { color: #d4a84b; font-size: 1.15em; }
    .btn-restart {
      background: transparent;
      color: #4a3a20;
      border: 1px solid #2e2416;
      padding: 5px 12px;
      font-size: 0.82em;
    }
    .btn-restart:hover { color: #c4b08a; border-color: #4a3a20; }

    /* â”€â”€ Narration box â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #narration-box {
      background: #0e0e0e;
      border: 1px solid #1e180e;
      border-radius: 6px;
      padding: 24px 26px;
      margin-bottom: 22px;
      min-height: 180px;
    }
    #narration-box p { margin-bottom: 1em; }
    #narration-box p:last-child { margin-bottom: 0; }

    /* â”€â”€ Loading pulse â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #loading {
      text-align: center;
      color: #5a4a28;
      font-style: italic;
      padding: 12px 0;
      display: none;
    }

    /* â”€â”€ Choice buttons (2Ã—2 grid) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #choices-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 16px;
    }
    @media (max-width: 480px) { #choices-grid { grid-template-columns: 1fr; } }

    .choice-btn {
      background: #141008;
      color: #c4b08a;
      border: 1px solid #2e2416;
      padding: 13px 14px;
      text-align: left;
      font-size: 0.93em;
      line-height: 1.45;
      border-radius: 4px;
    }
    .choice-btn:hover:not(:disabled) {
      background: #1e1a0e;
      border-color: #5a421e;
      color: #d4a84b;
    }
    .choice-btn:disabled { opacity: 0.3; cursor: not-allowed; }

    /* â”€â”€ Separator â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    hr { border: none; border-top: 1px solid #1e180e; margin: 28px 0; }

    /* â”€â”€ Story layout: sidebar + main column â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #story-screen.active { max-width: 980px; }
    .story-layout { display: flex; gap: 22px; align-items: flex-start; }
    .story-main { flex: 1; min-width: 0; }

    .sidebar {
      width: 230px;
      flex-shrink: 0;
      background: #0e0e0e;
      border: 1px solid #1e180e;
      border-radius: 6px;
      padding: 16px;
      position: sticky;
      top: 16px;
    }

    /* Character portrait */
    #hero-sprite {
      width: 100%;
      aspect-ratio: 1 / 1;
      object-fit: contain;
      background: #141414;
      border: 1px solid #2e2416;
      border-radius: 4px;
      display: block;
      margin-bottom: 12px;
      image-rendering: pixelated; /* keeps pixel-art sprites crisp */
    }
    #hero-name {
      color: #d4a84b;
      font-size: 1.05em;
      text-align: center;
      margin-bottom: 4px;
    }
    .hero-level {
      color: #8a7050;
      font-size: 0.78em;
      text-align: center;
      margin-bottom: 16px;
    }

    /* Stat blocks */
    .stat-label {
      font-size: 0.72em;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: #8a7050;
      margin-bottom: 5px;
    }

    /* Health bar */
    .health-track {
      background: #2a1414;
      border: 1px solid #3a1e1e;
      border-radius: 3px;
      height: 18px;
      overflow: hidden;
    }
    #health-fill {
      background: linear-gradient(#c04848, #7a2020);
      height: 100%;
      width: 100%;
      transition: width 0.4s ease;
    }
    #health-text { font-size: 0.78em; color: #c4b08a; margin-top: 4px; text-align: right; }

    /* Energy â€” subtle clickable indicator at the top of the story screen */
    .energy-mini {
      font-size: 0.78em;
      color: #6a8aa8;
      letter-spacing: 0.04em;
      cursor: pointer;
      user-select: none;
      transition: color 0.15s;
    }
    .energy-mini:hover { color: #8aa6c0; }

    /* Inventory icon button in the story header (always reachable, even mid-dialogue) */
    .inv-icon-btn {
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 4px 6px;
      font-size: 1.15em;
      line-height: 1;
      opacity: 0.7;
      transition: opacity 0.15s, transform 0.15s;
    }
    .inv-icon-btn:hover { opacity: 1; transform: scale(1.1); }

    /* Energy shop */
    #shop-screen.active { max-width: 700px; }
    .pack-grid { display: flex; flex-direction: column; gap: 12px; }
    .pack-card {
      display: flex;
      align-items: center;
      gap: 16px;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 14px 16px;
    }
    .pack-card .pack-info { flex: 1; min-width: 0; }
    .pack-card .pack-name { color: #d4a84b; font-size: 1.05em; margin-bottom: 4px; }
    .pack-card .pack-energy { color: #6a8aa8; font-size: 0.95em; }
    .pack-card .pack-blurb { color: #8a7050; font-size: 0.85em; margin-top: 4px; }
    .pack-card .btn-buy {
      background: #2a1e0a;
      color: #d4a84b;
      border: 1px solid #5a421e;
      padding: 10px 22px;
      font: inherit;
      font-size: 1em;
      border-radius: 4px;
      cursor: pointer;
      flex-shrink: 0;
      min-width: 100px;
      text-align: center;
    }
    .pack-card .btn-buy:hover:not(:disabled) { background: #3a2a10; }
    .pack-card .btn-buy:disabled { opacity: 0.5; cursor: not-allowed; }

    /* Floating toast for purchase results */
    .story-toast {
      position: fixed;
      top: 24px;
      left: 50%;
      background: #1a150d;
      border: 1px solid #5a421e;
      color: #d4a84b;
      padding: 12px 22px;
      border-radius: 4px;
      font-size: 0.95em;
      transform: translateX(-50%) translateY(-120px);
      transition: transform 0.3s ease;
      z-index: 1000;
      pointer-events: none;
    }
    .story-toast.show { transform: translateX(-50%) translateY(0); }
    .story-toast.success { border-color: #7ec88f; color: #7ec88f; }

    /* Stats sheet */
    .stats-block { margin-top: 18px; }
    #stats-list { list-style: none; margin-top: 6px; }
    #stats-list li {
      display: flex;
      justify-content: space-between;
      font-size: 0.85em;
      padding: 5px 9px;
      border-bottom: 1px solid #1e180e;
      text-transform: capitalize;
    }
    #stats-list li:last-child { border-bottom: none; }
    #stats-list .stat-value { color: #d4a84b; font-weight: bold; }

    /* Inventory */
    .inventory-block { margin-top: 18px; }
    #inventory-list { list-style: none; margin-top: 6px; }
    #inventory-list li {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      font-size: 0.85em;
      padding: 6px 9px;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 3px;
      margin-bottom: 5px;
    }
    #inventory-list .item-qty { color: #d4a84b; flex-shrink: 0; }
    .inventory-empty { font-style: italic; color: #5a4a28; font-size: 0.82em; }
    .btn-inv-open {
      width: 100%;
      margin-top: 10px;
      background: #2a1e0a;
      color: #d4a84b;
      border: 1px solid #5a421e;
      padding: 7px 10px;
      font: inherit;
      font-size: 0.78em;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      border-radius: 4px;
      cursor: pointer;
    }
    .btn-inv-open:hover { background: #3a2a10; }

    /* â”€â”€ Inventory screen â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #inventory-screen.active { max-width: 700px; }

    /* Equipment body layout */
    .equip-panel { margin-bottom: 24px; }
    .equip-panel-label { color: #8a7050; font-size: 0.72em; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 10px; }
    .equip-figure { position: relative; max-width: 380px; }
    .equip-silhouette {
      position: absolute; top: 0; bottom: 0; left: 50%;
      transform: translateX(-50%);
      height: 100%; width: auto;
      opacity: 0.22; pointer-events: none; z-index: 0;
    }
    .equip-body {
      position: relative; z-index: 1;
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      grid-template-rows: auto auto auto auto;
      gap: 8px;
    }
    .equip-slot {
      background: #141008;
      border: 1px dashed #3a2e18;
      border-radius: 5px;
      padding: 6px 8px;
      cursor: default;
      min-height: 48px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    .equip-slot.filled { border-style: solid; border-color: #5a421e; cursor: grab; }
    .equip-slot.filled:hover { background: #1e1a0e; border-color: #d4a84b; }
    .equip-slot.filled:active { cursor: grabbing; }
    .equip-slot.drag-over { border-style: solid; border-color: #d4a84b; background: #1e1a0e; }
    .item-card[draggable="true"] { cursor: grab; }
    .item-card[draggable="true"]:active { cursor: grabbing; }
    .inventory-grid.drag-over { outline: 1px dashed #d4a84b; outline-offset: 5px; border-radius: 6px; }
    .equip-slot-label { color: #6a5a3a; font-size: 0.62em; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 2px; }
    .equip-slot-name  { color: #d4a84b; font-size: 0.8em; line-height: 1.2; }
    .equip-slot-buffs { color: #8a7050; font-size: 0.67em; margin-top: 1px; line-height: 1.2; }
    .equip-slot-hint  { color: #4a3a20; font-size: 0.67em; font-style: italic; }
    .equip-slot-center { grid-column: 2; }
    .equip-slot-ring   { grid-column: 1; }
    .equip-slot-chest  { grid-column: 2; }

    /* Bag section */
    .bag-panel-label { color: #8a7050; font-size: 0.72em; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 10px; }
    .inventory-grid { display: flex; flex-direction: column; gap: 10px; }
    .item-card {
      display: flex;
      gap: 14px;
      align-items: center;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 12px 14px;
    }
    .item-card .item-info { flex: 1; min-width: 0; }
    .item-card .item-name { color: #d4a84b; font-size: 1em; margin-bottom: 3px; }
    .item-card .item-name .qty { color: #c4b08a; font-weight: normal; font-size: 0.85em; margin-left: 4px; }
    .item-card .item-desc { color: #8a7050; font-size: 0.88em; line-height: 1.4; }
    .item-card .btn-use {
      background: #2a1e0a;
      color: #d4a84b;
      border: 1px solid #5a421e;
      padding: 8px 18px;
      font-size: 0.9em;
      border-radius: 4px;
      cursor: pointer;
      font: inherit;
      flex-shrink: 0;
    }
    .item-card .btn-use:hover:not(:disabled) { background: #3a2a10; }
    .item-card .btn-use:disabled { opacity: 0.4; cursor: not-allowed; }
    .inventory-empty-msg { font-style: italic; color: #6a5a3a; text-align: center; padding: 30px 0; }
    .inventory-msg {
      margin-top: 16px;
      padding: 10px 14px;
      background: #1e1a0e;
      border: 1px solid #2e2416;
      border-radius: 4px;
      color: #c4b08a;
      display: none;
    }
    .inventory-msg.show { display: block; }

    /* â”€â”€ Item Shop (merchant â€” buy / sell) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #item-shop-screen.active { max-width: 700px; }
    .shop-keeper-line { color: #8a7050; font-style: italic; margin-bottom: 4px; }
    .shop-gold-line { color: #d4a84b; font-size: 0.95em; margin-bottom: 18px; }
    .shop-gold-line .gold-amt { font-weight: bold; }
    .shop-section-label { color: #8a7050; font-size: 0.72em; letter-spacing: 0.12em; text-transform: uppercase; margin: 18px 0 10px; }
    .shop-list { display: flex; flex-direction: column; gap: 10px; }
    .shop-row {
      display: flex; gap: 14px; align-items: center;
      background: #141008; border: 1px solid #2e2416; border-radius: 6px; padding: 12px 14px;
    }
    .shop-row .shop-info { flex: 1; min-width: 0; }
    .shop-row .shop-item-name { color: #d4a84b; font-size: 1em; margin-bottom: 3px; }
    .shop-row .shop-item-name .qty { color: #c4b08a; font-weight: normal; font-size: 0.85em; margin-left: 4px; }
    .shop-row .shop-item-desc { color: #8a7050; font-size: 0.83em; line-height: 1.4; }
    .shop-row .shop-price { color: #e0b84b; font-size: 0.9em; flex-shrink: 0; min-width: 70px; text-align: right; }
    .shop-row .shop-btn {
      background: #2a1e0a; color: #d4a84b; border: 1px solid #5a421e;
      padding: 8px 16px; font-size: 0.88em; border-radius: 4px; cursor: pointer; font: inherit; flex-shrink: 0; min-width: 78px;
    }
    .shop-row .shop-btn:hover:not(:disabled) { background: #3a2a10; }
    .shop-row .shop-btn:disabled { opacity: 0.4; cursor: not-allowed; }
    .shop-row.sold-out { opacity: 0.5; }
    .shop-empty-msg { font-style: italic; color: #6a5a3a; text-align: center; padding: 18px 0; }

    /* Stack the sidebar on top on narrow screens */
    @media (max-width: 720px) {
      .story-layout { flex-direction: column; }
      .sidebar { width: 100%; position: static; }
      #hero-sprite { max-width: 200px; margin-left: auto; margin-right: auto; }
    }

    /* â”€â”€ Combat screen â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #combat-screen.active { max-width: 880px; }
    .combat-title {
      text-align: center;
      color: #d4a84b;
      font-size: 1.4em;
      letter-spacing: 0.08em;
      margin-bottom: 22px;
    }
    .combat-arena {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 20px;
    }
    .combatant { flex: 1; text-align: center; position: relative; }
    .combat-sprite {
      width: 100%;
      max-width: 180px;
      aspect-ratio: 1 / 1;
      object-fit: contain;
      background: #141414;
      border: 1px solid #2e2416;
      border-radius: 6px;
      margin-bottom: 10px;
      image-rendering: pixelated;
    }
    .combatant-name { color: #d4a84b; font-size: 1.05em; margin-bottom: 8px; }
    .combat-vs { align-self: center; color: #6a5a3a; font-style: italic; font-size: 1.2em; flex-shrink: 0; }
    .combat-hp-text { font-size: 0.8em; color: #c4b08a; margin-top: 4px; }

    /* Player HP is green, enemy HP is red */
    #combat-player-hp-fill { background: linear-gradient(#4caf6a, #2e7d44); height: 100%; width: 100%; transition: width 0.4s ease; }
    .enemy-hp-fill         { background: linear-gradient(#c04848, #7a2020); height: 100%; width: 100%; transition: width 0.4s ease; }

    /* Status pills shown under enemies and the player */
    .status-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; min-height: 18px; }
    .status-pill {
      background: rgba(192, 72, 72, 0.18);
      border: 1px solid #5a3030;
      border-radius: 3px;
      padding: 1px 6px;
      font-size: 0.72em;
      color: #d4a84b;
      line-height: 1.4;
    }
    .status-pill.shield  { background: rgba(122, 90, 200, 0.22); border-color: #4a3a8c; color: #c0b0ff; }
    .status-pill.ring    { background: rgba(200, 110, 60, 0.22); border-color: #8a4a20; color: #ffc080; }
    .status-pill.stun    { background: rgba(100, 130, 220, 0.22); border-color: #4a5aa0; color: #b0c8ff; }
    .status-pill.curse   { background: rgba(120, 90, 180, 0.22); border-color: #5a4a8a; color: #c0a8ff; }
    .status-pill.enraged  { background: rgba(200, 70, 40, 0.25);  border-color: #8a3a20; color: #ff8060; }
    .status-pill.shock    { background: rgba(80, 180, 220, 0.22); border-color: #3a90b0; color: #6ad0f0; }
    .status-pill.poison   { background: rgba(80, 170, 60, 0.22);  border-color: #3a7a30; color: #7ad860; }
    .status-pill.weakened { background: rgba(150, 50, 50, 0.25);  border-color: #6a2828; color: #e07878; }
    .status-pill.shielded   { background: rgba(140, 100, 50, 0.22); border-color: #6a4a2a; color: #d8a560; }
    .status-pill.inaccurate { background: rgba(160, 100, 180, 0.22); border-color: #6a4a8a; color: #d8a8e0; }
    .status-pill.cheered    { background: rgba(220, 180, 70, 0.22);  border-color: #8a7028; color: #ffd860; }
    .status-pill.refresh { background: rgba(90, 160, 200, 0.22); border-color: #3a6a8a; color: #a8d8e8; }

    /* Mana bar (combat) */
    .mana-track {
      background: #14202a;
      border: 1px solid #1e2e3e;
      border-radius: 3px;
      height: 12px;
      overflow: hidden;
      margin-top: 6px;
    }
    #combat-player-mp-fill {
      background: linear-gradient(#7a6ad2, #4a3a8c);
      height: 100%;
      width: 100%;
      transition: width 0.3s ease;
    }
    .combat-mp-text { font-size: 0.74em; color: #8a83bd; margin-top: 2px; }

    /* End-Turn button â€” visually distinct from action buttons */
    .end-turn-btn {
      grid-column: 1 / -1;
      background: #1a1a26 !important;
      color: #8a8aa0 !important;
      border-color: #2e2e44 !important;
      font-style: italic;
    }
    .end-turn-btn:hover:not(:disabled) {
      background: #25253a !important;
      color: #c0c0d8 !important;
    }

    /* Player team: hero (big) above, then companion cards (small) */
    .team-side { display: flex; flex-direction: column; align-items: center; gap: 10px; }
    .combat-companions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
    .companion-card {
      width: 92px;
      text-align: center;
      position: relative;
      transition: opacity 0.5s ease, filter 0.5s ease;
    }
    .companion-card .combat-sprite { width: 92px; height: 92px; max-width: none; margin-bottom: 5px; }
    .companion-card .combatant-name { font-size: 0.8em; margin-bottom: 3px; }
    .companion-card .combat-hp-text { font-size: 0.72em; }
    .companion-card.dead { opacity: 0.35; filter: grayscale(1); }
    .companion-hp-fill { background: linear-gradient(#5fa970, #2e6a3a); height: 100%; width: 100%; transition: width 0.4s ease; }

    /* Enemy roster: up to 6 cards, wraps to a second row if needed */
    .combat-enemies {
      flex: 1;
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      justify-content: center;
      align-content: flex-start;
    }
    .enemy-card {
      width: 110px;
      text-align: center;
      position: relative;
      transition: transform 0.15s, outline-color 0.15s, opacity 0.5s ease, filter 0.5s ease;
    }
    .enemy-card .combat-sprite { width: 110px; height: 110px; max-width: none; margin-bottom: 6px; }
    .enemy-card .combatant-name { font-size: 0.85em; margin-bottom: 4px; }
    .enemy-card .combat-hp-text { font-size: 0.74em; }
    .enemy-card.dead { opacity: 0.35; filter: grayscale(1); pointer-events: none; }
    .enemy-plans {
      margin-top: 5px;
      font-size: 0.72em;
      line-height: 1.35;
      min-height: 1.4em;
      color: #c4b08a;
    }
    .enemy-plans .plan-label  { color: #5a4a32; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 4px; font-size: 0.92em; }
    .enemy-plans .plan-attack { color: #c89060; }
    .enemy-plans .plan-arrow  { color: #5a4a32; margin: 0 3px; }
    .enemy-plans .plan-idle   { color: #5a4a32; font-style: italic; }

    /* Hover tooltip for combat spell buttons */
    .spell-tooltip {
      position: fixed;
      pointer-events: none;
      background: #141008;
      border: 1px solid #5a421e;
      border-radius: 6px;
      padding: 10px 14px;
      max-width: 280px;
      z-index: 500;
      box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75);
      opacity: 0;
      transform: translateY(4px);
      transition: opacity 0.15s ease, transform 0.15s ease;
    }
    .spell-tooltip.show { opacity: 1; transform: translateY(0); }
    .spell-tooltip .tooltip-name { color: #d4a84b; font-size: 1em; margin-bottom: 4px; }
    .spell-tooltip .tooltip-meta {
      color: #8a7050;
      font-size: 0.74em;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      margin-bottom: 8px;
    }
    .spell-tooltip .tooltip-meta:empty { display: none; }
    .spell-tooltip .tooltip-desc { color: #c4b08a; font-size: 0.88em; line-height: 1.5; }

    /* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
       Combat animations
       â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

    /* Floating damage numbers â€” children of combatants/cards */
    .damage-pop {
      position: absolute;
      top: 28%;
      left: 50%;
      font-size: 1.5em;
      font-weight: bold;
      color: #ff7070;
      text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.5);
      pointer-events: none;
      animation: damage-pop 1.6s ease-out forwards;
      z-index: 20;
      white-space: nowrap;
    }
    .damage-pop.burn { color: #ffa050; }    /* burn DoT tick */
    .damage-pop.ring { color: #ffcc66; }    /* ring-of-fire thorns */
    .damage-pop.heal   { color: #7ec88f; }
    .damage-pop.poison { color: #7ad860; }    /* poison DoT tick */
    .damage-pop.miss   { color: #888; font-style: italic; font-size: 1.4em; }
    .damage-pop.block  { color: #d8a560; font-size: 1.2em; }
    @keyframes damage-pop {
      0%   { transform: translate(-50%,  8px) scale(0.6); opacity: 0; }
      10%  { transform: translate(-50%, -2px) scale(1.15); opacity: 1; }
      70%  { transform: translate(-50%, -28px) scale(1);  opacity: 1; }
      100% { transform: translate(-50%, -52px) scale(1);  opacity: 0; }
    }

    /* Attacker lunge â€” caster slides briefly toward the target */
    @keyframes lunge-right { 0%, 100% { transform: translateX(0); } 35% { transform: translateX(10px); } }
    @keyframes lunge-left  { 0%, 100% { transform: translateX(0); } 35% { transform: translateX(-10px); } }
    .lunge-right { animation: lunge-right 0.32s ease-out; }
    .lunge-left  { animation: lunge-left  0.32s ease-out; }

    /* Gentle pulse on every status pill so they read as "active" */
    @keyframes status-pulse {
      0%, 100% { box-shadow: 0 0 0   currentColor; }
      50%      { box-shadow: 0 0 8px currentColor; }
    }
    .status-pill { animation: status-pulse 1.6s ease-in-out infinite; }

    /* When a status is FRESHLY applied, flash 3 times before settling into the steady pulse */
    @keyframes status-flash {
      0%   { transform: scale(1);   box-shadow: 0 0 0 currentColor; }
      12%  { transform: scale(1.45); box-shadow: 0 0 18px currentColor, 0 0 28px currentColor; }
      25%  { transform: scale(1);   box-shadow: 0 0 0 currentColor; }
      45%  { transform: scale(1.45); box-shadow: 0 0 18px currentColor, 0 0 28px currentColor; }
      60%  { transform: scale(1);   box-shadow: 0 0 0 currentColor; }
      80%  { transform: scale(1.3); box-shadow: 0 0 12px currentColor; }
      100% { transform: scale(1);   box-shadow: 0 0 0 currentColor; }
    }
    .status-pill.freshly-applied {
      animation: status-flash 1.6s ease-out, status-pulse 1.6s ease-in-out 1.6s infinite;
    }

    /* Full-screen tint pulse â€” red for damage, gold for victory */
    .screen-flash {
      position: fixed;
      inset: 0;
      pointer-events: none;
      background: transparent;
      z-index: 999;
    }
    .screen-flash.flash-red  { animation: flash-red  0.5s ease-out forwards; }
    .screen-flash.flash-gold { animation: flash-gold 0.7s ease-out forwards; }
    @keyframes flash-red  {
      0%   { background: rgba(192, 32, 32, 0.35); }
      100% { background: rgba(192, 32, 32, 0); }
    }
    @keyframes flash-gold {
      0%   { background: rgba(212, 168, 75, 0.35); }
      100% { background: rgba(212, 168, 75, 0); }
    }

    /* HP bar shake when its owner loses health */
    @keyframes hp-shake {
      0%, 100% { transform: translateX(0); }
      20% { transform: translateX(-3px); }
      40% { transform: translateX(3px); }
      60% { transform: translateX(-2px); }
      80% { transform: translateX(1px); }
    }
    .health-track.hp-shake { animation: hp-shake 0.32s ease-in-out; }

    /* Hit reaction â€” small left/right shake when a combatant takes damage */
    @keyframes hit-shake {
      0%, 100% { transform: translateX(0); }
      20%      { transform: translateX(-6px); }
      40%      { transform: translateX(6px); }
      60%      { transform: translateX(-4px); }
      80%      { transform: translateX(3px); }
    }
    .shake { animation: hit-shake 0.35s ease-in-out; }

    /* Targeting mode: clickable enemies show a crosshair and highlight on hover */
    .enemy-card.targetable { cursor: crosshair; }
    .enemy-card.targetable:hover {
      outline: 2px solid #d4a84b;
      outline-offset: 3px;
      transform: translateY(-2px);
    }

    .combat-log {
      background: #0e0e0e;
      border: 1px solid #1e180e;
      border-radius: 6px;
      padding: 14px 16px;
      min-height: 90px;
      max-height: 160px;
      overflow-y: auto;
      margin-bottom: 18px;
      font-size: 0.92em;
      line-height: 1.6;
    }
    .combat-log p { margin-bottom: 4px; }
    .combat-log .log-player { color: #7ec88f; }
    .combat-log .log-enemy  { color: #d08080; }
    .combat-log .log-result { color: #d4a84b; font-weight: bold; margin-top: 6px; }

    .combat-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .combat-actions button {
      background: #1a150d;
      color: #c4b08a;
      border: 1px solid #2e2416;
      padding: 14px;
      font-size: 0.95em;
      border-radius: 4px;
    }
    .combat-actions button:hover:not(:disabled) { background: #2a2010; border-color: #5a421e; color: #d4a84b; }
    .combat-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

    /* Fire-type spell buttons â€” dark burnt orange */
    .combat-actions button[data-damage-type="fire"] {
      background: #2a1408;
      border-color: #7a3a10;
      color: #e06820;
    }
    .combat-actions button[data-damage-type="fire"]:hover:not(:disabled) {
      background: #3a1e0c;
      border-color: #9a4a18;
      color: #ffcc94;
    }
    /* Magicana â€” purple */
    .combat-actions button[data-damage-type="magicana"] {
      background: #2a1840;
      border-color: #6a4aa0;
      color: #c8a8ff;
    }
    .combat-actions button[data-damage-type="magicana"]:hover:not(:disabled) {
      background: #3a2050;
      border-color: #7a5ab0;
      color: #d8b8ff;
    }
    /* Rune â€” light blue */
    .combat-actions button[data-damage-type="rune"] {
      background: #14283a;
      border-color: #4a7aa0;
      color: #a8d8ff;
    }
    .combat-actions button[data-damage-type="rune"]:hover:not(:disabled) {
      background: #1a3450;
      border-color: #5a8ab0;
      color: #b8e0ff;
    }

    /* â”€â”€ Dialogue stage (player | text | NPC) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .dialogue-stage { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
    .dia-side { flex-shrink: 0; width: 130px; text-align: center; }
    .dia-sprite {
      width: 130px;
      height: 130px;
      object-fit: contain;
      background: #141414;
      border: 1px solid #2e2416;
      border-radius: 6px;
      image-rendering: pixelated;
      display: block;
      margin: 0 auto 6px;
    }
    .dia-name { color: #d4a84b; font-size: 0.9em; }
    .dialogue-text {
      flex: 1;
      min-width: 0;
      align-self: stretch;
      background: #0e0e0e;
      border: 1px solid #1e180e;
      border-radius: 6px;
      padding: 18px 20px;
      min-height: 130px;
    }
    .dialogue-text p { margin-bottom: 0.8em; }
    .dialogue-text p:last-child { margin-bottom: 0; }
    @media (max-width: 560px) {
      .dia-side { width: 84px; }
      .dia-sprite { width: 84px; height: 84px; }
    }

    /* â”€â”€ Spell Book (Human) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #spellbook-screen.active { max-width: 760px; }
    .equipped-slots {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      margin-top: 6px;
    }
    @media (max-width: 520px) { .equipped-slots { grid-template-columns: repeat(2, 1fr); } }
    .spell-slot {
      background: #141008;
      border: 2px dashed #2e2416;
      border-radius: 6px;
      padding: 14px 10px;
      text-align: center;
      min-height: 68px;
      transition: background 0.15s, border-color 0.15s, transform 0.1s;
    }
    .spell-slot.filled { border-style: solid; border-color: #5a421e; cursor: grab; }
    .spell-slot.filled:active { cursor: grabbing; }
    .spell-slot.empty { color: #5a4a28; font-style: italic; }
    .spell-slot.drag-over { border-color: #d4a84b; background: #1e1a0e; }
    .spell-slot .spell-name { color: #d4a84b; font-size: 0.95em; }
    .spell-slot .spell-meta { color: #8a7050; font-size: 0.78em; margin-top: 4px; }

    .spell-book-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      gap: 10px;
      min-height: 90px;
      padding: 10px;
      background: #0c0a04;
      border: 1px dashed #2e2416;
      border-radius: 6px;
      margin-top: 6px;
    }
    .spell-book-list.drag-over { border-color: #d4a84b; background: #14100a; }
    .spell-book-list .empty-book {
      grid-column: 1 / -1;
      text-align: center;
      color: #5a4a28;
      font-style: italic;
      padding: 14px 0;
    }
    .spell-card {
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 10px;
      cursor: grab;
      text-align: center;
      transition: background 0.15s, border-color 0.15s;
    }
    .spell-card:hover { background: #1e1a0e; border-color: #5a421e; }
    .spell-card:active { cursor: grabbing; }
    .spell-card .spell-name { color: #d4a84b; font-size: 0.92em; }
    .spell-card .spell-meta { color: #8a7050; font-size: 0.76em; margin-top: 3px; }

    /* Damage-type colour coding — mirrors combat action button colours */
    .spell-slot.filled[data-damage-type="fire"]     { border-color: #7a3a10; }
    .spell-slot[data-damage-type="fire"]     .spell-name { color: #e06820; }
    .spell-slot.filled[data-damage-type="magicana"]  { border-color: #6a4aa0; }
    .spell-slot[data-damage-type="magicana"] .spell-name { color: #c8a8ff; }
    .spell-slot.filled[data-damage-type="rune"]      { border-color: #4a7aa0; }
    .spell-slot[data-damage-type="rune"]     .spell-name { color: #a8d8ff; }

    .spell-card[data-damage-type="fire"]     { border-color: #7a3a10; background: #2a1408; }
    .spell-card[data-damage-type="fire"]     .spell-name { color: #e06820; }
    .spell-card[data-damage-type="magicana"] { border-color: #6a4aa0; background: #2a1840; }
    .spell-card[data-damage-type="magicana"] .spell-name { color: #c8a8ff; }
    .spell-card[data-damage-type="rune"]     { border-color: #4a7aa0; background: #14283a; }
    .spell-card[data-damage-type="rune"]     .spell-name { color: #a8d8ff; }

    /* History viewer modal */
    .history-modal-card {
      max-width: 680px; width: 92%; max-height: 78vh;
      display: flex; flex-direction: column;
    }
    .history-modal-header {
      display: flex; justify-content: space-between; align-items: center;
      margin-bottom: 16px; flex-shrink: 0;
    }
    .history-modal-header h3 { color: #d4a84b; margin: 0; font-size: 1.1em; letter-spacing: 0.06em; }
    .history-content { overflow-y: auto; flex: 1; }
    .history-turn {
      margin-bottom: 22px; padding-bottom: 22px;
      border-bottom: 1px solid #1e180e;
    }
    .history-turn:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
    .history-narration { color: #c4b08a; font-size: 0.91em; line-height: 1.7; margin-bottom: 0.5em; }
    .history-narration:last-of-type { margin-bottom: 0; }
    .history-choice {
      color: #6a8050; font-size: 0.82em; font-style: italic;
      margin-top: 10px; padding-top: 8px; border-top: 1px solid #1a1810;
    }
    .history-choice::before { content: '▶ '; color: #5a6840; }

    /* Energy warning modal */
    .energy-warn-card { max-width: 460px; text-align: center; }
    .energy-warn-card[data-tone="urgent"] { border-color: #8a4020; }
    .energy-warn-icon { font-size: 2.2em; margin-bottom: 8px; }
    .energy-warn-title { color: #d4a84b; font-size: 1.25em; margin-bottom: 10px; letter-spacing: 0.06em; }
    .energy-warn-body { color: #c4b08a; font-size: 0.93em; line-height: 1.65; margin-bottom: 20px; }
    .energy-warn-body strong { color: #e8c870; }

    .energy-how-to { background: #0e0e0e; border: 1px solid #1e180e; border-radius: 6px; padding: 14px 16px; margin-bottom: 18px; text-align: left; }
    .energy-how-label { color: #8a7050; font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; }
    .energy-how-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
    .energy-how-step { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88em; color: #c4b08a; line-height: 1.5; }
    .energy-how-num { background: #2a1e0a; border: 1px solid #5a421e; color: #d4a84b; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.78em; flex-shrink: 0; margin-top: 1px; }
    .energy-how-step strong { color: #e8c870; }

    .energy-how-diagram { background: #141008; border: 1px solid #2e2416; border-radius: 4px; padding: 8px 12px; }
    .energy-diag-header { display: flex; align-items: center; gap: 10px; font-size: 0.85em; }
    .energy-diag-title { color: #d4a84b; flex: 1; }
    .energy-diag-indicator { background: #0a0a0a; border: 1px solid #5a6a80; color: #6a9ab8; padding: 2px 8px; border-radius: 3px; font-size: 0.88em; cursor: pointer; position: relative; }
    .energy-diag-bag { color: #6a5a3a; }
    .energy-diag-arrow { color: #7ec88f; font-size: 0.78em; font-style: italic; white-space: nowrap; }

    .energy-warn-dismiss { background: none; border: none; color: #5a4a28; font: inherit; font-size: 0.85em; cursor: pointer; margin-top: 10px; text-decoration: underline; display: block; width: 100%; }
    .energy-warn-dismiss:hover { color: #8a7050; }

    /* Spell detail modal */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.72);
      align-items: center;
      justify-content: center;
      z-index: 1000;
      padding: 20px;
    }
    .modal-overlay.show { display: flex; }
    .modal-card {
      background: #141008;
      border: 1px solid #5a421e;
      border-radius: 8px;
      padding: 24px 26px;
      max-width: 440px;
      width: 100%;
      position: relative;
      box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    }
    .modal-close {
      position: absolute;
      top: 6px;
      right: 12px;
      background: transparent;
      border: none;
      color: #6a5a3a;
      font-size: 1.6em;
      cursor: pointer;
      padding: 4px 10px;
      line-height: 1;
    }
    .modal-close:hover { color: #d4a84b; }
    .spell-modal-name   { color: #d4a84b; font-size: 1.35em; margin-bottom: 4px; }
    .spell-modal-damage { color: #8a7050; font-size: 0.85em; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px; }
    .spell-modal-desc   { color: #c4b08a; line-height: 1.55; margin-bottom: 22px; }
    #spell-modal-action { width: 100%; }

    /* Floating "See Stats" button anchored next to a clicked enemy */
    .examine-menu {
      position: fixed;
      z-index: 800;
      background: #141008;
      border: 1px solid #5a421e;
      border-radius: 6px;
      padding: 6px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    }
    .examine-menu .btn-primary {
      padding: 6px 16px;
      font-size: 0.85em;
      letter-spacing: 0.04em;
      text-transform: none;
      margin: 0;
    }

    /* Enemy stats modal */
    .stats-modal-card { max-width: 480px; max-height: 85vh; overflow-y: auto; }
    .stats-modal-portrait {
      width: 96px; height: 96px;
      object-fit: contain;
      background: #0c0a04;
      border: 1px solid #2e2416;
      border-radius: 4px;
      display: block;
      margin: 0 auto 12px;
      image-rendering: pixelated;
    }
    .stats-modal-section { margin-bottom: 14px; }
    .stats-modal-section:last-child { margin-bottom: 0; }
    .stats-modal-section-label {
      color: #8a7050;
      font-size: 0.74em;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      margin-bottom: 6px;
    }
    .stats-modal-list {
      list-style: none;
      background: #0c0a04;
      border: 1px solid #2e2416;
      border-radius: 4px;
      padding: 4px 10px;
      margin: 0;
    }
    .stats-modal-list li {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      font-size: 0.88em;
      padding: 4px 0;
      color: #c4b08a;
    }
    .stats-modal-list li:not(:last-child) { border-bottom: 1px solid #1e180e; }
    .stats-modal-list .stat-label    { text-transform: capitalize; }
    .stats-modal-list .stat-value    { color: #d4a84b; font-weight: bold; }
    .stats-modal-list .stat-meta     { color: #6a8aa8; font-size: 0.78em; }
    #stats-modal-bg { margin-bottom: 0; }
    /* Passive rows wrap their description onto a new line under the name */
    #stats-modal-passives li { flex-direction: column; align-items: flex-start; gap: 2px; }
    #stats-modal-passives .stat-label { color: #d4a84b; }
    #stats-modal-passives .stat-meta  { color: #c4b08a; font-size: 0.82em; line-height: 1.4; }

    /* â”€â”€ Tutorial Arena scenarios â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #arena-screen.active { max-width: 820px; }
    .arena-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 12px;
    }
    .arena-card {
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 14px 16px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
    }
    .arena-card:hover { background: #1e1a0e; border-color: #5a421e; }
    .arena-card .scn-name { color: #d4a84b; font-size: 1em; margin-bottom: 4px; }
    .arena-card .scn-desc { color: #8a7050; font-size: 0.85em; margin-bottom: 8px; line-height: 1.4; }
    .arena-card .scn-fighters { color: #6a8aa8; font-size: 0.78em; }

    /* â”€â”€ Custom (free-text) action â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .custom-action { display: flex; gap: 8px; margin-top: 12px; }
    #custom-input {
      flex: 1;
      margin-bottom: 0;            /* override the shared input margin in the action row */
      padding: 10px 12px;
      font-size: 0.92em;
    }
    #custom-input:focus { border-color: #5a421e; }
    .btn-custom {
      background: #2a1e0a;
      color: #d4a84b;
      border: 1px solid #5a421e;
      padding: 0 18px;
      border-radius: 4px;
      font-size: 0.9em;
      letter-spacing: 0.06em;
    }
    .btn-custom:hover:not(:disabled) { background: #3a2a10; }
    .btn-custom:disabled, #custom-input:disabled { opacity: 0.4; cursor: not-allowed; }
    .custom-msg { display: none; margin-top: 8px; color: #c08a4a; font-size: 0.88em; font-style: italic; }

    /* â”€â”€ Character select â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .character-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 12px;
    }
    .character-card {
      position: relative;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 14px;
      text-align: center;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
    }
    .character-card:hover { background: #1e1a0e; border-color: #5a421e; }
    .character-card img {
      width: 96px;
      height: 96px;
      object-fit: contain;
      background: #141414;
      border-radius: 4px;
      margin-bottom: 8px;
      image-rendering: pixelated;
    }
    .character-card .char-name { color: #d4a84b; font-size: 1em; margin-bottom: 4px; }
    .character-card .char-meta { color: #8a7050; font-size: 0.82em; }
    .character-card .delete-btn {
      position: absolute;
      top: 4px;
      right: 6px;
      background: transparent;
      border: none;
      color: #4a3a20;
      cursor: pointer;
      padding: 4px 8px;
      font-size: 1.1em;
      line-height: 1;
    }
    .character-card .delete-btn:hover { color: #b04040; }
    .empty-msg { font-style: italic; color: #6a5a3a; text-align: center; padding: 30px 0; grid-column: 1 / -1; }

    /* Hero picker (in the creation form) */
    .hero-picker { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
    .hero-option {
      flex: 1;
      min-width: 130px;
      background: #141008;
      border: 2px solid #2e2416;
      border-radius: 6px;
      padding: 12px;
      cursor: pointer;
      text-align: center;
      transition: border-color 0.15s, background 0.15s;
    }
    .hero-option:hover { border-color: #5a421e; }
    .hero-option.selected { border-color: #d4a84b; background: #1e1a0e; }
    .hero-option img {
      width: 90px;
      height: 90px;
      object-fit: contain;
      background: #141414;
      border-radius: 4px;
      image-rendering: pixelated;
      margin-bottom: 8px;
    }
    .hero-option .hero-name { color: #d4a84b; font-size: 0.95em; margin-bottom: 4px; }
    .hero-option .hero-blurb { color: #8a7050; font-size: 0.78em; margin-bottom: 6px; }
    .hero-option .hero-stats { color: #c4b08a; font-size: 0.74em; letter-spacing: 0.02em; }
    .hero-option.locked {
      cursor: not-allowed;
      opacity: 0.45;
      filter: grayscale(0.85);
    }
    .hero-option.locked:hover { border-color: #2e2416; background: #141008; }   /* no hover highlight */
    .hero-option .hero-lock {
      margin-top: 6px;
      color: #b08a4a;
      font-size: 0.72em;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    /* Sprite variant picker — choose your look within a race */
    #sprite-variant-picker { margin-bottom: 22px; }
    .sprite-variant-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
    .sprite-variant {
      width: 88px; height: 88px;
      border: 2px solid #2e2416;
      border-radius: 6px;
      background: #141414;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      transition: border-color 0.15s, background 0.15s;
    }
    .sprite-variant:hover { border-color: #5a421e; background: #1a1408; }
    .sprite-variant.selected { border-color: #d4a84b; background: #1e1a0e; }
    .sprite-variant-img {
      width: 100%; height: 100%;
      object-fit: contain;
      image-rendering: pixelated;
    }

    /* â”€â”€ Level select â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .level-list { display: flex; flex-direction: column; gap: 12px; }
    .level-card {
      text-align: left;
      width: 100%;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 16px 18px;
      color: #c4b08a;
    }
    .level-card:hover:not(.locked):not(:disabled) { background: #1e1a0e; border-color: #5a421e; }
    .level-card.locked, .level-card:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }

    /* â”€â”€ Game-mode menu â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .mode-grid { display: flex; flex-direction: column; gap: 14px; }
    .mode-card {
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 22px 24px;
      text-align: left;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s;
      color: inherit;
      font-family: inherit;
    }
    .mode-card:hover:not(.locked):not(:disabled) {
      background: #1e1a0e;
      border-color: #5a421e;
    }
    .mode-card.locked, .mode-card:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }
    .mode-card .mode-name { color: #d4a84b; font-size: 1.25em; margin-bottom: 6px; }
    .mode-card .mode-desc { color: #c4b08a; font-size: 0.9em; line-height: 1.45; }

    /* â”€â”€ Tutorial screen â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #tutorial-screen.active { max-width: 680px; }
    .tut-beta-badge {
      display: inline-block; background: #3a2010; border: 1px solid #8a5224;
      color: #ffa060; font-size: 0.72em; font-weight: bold; letter-spacing: 0.1em;
      text-transform: uppercase; padding: 3px 10px; border-radius: 3px; margin-bottom: 16px;
    }
    .tut-section-label {
      color: #8a7050; font-size: 0.72em; letter-spacing: 0.12em; text-transform: uppercase;
      margin: 24px 0 10px;
    }
    .tut-modes { display: flex; gap: 10px; margin-bottom: 4px; }
    .tut-mode-card {
      flex: 1; background: #141008; border: 1px solid #2e2416; border-radius: 6px;
      padding: 12px 10px; text-align: center;
    }
    .tut-mode-icon { font-size: 1.6em; margin-bottom: 6px; }
    .tut-mode-name { color: #d4a84b; font-size: 0.9em; font-weight: bold; margin-bottom: 4px; }
    .tut-mode-desc { color: #8a7050; font-size: 0.76em; line-height: 1.4; }
    .tut-rows { display: flex; flex-direction: column; gap: 10px; }
    .tut-row {
      display: flex; align-items: flex-start; gap: 12px;
      background: #141008; border: 1px solid #2e2416; border-radius: 6px; padding: 12px 14px;
    }
    .tut-row-icon { font-size: 1.5em; flex-shrink: 0; margin-top: 1px; }
    .tut-row-body {}
    .tut-row-title { color: #d4a84b; font-size: 0.9em; font-weight: bold; margin-bottom: 3px; }
    .tut-row-text  { color: #8a7050; font-size: 0.82em; line-height: 1.45; }
    .tut-lock-note {
      color: #6a5030; font-size: 0.76em; text-align: center; margin-top: 8px; margin-bottom: 0;
    }

    /* â”€â”€ Mode picker (character creation) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .mode-pick-grid { display: flex; gap: 10px; margin-bottom: 14px; }
    .mode-pick-card {
      flex: 1; padding: 12px 10px; background: #141008; border: 1px solid #2e2416;
      border-radius: 6px; cursor: pointer; text-align: center; transition: border-color 0.15s, background 0.15s;
    }
    .mode-pick-card:hover { background: #1e1a0e; border-color: #5a421e; }
    .mode-pick-card.selected { border-color: #d4a84b; background: #1e1a0e; }
    .mode-pick-card.locked { opacity: 0.45; cursor: not-allowed; }
    .mode-pick-card.locked:hover { background: #141008; border-color: #2e2416; }
    .mode-pick-card .mpick-name { color: #d4a84b; font-size: 0.95em; font-weight: bold; margin-bottom: 4px; }
    .mode-pick-card .mpick-desc { font-size: 0.78em; color: #8a7050; line-height: 1.35; }

    /* â”€â”€ Rest screen (between arena rounds) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #rest-screen { text-align: center; }
    .rest-portrait {
      width: 128px; height: 128px;
      object-fit: contain;
      background: #0c0a04;
      border: 1px solid #5a421e;
      border-radius: 6px;
      display: block;
      margin: 20px auto;
      image-rendering: pixelated;
    }
    .rest-info {
      max-width: 320px;
      margin: 0 auto 22px;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 12px 18px;
    }
    .rest-info-row {
      display: flex;
      justify-content: space-between;
      padding: 6px 0;
      font-size: 0.95em;
    }
    .rest-info-row:not(:last-child) { border-bottom: 1px solid #1e180e; }
    .rest-info-label { color: #8a7050; }
    .rest-info-value { color: #d4a84b; font-weight: bold; }
    .rest-actions {
      display: flex;
      gap: 12px;
      justify-content: center;
      flex-wrap: wrap;
      margin-top: 8px;
    }
    .rest-actions .btn-primary { min-width: 160px; }
    .rest-xp-wrap { max-width: 320px; margin: 0 auto 22px; }
    .rest-xp-track {
      height: 10px;
      background: #0c0a04;
      border: 1px solid #2e2416;
      border-radius: 5px;
      overflow: hidden;
    }
    .rest-xp-fill {
      height: 100%;
      background: linear-gradient(90deg, #6a5a2a, #d4a84b);
      width: 0%;
      transition: width 0.5s ease;
    }
    .rest-xp-text { color: #8a7050; font-size: 0.8em; margin-top: 5px; }
    .rest-levelup-badge { color: #ffd860; font-weight: bold; }

    /* Small gold "N pts" badge on buttons that lead to unspent stat points */
    .points-badge {
      display: inline-block;
      background: #d4a84b;
      color: #1a1206;
      font-size: 0.72em;
      font-weight: bold;
      border-radius: 9px;
      padding: 1px 7px;
      margin-left: 5px;
      vertical-align: middle;
    }
    .mode-footer { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

    /* â”€â”€ Character / Level-Up screen â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    #character-stats-screen { max-width: 560px; }
    .cstats-head { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
    .cstats-portrait {
      width: 96px; height: 96px;
      object-fit: contain;
      background: #0c0a04;
      border: 1px solid #5a421e;
      border-radius: 6px;
      image-rendering: pixelated;
      flex-shrink: 0;
    }
    .cstats-id { flex: 1; min-width: 0; }
    .cstats-name  { color: #d4a84b; font-size: 1.3em; }
    .cstats-level { color: #c4b08a; font-size: 0.9em; margin: 2px 0 8px; }
    .cstats-xp-track {
      height: 9px;
      background: #0c0a04;
      border: 1px solid #2e2416;
      border-radius: 5px;
      overflow: hidden;
    }
    .cstats-xp-fill {
      height: 100%;
      background: linear-gradient(90deg, #6a5a2a, #d4a84b);
      width: 0%;
      transition: width 0.4s ease;
    }
    .cstats-xp-text { color: #8a7050; font-size: 0.76em; margin-top: 4px; }

    .cstats-vitals { display: flex; gap: 12px; margin-bottom: 16px; }
    .cstats-vital {
      flex: 1;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 10px 14px;
      text-align: center;
    }
    .cstats-vital-label { display: block; color: #8a7050; font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.08em; }
    .cstats-vital-value { display: block; color: #d4a84b; font-size: 1.3em; font-weight: bold; margin-top: 3px; }

    .cstats-points-banner {
      background: rgba(212, 168, 75, 0.14);
      border: 1px solid #6a5a2a;
      border-radius: 6px;
      padding: 10px 14px;
      color: #ffd860;
      text-align: center;
      margin-bottom: 16px;
      font-size: 0.95em;
    }

    .cstats-section-label { color: #8a7050; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
    .cstats-section-hint  { text-transform: none; letter-spacing: 0; color: #5a4a32; }
    .cstats-list { list-style: none; padding: 0; margin: 0 0 16px; }
    .cstats-list li {
      display: flex;
      align-items: center;
      gap: 10px;
      background: #141008;
      border: 1px solid #2e2416;
      border-radius: 6px;
      padding: 10px 14px;
      margin-bottom: 8px;
    }
    .cstats-stat-name  { flex: 1; color: #c4b08a; }
    .cstats-stat-value { color: #d4a84b; font-weight: bold; font-size: 1.1em; min-width: 56px; text-align: right; }
    .cstats-stat-pending { color: #7ec88f; font-size: 0.85em; }
    .cstats-btn {
      width: 30px; height: 30px;
      border-radius: 4px;
      border: 1px solid #5a421e;
      background: #2a1e0a;
      color: #d4a84b;
      font-size: 1.1em;
      line-height: 1;
      cursor: pointer;
      flex-shrink: 0;
    }
    .cstats-btn:hover:not(:disabled) { background: #3a2a12; }
    .cstats-btn:disabled { opacity: 0.3; cursor: not-allowed; }
    .cstats-actions { display: flex; gap: 12px; justify-content: flex-end; }
    .level-name { color: #d4a84b; font-size: 1.1em; margin-bottom: 4px; }
    .level-blurb { font-size: 0.9em; color: #8a7050; line-height: 1.4; }
