  @font-face {
    font-family: "Ode to Idle Gaming";
    src: url("./fonts/OdeToIdleGaming.woff2") format("woff2"),
         url("./fonts/OdeToIdleGaming.ttf")   format("truetype"),
         url("https://db.onlinewebfonts.com/t/1482f9c9cd6006a2420e3b15d38f68d3.woff2") format("woff2");
    font-display: swap;
  }

  :root {
    --bark:    #6b352a;
    --bark-d:  #4a231b;
    --bark-dd: #2e130d;
    --bark-l:  #8f4a39;
    --cream:   #f2e3d0;
    --ember:   #e0a054;
    --silver:  #c8ccd2;
    --gold:    #e5bb4e;
    --online:  #5ad46a;

    /* The scene is the strip between these two, so trimming them is what
       widens the playfield. */
    --panel-l: 306px;
    --panel-r: 340px;
  }

  /* Wade fishing swaps the whole palette from bark to swamp green. Only the
     custom properties change, so every panel, tab, dialog and slot follows
     without a single extra rule. Set by paintArea() on the root element. */
  html.area-wade {
    --bark:    #2f5a3a;
    --bark-d:  #1e3d28;
    --bark-dd: #12251a;
    --bark-l:  #467a4e;
    --cream:   #e2f0dc;
    --ember:   #8fc86a;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    height: 100%;
    background: var(--bark-dd);
    color: var(--cream);
    overflow: hidden;
    overscroll-behavior: none;
    font-family: "Ode to Idle Gaming", "Trebuchet MS", system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: .06em;
    -webkit-font-smoothing: antialiased;
  }

  #stage {
    position: fixed;
    inset: 0;
    display: block;
    touch-action: none;
    z-index: 0;
  }

  .panel {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bark);
    box-shadow: 0 0 24px rgba(0,0,0,.55);
    user-select: none;
    scrollbar-width: thin;
    scrollbar-color: var(--bark-l) transparent;
  }
  .panel::-webkit-scrollbar       { width: 9px; }
  .panel::-webkit-scrollbar-thumb { background: var(--bark-l); border-radius: 5px; }

  .panel--left  { left: 0;  width: var(--panel-l); border-right: 3px solid var(--bark-l); }
  .panel--right { right: 0; width: var(--panel-r); border-left:  3px solid var(--bark-l); }

  .ident {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bark-d);
    border-bottom: 2px solid var(--bark-l);
  }
  /* Name, level and the xp bar read as one card; the purse is its own below. */
  .ident__box {
    padding: 10px 11px;
    background: var(--bark-dd);
    border: 2px solid var(--bark-l);
    border-radius: 5px;
  }
  .ident__name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    line-height: 1.1;
    word-break: break-word;
  }
  .dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--online);
    box-shadow: 0 0 0 2px rgba(46,19,13,.6), 0 0 9px var(--online);
    animation: pulse 2.4s ease-in-out infinite;
  }
  @keyframes pulse { 50% { opacity: .45; } }
  @media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

  .ident__level { margin-left: auto; font-size: 12px; color: var(--ember); }

  .bars {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px;
  }
  .panel--right .bars { flex-direction: row; border-bottom: 2px solid var(--bark-l); }
  .panel--right .bar  { flex: 1 1 0; text-align: center; }

  .bar {
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--cream);
    background: var(--bark-d);
    border: 2px solid var(--bark-l);
    border-radius: 3px;
    padding: 11px 12px;
    cursor: pointer;
    transition: background .12s, transform .12s, color .12s;
  }
  .bar:hover  { background: var(--bark-l); }
  .bar:active { transform: translateY(1px); }
  .bar:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
  .bar[aria-selected="true"] {
    background: var(--ember);
    border-color: var(--ember);
    color: var(--bark-dd);
  }

  /* ── Nav group ───────────────────────────────────────────────────────── */
  /* A labelled, collapsible cluster of tabs inside the left menu. */
  .navgrp {
    border-top: 1px dashed var(--bark-l);
    border-bottom: 1px dashed var(--bark-l);
    padding: 6px 0 8px;
  }
  .navgrp__h {
    display: flex;
    align-items: center;
    width: 100%;
    font: inherit;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: left;
    color: rgba(242,227,208,.6);
    background: none;
    border: 0;
    padding: 6px 4px;
    cursor: pointer;
  }
  .navgrp__h:hover { color: var(--cream); }
  .navgrp__chev {
    margin-left: auto;
    width: 8px; height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .15s;
  }
  .navgrp__h[aria-expanded="false"] .navgrp__chev {
    transform: rotate(-45deg) translate(-2px, 2px);
  }
  .navgrp__body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 10px;
  }
  .navgrp__body .bar {
    background: var(--bark-d);
    border-color: var(--bark-l);
    padding: 8px 10px;
  }
  .navgrp__body .bar:hover { background: var(--bark-l); }
  .navgrp__body .bar[aria-selected="true"] {
    background: var(--ember);
    border-color: var(--ember);
  }

  .party {
    flex: none;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0 2px;
  }
  .party__slot {
    flex: 1 1 0;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--bark-d);
    border: 2px dashed var(--bark-l);
    cursor: pointer;
    transition: border-color .12s, background .12s;
  }
  .party__slot:hover { border-color: var(--ember); background: rgba(224,160,84,.12); }
  .party__slot:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

  .topbar {
    position: fixed;
    top: 0;
    left: var(--panel-l);
    right: var(--panel-r);
    z-index: 2;
    display: flex;
    justify-content: center;
    padding: 14px;
    pointer-events: none;
  }
  .topbar .bar {
    pointer-events: auto;
    min-width: 132px;
    text-align: center;
    background: var(--bark);
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
  }

  /* Wrench: opens and closes the stats panel, which hangs under it. */
  .hudbtn {
    position: fixed;
    top: 2px;
    left: calc(var(--panel-l) + 2px);
    z-index: 3;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--cream);
    background: var(--bark);
    border: 2px solid var(--bark-l);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
    cursor: pointer;
  }
  .hudbtn:hover { background: var(--bark-l); }
  .hudbtn:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
  .hudbtn svg { width: 17px; height: 17px; fill: currentColor; }
  .hudbtn[aria-expanded="true"] { color: var(--ember); border-color: var(--ember); }

  .hud {
    position: fixed;
    top: 14px;
    left: calc(var(--panel-l) + 30px);
    z-index: 2;
    width: 178px;
    padding: 9px 10px;
    background: var(--bark);
    border: 2px solid var(--bark-l);
    border-radius: 3px;
    box-shadow: 0 4px 14px rgba(0,0,0,.45);
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
  }
  .hud__row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 9px;
    color: rgba(242,227,208,.6);
  }
  .hud__row b { font-weight: normal; font-size: 10px; color: var(--ember); }

  /* ── XP ──────────────────────────────────────────────────────────────── */
  .xp {
    margin-top: 8px;
    height: 11px;
    background: var(--bark-dd);
    border: 2px solid var(--bark-l);
    border-radius: 3px;
    overflow: hidden;
  }
  .xp__fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c07a34, var(--ember));
    transition: width .15s linear;
  }
  .xp__text { margin-top: 5px; font-size: 10px; color: rgba(242,227,208,.55); }

  /* ── Panes ───────────────────────────────────────────────────────────── */
  .panel--right { overflow: hidden; }
  .pane {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--bark-l) transparent;
  }
  .pane[hidden] { display: none; }
  .pane::-webkit-scrollbar       { width: 9px; }
  .pane::-webkit-scrollbar-thumb { background: var(--bark-l); border-radius: 5px; }

  /* ── Fish ────────────────────────────────────────────────────────────── */
