    /* --------------------------------------------------------------------- */
    /* Theme Tokens And Global Document Rules                                */
    /* --------------------------------------------------------------------- */

    :root {
      --bg: #0c0f14;
      --panel: #141b24;
      --border: #2f3948;
      --text: #e6edf3;
      --muted: #96a3b8;
      --panel-strong: rgba(7, 11, 18, 0.94);
      --side-panel-width: clamp(220px, 28vw, 360px);
      --health-fill: linear-gradient(90deg, #7f1d1d 0%, #dc2626 52%, #f97316 100%);
      --voice-fill: linear-gradient(90deg, #0f2a52 0%, #2563eb 55%, #7dd3fc 100%);
      --font-game: "Unscii Fantasy", monospace;
      --safe-top: env(safe-area-inset-top, 0px);
      --safe-right: env(safe-area-inset-right, 0px);
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --safe-left: env(safe-area-inset-left, 0px);
      background-color: var(--bg);
    }

    * { box-sizing: border-box; }

    [hidden] {
      display: none !important;
    }

    @font-face {
      font-family: "Unscii Fantasy";
      src: url("./assets/unscii-fantasy.woff") format("woff");
      font-style: normal;
      font-weight: 400;
      font-display: swap;
    }

    html, body {
      width: 100%;
      min-height: 100%;
      height: 100%;
      overflow: hidden;
    }

    body {
      margin: 0;
      min-height: 100vh;
      min-height: 100dvh;
      font-family: var(--font-game);
      background: radial-gradient(circle at top, #182131 0%, var(--bg) 55%);
      color: var(--text);
    }

    /* --------------------------------------------------------------------- */
    /* App Shell, Status Bar, And Main Layout                                */
    /* --------------------------------------------------------------------- */

    .app {
      width: 100%;
      height: 100vh;
      height: 100dvh;
      min-height: 100vh;
      min-height: 100dvh;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      border: 0;
      background: linear-gradient(180deg, #131a25 0%, #0f151e 100%);
      padding:
        var(--safe-top)
        var(--safe-right)
        var(--safe-bottom)
        var(--safe-left);
    }

    .topbar {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 0.75em;
      padding: 0.35em 0.75em;
      border-bottom: 1px solid var(--border);
      color: var(--muted);
      min-height: 2.2em;
    }

    #status {
      font-size: 0.8em;
      color: var(--muted);
      white-space: nowrap;
      text-align: right;
    }

    .top-log {
      margin: 0;
      padding: 0.12em 0.45em;
      min-height: 1.35em;
      max-height: 1.35em;
      overflow-y: auto;
      overflow-x: hidden;
      white-space: pre;
      line-height: 1.2;
      background: rgba(6, 8, 12, 0.28);
      border: 1px solid var(--border);
      color: #d7dde7;
      font-family: var(--font-game);
    }

    .layout {
      display: grid;
      grid-template-columns: 0 minmax(0, 1fr);
      gap: 0;
      min-height: 0;
      position: relative;
      height: 100%;
      transition: grid-template-columns 180ms ease;
    }

    .app.shell-visible:not(.side-collapsed) .layout {
      grid-template-columns: var(--side-panel-width) minmax(0, 1fr);
    }

    .map-wrap {
      grid-column: 2;
      position: relative;
      padding: 8px;
      border-left: 1px solid var(--border);
      overflow: auto;
      min-width: 0;
      min-height: 0;
      display: flex;
      align-items: flex-start;
      justify-content: flex-start;
      touch-action: none;
      cursor: grab;
      user-select: none;
      -webkit-user-select: none;
    }

    .map-wrap:not(.map-ready) {
      cursor: default;
    }

    .map-wrap.dragging {
      cursor: grabbing;
    }

    .map-stage {
      position: relative;
      display: inline-block;
      line-height: 0;
      margin: auto;
    }

    .map-loading {
      position: absolute;
      inset: 0;
      z-index: 2;
      display: grid;
      place-items: center;
      padding: 1.5rem;
      background:
        radial-gradient(circle at 50% 28%, rgba(31, 48, 71, 0.58) 0%, rgba(12, 15, 20, 0) 58%),
        linear-gradient(180deg, rgba(7, 11, 18, 0.22) 0%, rgba(7, 11, 18, 0.08) 100%);
      text-align: center;
      pointer-events: none;
      max-width: 95vw;
    }

    .map-loading-card {
      width: min(30rem, 100%);
      display: grid;
      justify-items: center;
      gap: 1rem;
    }

    .map-loading-logo {
      width: min(16rem, 52vw);
      height: auto;
      display: block;
      image-rendering: pixelated;
      image-rendering: crisp-edges;
      filter:
        drop-shadow(0 1rem 2.4rem rgba(0, 0, 0, 0.44))
        drop-shadow(0 0 1.5rem rgba(96, 165, 250, 0.12));
    }

    .map-loading-status {
      max-width: 28rem;
      padding: 0.75rem 1rem;
      border: 1px solid rgba(147, 197, 253, 0.22);
      border-radius: 1rem;
      background: rgba(8, 12, 19, 0.72);
      color: #d8e1ee;
      font-size: 0.95rem;
      line-height: 1.45;
      box-shadow:
        0 0.8rem 1.8rem rgba(0, 0, 0, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    }

    /* --------------------------------------------------------------------- */
    /* Shell Toolbar, HUD, And Floating Action Buttons                       */
    /* --------------------------------------------------------------------- */

    .hud-strip {
      position: absolute;
      top: 0.75rem;
      left: 0.75rem;
      z-index: 3;
      display: none;
      align-items: center;
      gap: 0.65rem;
      width: min(28rem, calc(100% - 1.5rem));
      pointer-events: none;
    }

    .hud-toolbar {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      pointer-events: auto;
    }

    .shell-toolbar-button {
      pointer-events: auto;
      flex: 0 0 auto;
      min-width: 2.8rem;
      min-height: 2.8rem;
      display: grid;
      place-items: center;
      appearance: none;
      border: 1px solid rgba(147, 197, 253, 0.34);
      border-radius: 0.95rem;
      padding: 0.55rem;
      font: inherit;
      letter-spacing: 0.04em;
      color: var(--text);
      background:
        linear-gradient(180deg, rgba(21, 31, 46, 0.97) 0%, rgba(9, 14, 22, 0.98) 100%);
      box-shadow:
        0 0.6rem 1.35rem rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
      cursor: pointer;
    }

    .shell-toolbar-button:hover {
      border-color: rgba(147, 197, 253, 0.52);
      background:
        linear-gradient(180deg, rgba(25, 38, 57, 0.98) 0%, rgba(11, 17, 27, 0.99) 100%);
    }

    .shell-toolbar-button:focus-visible {
      outline: 2px solid rgba(147, 197, 253, 0.8);
      outline-offset: 2px;
    }

    .shell-toolbar-button-disabled {
      opacity: 0.45;
      cursor: default;
    }

    .shell-toolbar-button-collapse {
      font-size: 1.2rem;
      line-height: 1;
    }

    .shell-toolbar-button-character {
      padding: 0.35rem;
    }

    .shell-toolbar-button-symbol {
      padding: 0.35rem;
    }

    .shell-toolbar-button-visual {
      width: 1.7rem;
      height: 1.7rem;
    }

    .shell-toolbar-button .action-fab-canvas {
      width: 1.7rem;
      height: 1.7rem;
    }

    .shell-toolbar-button .action-fab-glyph {
      font-size: 1.45rem;
    }

    .shell-toolbar-symbol {
      font-family:
        "Apple Color Emoji",
        "Segoe UI Emoji",
        "Noto Color Emoji",
        "Segoe UI Symbol",
        sans-serif;
      font-size: 1.2rem;
      line-height: 1;
    }

    .action-fabs {
      position: absolute;
      right: 0.9rem;
      bottom: 0.9rem;
      z-index: 6;
      display: grid;
      justify-items: end;
      gap: 0.55rem;
      pointer-events: none;
    }

    .action-fabs.action-fabs-overlay-dialog {
      z-index: 9;
    }

    .action-row {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 0.35rem;
      max-width: min(22rem, calc(100vw - 2rem));
      padding: 0.3rem 0.35rem;
      pointer-events: auto;
    }

    .action-fab-stack {
      position: relative;
      display: grid;
      justify-items: center;
      overflow: visible;
      pointer-events: auto;
    }

    .action-fab {
      position: relative;
      width: 4rem;
      height: 4rem;
      display: grid;
      place-items: center;
      padding: 0;
      border: 1px solid rgba(147, 197, 253, 0.34);
      border-radius: 999px;
      background:
        linear-gradient(180deg, rgba(18, 28, 41, 0.97) 0%, rgba(9, 14, 22, 0.98) 100%);
      box-shadow:
        0 0.75rem 1.45rem rgba(0, 0, 0, 0.38),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
      pointer-events: auto;
      cursor: pointer;
      transition:
        transform 120ms ease,
        opacity 120ms ease,
        box-shadow 120ms ease;
    }

    .action-fab:hover {
      transform: translateY(-1px);
      box-shadow:
        0 0.9rem 1.6rem rgba(0, 0, 0, 0.42),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    }

    .action-fab:focus-visible {
      outline: 2px solid rgba(147, 197, 253, 0.8);
      outline-offset: 2px;
    }

    .action-fab-compact {
      width: 4rem;
      height: 4rem;
      box-shadow:
        0 0.45rem 1rem rgba(0, 0, 0, 0.34),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    }

    .app.side-open .action-fab {
      opacity: 0.42;
      transform: none;
      cursor: default;
      pointer-events: none;
    }

    .app.side-open .action-row {
      opacity: 0.42;
      pointer-events: none;
    }

    .action-fab-icon {
      width: 2rem;
      height: 2rem;
      display: block;
      image-rendering: pixelated;
      image-rendering: crisp-edges;
      pointer-events: none;
    }

    .action-fab-caption {
      position: absolute;
      display: block;
      left: 50%;
      bottom: -0.14rem;
      transform: translateX(-50%);
      z-index: 1;
      max-width: 100%;
      background: rgba(9, 14, 22, 0.86);
      color: rgba(220, 252, 231, 0.98);
      font-size: 0.5rem;
      line-height: 1.1;
      text-align: center;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
      letter-spacing: 0.01em;
      pointer-events: none;
    }

    .action-fab-health {
      position: absolute;
      left: 50%;
      bottom: 0.36rem;
      transform: translateX(-50%);
      width: 1.9rem;
      height: 0.28rem;
      overflow: hidden;
      border: 1px solid rgba(148, 163, 184, 0.24);
      border-radius: 999px;
      background: rgba(6, 9, 14, 0.92);
      box-shadow:
        0 0.2rem 0.45rem rgba(0, 0, 0, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
      pointer-events: none;
    }

    .action-fab-health-fill {
      display: block;
      width: var(--action-hp-fill, 0%);
      height: 100%;
      background: var(--health-fill);
      opacity: 0.97;
    }

    .action-fab-visual {
      width: 2.15rem;
      height: 2.15rem;
      display: grid;
      place-items: center;
      pointer-events: none;
    }

    .action-fab-canvas {
      width: 2.15rem;
      height: 2.15rem;
      image-rendering: pixelated;
      image-rendering: crisp-edges;
    }

    .action-fab-glyph {
      font-size: 1.85rem;
      line-height: 1;
      text-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.6);
    }

    .action-fab-compact .action-fab-visual {
      width: 2.15rem;
      height: 2.15rem;
    }

    .action-fab-compact .action-fab-canvas {
      width: 2.15rem;
      height: 2.15rem;
    }

    .action-fab-compact .action-fab-glyph {
      font-size: 1.85rem;
    }

    .action-fab-compact .action-fab-health {
      width: 1.65rem;
      height: 0.24rem;
      bottom: 0.34rem;
    }

    .song-fab.song-fab-active,
    .state-fab.state-fab-active {
      border-color: rgba(134, 239, 172, 0.6);
      border-width: 3px;
      background:
        linear-gradient(180deg, rgba(18, 48, 31, 0.97) 0%, rgba(7, 28, 15, 0.99) 100%);
      box-shadow:
        0 0.85rem 1.55rem rgba(8, 50, 28, 0.42),
        inset 0 0 0 1px rgba(220, 252, 231, 0.08);
    }

    .song-fab.song-fab-active:hover,
    .state-fab.state-fab-active:hover {
      box-shadow:
        0 0.95rem 1.7rem rgba(12, 68, 36, 0.44),
        inset 0 0 0 1px rgba(220, 252, 231, 0.1);
    }

    .adjacent-action-fab-danger {
      border-color: rgba(248, 113, 113, 0.58);
      background:
        linear-gradient(180deg, rgba(76, 18, 26, 0.98) 0%, rgba(38, 8, 12, 0.98) 100%);
      box-shadow:
        0 0.5rem 1.2rem rgba(94, 15, 23, 0.38),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    }

    .adjacent-action-fab-danger:hover {
      box-shadow:
        0 0.75rem 1.45rem rgba(128, 18, 30, 0.42),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    }

    .hud-bars {
      display: grid;
      min-width: 0;
      flex: 1 1 auto;
    }

    .hud-bar {
      position: relative;
      overflow: hidden;
      min-width: 6rem;
      border: 1px solid rgba(148, 163, 184, 0.24);
      border-radius: 999px;
      background: rgba(6, 9, 14, 0.9);
      box-shadow:
        0 0.55rem 1.2rem rgba(0, 0, 0, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    }

    .hud-bar-fill {
      position: absolute;
      inset: 0 auto 0 0;
      width: var(--bar-fill, 0%);
      min-width: 0;
      opacity: 0.95;
    }

    .hud-bar-health .hud-bar-fill {
      background: var(--health-fill);
    }

    .hud-bar-voice .hud-bar-fill {
      background: var(--voice-fill);
    }

    .hud-bar-copy {
      position: relative;
      z-index: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 .5rem;
      color: #f8fbff;
      text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
      font-size: .6rem;
      line-height: 1;
      padding: 0 1em;
    }

    .hud-bar-label,
    .hud-bar-value {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .hud-bar-value {
      color: #eef6ff;
    }

    .hud-bar-empty {
      color: rgba(230, 237, 243, 0.72);
      background: rgba(6, 9, 14, 0.7);
    }

    /* --------------------------------------------------------------------- */
    /* Map Canvas And Overlay Surfaces                                       */
    /* --------------------------------------------------------------------- */

    #map {
      display: block;
      background: #000;
      image-rendering: pixelated;
      image-rendering: crisp-edges;
      border: 1px solid #202836;
      position: relative;
      z-index: 1;
      max-width: none;
      max-height: none;
      width: auto;
      height: auto;
    }

    .overlay {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      margin: 0;
      padding: 0.75em 1em;
      white-space: pre-wrap;
      font-family: var(--font-game);
      color: #f0f4ff;
      text-shadow: 0 0 2px rgba(0, 0, 0, 0.85);
      z-index: 7;
      display: none;
      max-width: min(80em, calc(100% - 2rem));
      max-height: calc(100% - 2rem);
      width: max-content;
      pointer-events: auto;
    }

    #overlay-modal {
      z-index: 8;
      background: rgba(7, 10, 16, 0.88);
      box-shadow: 0 1em 2.5em rgba(0, 0, 0, 0.5);
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
      word-break: break-word;
      border: 1.5em solid transparent;
      border-image: url("assets/modal-border.png") 16 round;
      image-rendering: pixelated;
      margin: auto;
      height: fit-content;
    }

    #overlay-modal.overlay-menu {
      --menu-details-width: 30ch;
      --menu-column-min-width: 16rem;
      padding: 1rem;
      width: min(72rem, calc(100% - 2rem));
      height: min(42rem, calc(100% - 2rem));
      max-width: calc(100% - 2rem);
      max-height: calc(100% - 2rem);
      box-sizing: border-box;
      white-space: normal;
      touch-action: pan-x pan-y;
    }

    #overlay-modal.overlay-message-log {
      padding: 1rem;
      width: min(72rem, calc(100% - 2rem));
      height: min(46rem, calc(100% - 2rem));
      max-width: calc(100% - 2rem);
      max-height: calc(100% - 2rem);
      box-sizing: border-box;
      white-space: normal;
      touch-action: pan-y;
      overflow: hidden;
    }

    #overlay-modal.overlay-tile-context {
      padding: 1rem;
      width: min(34rem, calc(100% - 2rem));
      max-width: calc(100% - 2rem);
      max-height: calc(100% - 2rem);
      box-sizing: border-box;
      white-space: normal;
      overflow: auto;
      touch-action: pan-y;
    }

    #overlay-modal.overlay-dismissable {
      cursor: pointer;
    }

    #overlay-modal.overlay-message-log.overlay-dismissable {
      cursor: auto;
    }

    .message-log-modal {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      gap: 1rem;
      height: 100%;
      min-height: 0;
    }

    .message-log-modal-head {
      display: grid;
      gap: 0.35rem;
      align-content: start;
    }

    .message-log-modal-title {
      margin: 0;
      font-size: 1.35rem;
      color: #fde047;
    }

    .message-log-modal-note {
      margin: 0;
      color: #9fb0c9;
      line-height: 1.35;
    }

    .message-log-modal-body {
      height: 100%;
      min-height: 0;
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }

    .message-log-modal-copy {
      display: grid;
      align-content: start;
      min-height: 100%;
      line-height: 1.35;
    }

    /* --------------------------------------------------------------------- */
    /* Character Sheet And Birth Editors                                     */
    /* --------------------------------------------------------------------- */

    .character-sheet-shell {
      display: grid;
      gap: 1rem;
      min-height: 100%;
      max-width: 70rem;
      margin: 0 auto;
      color: #d7dde7;
    }

    .character-sheet-header {
      display: grid;
      gap: 0.9rem;
    }

    .character-sheet-editor-banner {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.6rem 1rem;
      padding: 0.8rem 1rem;
      border: 1px solid rgba(147, 197, 253, 0.18);
      background: rgba(10, 14, 22, 0.48);
      color: #cdd6e3;
      grid-area: banner;
    }

    .character-sheet-editor-points-label {
      color: #cdd6e3;
    }

    .character-sheet-editor-points-value {
      color: #fde047;
      font-size: 1.25rem;
    }

    .character-sheet-editor-note {
      margin: 0;
      color: #9fb0c9;
      line-height: 1.35;
    }

    .character-sheet-heading h2,
    .character-sheet-card h3 {
      margin: 0;
    }

    .character-sheet-heading h2 {
      font-size: 1.4rem;
      color: #fde047;
    }

    .character-sheet-meta {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 1rem;
    }

    .character-sheet-layout {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.95fr);
      grid-template-areas:
        "overview skills"
        "history history"
        "banner banner";
      gap: 1rem;
      align-items: start;
    }

    .character-sheet-overview-card {
      grid-area: overview;
    }

    .character-sheet-skills-card {
      grid-area: skills;
    }

    .character-sheet-history-card {
      grid-area: history;
    }

    .character-sheet-card {
      display: grid;
      gap: 0.8rem;
      padding: 1rem;
      background: rgba(6, 8, 12, 0.32);
      border: 1px solid rgba(156, 163, 175, 0.2);
      box-sizing: border-box;
      align-content: center;
    }

    .character-sheet-card h3 {
      font-size: 1rem;
      color: #93c5fd;
    }

    .character-sheet-subsection {
      display: grid;
      gap: 0.55rem;
    }

    .character-sheet-field-list,
    .character-sheet-stat-list,
    .character-sheet-skill-list {
      display: grid;
      gap: 0.5rem;
      min-width: 0;
    }

    .character-sheet-field {
      display: flex;
      justify-content: space-between;
      gap: 1rem;
      align-items: baseline;
      min-width: 0;
    }

    .character-sheet-field-label {
      color: #cdd6e3;
    }

    .character-sheet-field-value,
    .character-sheet-progress-value,
    .character-sheet-combat-value {
      color: #d7dde7;
      font-weight: 600;
      text-align: right;
    }

    .character-sheet-identity-value {
      color: #93c5fd;
      font-weight: 700;
      text-align: right;
    }

    .character-sheet-stat-row,
    .character-sheet-skill-row {
      display: grid;
      gap: 0.35rem;
      padding: 0.45rem 0.55rem;
      border: 1px solid rgba(156, 163, 175, 0.12);
      background: rgba(12, 16, 24, 0.28);
      min-width: 0;
    }

    .character-sheet-stat-main,
    .character-sheet-skill-main {
      display: flex;
      justify-content: space-between;
      gap: 0.75rem;
      align-items: baseline;
      min-width: 0;
    }

    .character-sheet-stat-label,
    .character-sheet-skill-label {
      color: #d7dde7;
      font-weight: 600;
    }

    .character-sheet-stat-current,
    .character-sheet-skill-expression {
      color: #86efac;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    .character-sheet-skill-label {
      flex: 1 1 auto;
      min-width: 0;
    }

    .character-sheet-skill-value {
      display: flex;
      gap: .3rem;
    }

    .character-sheet-skill-main {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 0.35rem;
      align-items: baseline;
      justify-content: stretch;
    }

    .character-sheet-skill-label {
      flex: initial;
      min-width: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .character-sheet-skill-cell {
      display: block;
      white-space: nowrap;
      text-align: right;
      font-variant-numeric: tabular-nums;
      font-weight: 600;
    }

    .character-sheet-skill-equals {
      text-align: center;
    }

    .character-sheet-stat-row-reduced .character-sheet-stat-current {
      color: #fde047;
    }

    .character-sheet-stat-row-editable {
      gap: 0.55rem;
    }

    .character-sheet-stat-row-selected {
      border-color: rgba(147, 197, 253, 0.45);
      background: rgba(37, 99, 235, 0.14);
    }

    .character-sheet-stat-select {
      display: block;
      width: 100%;
      padding: 0;
      border: 0;
      background: transparent;
      color: inherit;
      font: inherit;
      text-align: left;
      cursor: pointer;
      min-width: 0;
    }

    .character-sheet-stat-controls {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.45rem;
    }

    .character-sheet-stat-adjust {
      min-width: 2.2rem;
      min-height: 2.2rem;
      border: 1px solid rgba(156, 163, 175, 0.2);
      background: rgba(15, 23, 42, 0.78);
      color: #d7dde7;
      font: inherit;
      font-size: 1.1rem;
      cursor: pointer;
    }

    .character-sheet-stat-adjust:disabled {
      opacity: 0.38;
      cursor: default;
    }

    .character-sheet-stat-cost {
      color: #cdd6e3;
      font-size: 0.92rem;
      white-space: nowrap;
    }

    .character-sheet-skill-row-editable {
      gap: 0.55rem;
    }

    .character-sheet-skill-row-selected {
      border-color: rgba(147, 197, 253, 0.45);
      background: rgba(37, 99, 235, 0.14);
    }

    .character-sheet-skill-select {
      display: block;
      width: 100%;
      padding: 0;
      border: 0;
      background: transparent;
      color: inherit;
      font: inherit;
      text-align: left;
      cursor: pointer;
      min-width: 0;
    }

    .character-sheet-skill-controls {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.45rem;
    }

    .character-sheet-skill-cost {
      color: #cdd6e3;
      font-size: 0.92rem;
      white-space: nowrap;
    }

    .character-sheet-stat-mods {
      display: flex;
      flex-wrap: wrap;
      gap: 0.35rem;
    }

    .character-sheet-stat-mod {
      display: inline-flex;
      align-items: center;
      padding: 0.15rem 0.4rem;
      border: 1px solid rgba(156, 163, 175, 0.16);
      background: rgba(15, 23, 42, 0.68);
      color: #cdd6e3;
      font-size: 0.88rem;
    }

    .character-sheet-stat-base {
      color: #93c5fd;
    }

    .character-sheet-history {
      color: #d7dde7;
      line-height: 1.4;
      white-space: pre-wrap;
    }

    .character-sheet-card-head,
    .character-sheet-history-editor-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
    }

    .character-sheet-action-inline {
      min-height: 0;
      padding: 0.4rem 0.65rem;
    }

    .character-history-editor {
      min-height: 18rem;
    }

    .character-history-textarea {
      width: 100%;
      min-height: 18rem;
      padding: 0.9rem 1rem;
      box-sizing: border-box;
      resize: vertical;
      border: 1px solid rgba(147, 197, 253, 0.22);
      background: rgba(10, 14, 22, 0.72);
      color: #d7dde7;
      font: inherit;
      line-height: 1.45;
      white-space: pre-wrap;
    }

    .character-history-textarea:focus {
      outline: 1px solid rgba(147, 197, 253, 0.55);
      border-color: rgba(147, 197, 253, 0.42);
    }

    .character-birth-form {
      display: grid;
      gap: 0.85rem;
    }

    .character-birth-field {
      display: grid;
      gap: 0.45rem;
      padding: 0.8rem 0.9rem;
      border: 1px solid rgba(147, 197, 253, 0.18);
      background: rgba(10, 14, 22, 0.48);
    }

    .character-birth-field-head {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      justify-content: space-between;
      gap: 0.45rem 0.85rem;
    }

    .character-birth-field-label {
      color: #d7dde7;
      font-weight: 700;
    }

    .character-birth-field-preview {
      color: #93c5fd;
      font-weight: 600;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    .character-birth-input {
      width: 100%;
      padding: 0.65rem 0.8rem;
      box-sizing: border-box;
      border: 1px solid rgba(147, 197, 253, 0.22);
      background: rgba(10, 14, 22, 0.72);
      color: #d7dde7;
      font: inherit;
      font-size: 1.05rem;
      font-weight: 700;
      font-variant-numeric: tabular-nums;
    }

    .character-birth-input:focus {
      outline: 1px solid rgba(147, 197, 253, 0.55);
      border-color: rgba(147, 197, 253, 0.42);
    }

    .character-birth-field-range {
      color: #9fb0c9;
      font-size: 0.92rem;
    }

    .character-sheet-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 0.6rem;
      position: sticky;
      bottom: 0;
      padding-top: 0.35rem;
      background: linear-gradient(180deg, rgba(7, 10, 16, 0) 0%, rgba(7, 10, 16, 0.96) 34%);
    }

    .character-sheet-action {
      display: inline-flex;
      align-items: center;
      gap: 0.55rem;
      min-height: 2.5rem;
      padding: 0.55rem 0.85rem;
      border: 1px solid rgba(156, 163, 175, 0.2);
      background: rgba(15, 23, 42, 0.78);
      color: #d7dde7;
      font: inherit;
      cursor: pointer;
    }

    .character-sheet-action-key {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 2.35rem;
      padding: 0.2rem 0.4rem;
      border: 1px solid rgba(147, 197, 253, 0.28);
      color: #fde047;
      font-weight: 700;
      text-transform: uppercase;
    }

    .character-sheet-action-label {
      color: #d7dde7;
      font-weight: 600;
    }

    /* --------------------------------------------------------------------- */
    /* Tile Context Dialog                                                   */
    /* --------------------------------------------------------------------- */

    .tile-context-shell {
      display: grid;
      gap: 1rem;
      max-width: 100%;
      color: #d7dde7;
    }

    .tile-context-header {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      gap: 1rem;
      align-items: center;
    }

    .tile-context-visual-frame {
      width: 4.5rem;
      height: 4.5rem;
      display: grid;
      place-items: center;
      border: 1px solid rgba(147, 197, 253, 0.22);
      background: rgba(10, 14, 22, 0.68);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    }

    .tile-context-visual {
      width: 3rem;
      height: 3rem;
      display: grid;
      place-items: center;
    }

    .tile-context-visual .action-fab-canvas {
      width: 3rem;
      height: 3rem;
    }

    .tile-context-visual .action-fab-glyph {
      font-size: 2.5rem;
    }

    .tile-context-copy {
      display: grid;
      gap: 0.35rem;
      min-width: 0;
    }

    .tile-context-copy h2,
    .tile-context-copy p {
      margin: 0;
    }

    .tile-context-copy h2 {
      color: #fde047;
      font-size: 1.2rem;
    }

    .tile-context-copy p {
      color: #9fb0c9;
      line-height: 1.35;
    }

    .tile-context-description {
      padding: 0.9rem 1rem;
      border: 1px solid rgba(156, 163, 175, 0.18);
      background: rgba(10, 14, 22, 0.62);
      color: #d7dde7;
      white-space: pre-wrap;
      line-height: 1.45;
    }

    .tile-context-monster {
      display: grid;
      gap: 0.7rem;
      padding: 0.9rem 1rem;
      border: 1px solid rgba(34, 197, 94, 0.18);
      background:
        linear-gradient(180deg, rgba(10, 18, 14, 0.9) 0%, rgba(8, 14, 22, 0.72) 100%);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    }

    .tile-context-monster-heading {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 0.55rem;
    }

    .tile-context-monster-heading h3 {
      margin: 0;
      color: #f8fbff;
      font-size: 1rem;
      line-height: 1.25;
    }

    .tile-context-monster-state {
      flex: 0 0 auto;
      padding: 0.18rem 0.52rem;
      border: 1px solid rgba(134, 239, 172, 0.24);
      color: #bbf7d0;
      background: rgba(20, 83, 45, 0.22);
      font-size: 0.82rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .tile-context-monster-bar {
      min-width: 0;
    }

    .tile-context-monster-bar .hud-bar-copy {
      min-height: 1.75rem;
      padding: 0 0.85rem;
    }

    .tile-context-monster-bar .hud-bar-value {
      min-width: 1px;
    }

    .tile-context-monster-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 0.45rem;
    }

    .tile-context-monster-tag {
      padding: 0.16rem 0.48rem;
      border: 1px solid rgba(148, 163, 184, 0.2);
      color: #d7dde7;
      background: rgba(15, 23, 42, 0.5);
      font-size: 0.8rem;
      font-weight: 600;
      line-height: 1.2;
    }

    .tile-context-actions {
      display: grid;
      gap: 0.65rem;
    }

    .tile-context-action {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      width: 100%;
      min-height: 2.85rem;
      padding: 0.7rem 0.95rem;
      border: 1px solid rgba(156, 163, 175, 0.2);
      background: rgba(15, 23, 42, 0.8);
      color: #d7dde7;
      font: inherit;
      text-align: left;
      cursor: pointer;
    }

    .tile-context-action-primary {
      border-color: rgba(147, 197, 253, 0.34);
      background: rgba(16, 27, 46, 0.88);
    }

    .tile-context-action-label {
      font-weight: 600;
    }

    .tile-context-action-tag {
      flex: 0 0 auto;
      padding: 0.16rem 0.48rem;
      border: 1px solid rgba(147, 197, 253, 0.22);
      color: #93c5fd;
      font-size: 0.85rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    /* --------------------------------------------------------------------- */
    /* Semantic Menus, Details, And Summary Panes                            */
    /* --------------------------------------------------------------------- */

    .menu-shell {
      display: grid;
      gap: 1rem;
      height: 100%;
      min-height: 0;
      min-width: 0;
      width: 100%;
      max-width: 100%;
      margin: 0;
    }

    .menu-shell-with-copy {
      grid-template-rows: auto minmax(0, 1fr);
    }

    .menu-shell-no-copy {
      grid-template-rows: minmax(0, 1fr);
    }

    .menu-body {
      display: grid;
      gap: 1rem;
      min-height: 0;
      min-width: 0;
      width: 100%;
    }

    .menu-body-with-details {
      grid-template-columns: minmax(0, 1fr) minmax(18rem, var(--menu-details-width));
    }

    .menu-body-no-details {
      grid-template-columns: minmax(0, 1fr);
    }

    .menu-columns-wrap {
      min-height: 20vh;
      min-width: 0;
    }

    .menu-columns {
      display: flex;
      gap: 0.75rem;
      height: 100%;
      min-height: 0;
      min-width: 100%;
      width: 100%;
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-x pan-y;
      align-items: flex-start;
    }

    .menu-column {
      display: grid;
      gap: 0.05rem;
      align-content: start;
      flex: 1 0 var(--menu-column-min-width);
      min-width: var(--menu-column-min-width);
      transition: opacity 120ms ease;
    }

    .menu-column-active {
      opacity: 1;
    }

    .menu-column-inactive {
      opacity: 0.58;
    }

    .menu-copy {
      margin: 0;
      min-height: 0;
      min-width: 0;
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
      padding-right: 0.25rem;
      white-space: pre-wrap;
      color: #d7dde7;
      line-height: 1.25;
      text-shadow: 0 0 2px rgba(0, 0, 0, 0.65);
    }

    .menu-copy-empty {
      display: none;
    }

    .menu-item-details {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      min-height: 0;
      min-width: 0;
      height: 100%;
      padding: 0.75rem;
      color: #d7dde7;
      background: rgba(6, 8, 12, 0.3);
      border: 1px solid rgba(156, 163, 175, 0.18);
      box-sizing: border-box;
    }

    .menu-item-details-empty {
      display: none;
    }

    .menu-item-details-visual {
      flex: 0 0 auto;
      display: flex;
      align-items: flex-start;
      justify-content: flex-start;
      min-height: 0;
      min-width: 0;
    }

    .menu-item-details-visual:empty {
      display: none;
    }

    .menu-item-details-visual-canvas {
      width: 4rem;
      height: 4rem;
      image-rendering: pixelated;
      image-rendering: crisp-edges;
    }

    .menu-item-details-glyph {
      min-width: 4rem;
      min-height: 4rem;
      display: grid;
      place-items: center;
      font-size: 3rem;
      line-height: 1;
      text-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.6);
    }

    .menu-item-details-copy {
      flex: 1 1 auto;
      min-height: 0;
      min-width: 0;
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
      white-space: pre-wrap;
      line-height: 1.25;
      padding-right: 0.25rem;
    }

    .menu-item-details-copy-empty {
      display: none;
    }

    .menu-summary {
      min-width: 0;
      min-height: var(--menu-summary-min-height, 0);
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
      white-space: pre-wrap;
      line-height: 1.25;
      padding: 0.75rem;
      color: #d7dde7;
      background: rgba(6, 8, 12, 0.22);
      border: 1px solid rgba(156, 163, 175, 0.14);
      box-sizing: border-box;
    }

    .menu-summary-empty {
      display: none;
    }

    .menu-item {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      width: 100%;
      padding: 0.3rem 0.55rem;
      border: 1px solid transparent;
      background: transparent;
      color: #d7dde7;
      font: inherit;
      text-align: left;
      cursor: pointer;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .menu-item-visual {
      flex: 0 0 auto;
      width: 1.5rem;
      height: 1.5rem;
      display: grid;
      place-items: center;
    }

    .menu-item-visual-canvas {
      width: 1.5rem;
      height: 1.5rem;
      image-rendering: pixelated;
      image-rendering: crisp-edges;
    }

    .menu-item-visual-glyph {
      font-size: 1.25rem;
      line-height: 1;
      text-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.6);
    }

    .menu-item-label {
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
    }

    .menu-item-direct {
      border-color: rgba(156, 163, 175, 0.18);
    }

    .menu-item:focus-visible,
    .menu-item-selected {
      color: #93c5fd;
      border-color: rgba(147, 197, 253, 0.45);
      background: rgba(37, 99, 235, 0.14);
      outline: none;
    }

    /* --------------------------------------------------------------------- */
    /* Sidebar Panels And Terminal Color Helpers                             */
    /* --------------------------------------------------------------------- */

    .side-wrap {
      grid-column: 1;
      grid-row: 1;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      min-height: 0;
      min-width: 0;
      background: linear-gradient(180deg, rgba(18, 24, 36, 0.98) 0%, var(--panel-strong) 100%);
      border-right: 1px solid var(--border);
      transform: translateX(calc(-1 * var(--side-panel-width) - 1rem));
      opacity: 0;
      pointer-events: none;
      transition:
        transform 180ms ease,
        opacity 140ms ease;
    }

    .app.shell-visible:not(.side-collapsed) .side-wrap {
      transform: translateX(0);
      opacity: 1;
      pointer-events: auto;
    }

    .side-toolbar {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      padding: 0.6rem 0.7rem;
      border-bottom: 1px solid var(--border);
      background:
        linear-gradient(180deg, rgba(17, 24, 36, 0.92) 0%, rgba(10, 15, 23, 0.88) 100%);
    }

    .side-toolbar-spacer {
      flex: 1 1 auto;
      min-width: 0;
    }

    .side-backdrop {
      position: absolute;
      inset: 0;
      z-index: 2;
      opacity: 0;
      pointer-events: none;
      background: rgba(3, 6, 10, 0.68);
      backdrop-filter: blur(2px);
      transition: opacity 140ms ease;
    }

    .panel {
      margin: 0;
      padding: 0.75em;
      min-height: 0;
      overflow: auto;
      white-space: pre-wrap;
      font-size: 1em;
      line-height: 1.15;
      color: #d7dde7;
      background: rgba(6, 8, 12, 0.28);
      border-bottom: 1px solid var(--border);
      font-family: var(--font-game);
    }

    .panel:last-child {
      border-bottom: 0;
    }

    .app.side-collapsed .map-wrap,
    .app:not(.shell-visible) .map-wrap {
      border-left: 0;
    }

    .app.shell-visible.side-collapsed .hud-strip {
      display: flex;
    }

    /* Terminal text-palette helpers mirrored from the game color table. */
    .term-c0 { color: #000000; }
    .term-c1 { color: #ffffff; }
    .term-c2 { color: #9ca3af; }
    .term-c3 { color: #f59e0b; }
    .term-c4 { color: #ef4444; }
    .term-c5 { color: #22c55e; }
    .term-c6 { color: #3b82f6; }
    .term-c7 { color: #b45309; }
    .term-c8 { color: #4b5563; }
    .term-c9 { color: #d1d5db; }
    .term-c10 { color: #a855f7; }
    .term-c11 { color: #fde047; }
    .term-c12 { color: #fca5a5; }
    .term-c13 { color: #86efac; }
    .term-c14 { color: #93c5fd; }
    .term-c15 { color: #fcd34d; }

    .more-indicator {
      display: inline-block;
      margin-left: 0.5em;
      font-size: 0.72em;
      line-height: 1;
      color: #58e6ff;
      text-shadow: 0 0 0.35em rgba(88, 230, 255, 0.55);
      vertical-align: text-top;
      letter-spacing: 0.03em;
    }

    /* --------------------------------------------------------------------- */
    /* Responsive: Tablet And Mobile Layouts (drawer sidebar, stacked cards) */
    /* Targets screens at 800px wide or narrower.                            */
    /* --------------------------------------------------------------------- */

    @media (max-width: 800px) {
      .layout {
        grid-template-columns: 1fr;
      }

      .app.shell-visible:not(.side-collapsed) .layout {
        grid-template-columns: 1fr;
      }

      .map-wrap {
        grid-column: 1 / -1;
        border-right: 0;
        border-left: 0;
        padding-top: 4rem;
      }

      .topbar {
        grid-template-columns: 1fr;
        gap: 0.35em;
        padding: 0.35em 0.55em;
      }

      #status {
        text-align: left;
        font-size: 0.74em;
      }

      .top-log {
        max-height: 2.7em;
        text-wrap: auto;
      }

      .app.shell-visible .hud-strip {
        display: flex;
      }

      .action-fabs {
        right: 0.85rem;
        bottom: calc(var(--safe-bottom) + 0.85rem);
      }

      .action-fab {
        width: 4rem;
        height: 4rem;
      }

      .action-fab-caption {
        font-size: 0.5rem;
        max-width: 5rem;
      }

      .action-row {
        gap: 0.3rem;
        max-width: calc(100vw - 1.7rem);
        padding: 0.28rem 0.32rem;
      }

      .action-fab-compact {
        width: 4rem;
        height: 4rem;
      }

      .action-fab-compact .action-fab-visual {
        width: 2.15rem;
        height: 2.15rem;
      }

      .action-fab-compact .action-fab-canvas {
        width: 2.15rem;
        height: 2.15rem;
      }

      #overlay-modal.overlay-menu,
      #overlay-modal.overlay-message-log,
      #overlay-modal.overlay-birth-history,
      #overlay-modal.overlay-character-sheet,
      #overlay-modal.overlay-character-skills {
        padding: 0;
        max-width: calc(100% - .1rem);
        max-height: calc(100% - .1rem);
      }

      .character-sheet-meta,
      .character-sheet-layout {
        grid-template-columns: 1fr;
        grid-template-areas: none;
      }

      .character-sheet-overview-card,
      .character-sheet-stats-card,
      .character-sheet-skills-card,
      .character-sheet-history-card {
        grid-area: auto;
      }

      .character-sheet-stat-controls {
        justify-content: stretch;
      }

      .character-sheet-stat-adjust {
        flex: 1 1 0;
      }

      .character-history-textarea {
        min-height: 15rem;
      }

      .side-backdrop {
        display: block;
      }

      .side-wrap {
        position: absolute;
        top: 0.5rem;
        left: 0.5rem;
        bottom: 0.5rem;
        width: min(22rem, calc(100% - 1.5rem));
        z-index: 4;
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: 0.75rem;
        background: linear-gradient(180deg, rgba(18, 24, 36, 0.98) 0%, var(--panel-strong) 100%);
        box-shadow: 0 1.1rem 2.4rem rgba(0, 0, 0, 0.42);
        transform: translateX(calc(-100% - 1rem));
        opacity: 0;
        pointer-events: none;
        transition:
          transform 180ms ease,
          opacity 140ms ease;
      }

      .app.shell-visible:not(.side-open) .side-wrap {
        transform: translateX(calc(-100% - 1rem));
        opacity: 0;
        pointer-events: none;
      }

      .app.shell-visible.side-open .side-wrap {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
      }

      .app.shell-visible.side-open .side-backdrop {
        opacity: 1;
        pointer-events: auto;
      }

      .panel {
        height: 100%;
        border-bottom: 0;
        background: transparent;
      }

      .overlay {
        max-width: calc(100% - 1rem);
        max-height: calc(100% - 1rem);
      }

      #overlay-modal {
        top: 0.1rem;
        right: 0.1rem;
        bottom: calc(var(--safe-bottom) + 0.1rem);
        left: 0.1rem;
        transform: none;
        margin: 0;
        width: auto;
        height: auto;
        max-width: none;
        max-height: none;
      }

      #overlay-modal.overlay-menu {
        padding: 0.75rem;
        width: auto;
        height: auto;
        max-width: none;
        max-height: none;
      }

      #overlay-modal.overlay-message-log {
        padding: 0.75rem;
        width: auto;
        height: auto;
        max-width: none;
        max-height: none;
      }

      .menu-shell {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100%;
        margin: 0;
      }

      .menu-shell-with-copy {
        grid-template-rows: auto auto;
      }

      .menu-shell-no-copy {
        grid-template-rows: auto;
      }

      .menu-body {
        min-height: auto;
      }

      .menu-body-with-details {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
      }

      .menu-columns-wrap {
        min-height: 0;
        overflow: visible;
      }

      .menu-body-with-details .menu-columns-wrap {
        max-height: 40vh;
      }

      .menu-columns {
        height: auto;
        overflow-x: auto;
        overflow-y: visible;
      }

      .menu-body-with-details .menu-columns {
        max-height: 40vh;
        overflow-y: auto;
      }

      .menu-copy,
      .menu-item-details,
      .menu-item-details-copy,
      .menu-summary {
        overflow: visible;
      }

      .menu-item-details {
        height: auto;
        max-height: none;
      }
    }

    /* --------------------------------------------------------------------- */
    /* Responsive: Desktop And Wide Screens                                  */
    /* Targets screens wider than 800px.                                     */
    /* --------------------------------------------------------------------- */

    @media (min-width: 801px) {
      .side-backdrop {
        display: none;
      }
    }
