/* HD-2D engine: the HUD and menus (party cards, map panel, messages, battle commands, character sheet, target picker,
   pause, full-screen button, title, floating numbers, scrollbars). Dark glass panels with a metal edge.
   Every colour, the fonts, the corner radius and the frame come from the theme (engine/hd2d/theme.js applies a game's
   theme.json); these defaults are the original look: gilded edges on dark violet glass. */
:root { --bg: #050407; --ink: #ece2c8; --title: #f6e6bd; --dim: #cbb98f; --edge: #c9a45a; --edge-light: #e2c27a; --edge-dark: #6f5226;
  --gold: #c9a45a; --gold2: #f3d58f; --panel: rgba(12, 10, 24, 0.72); --panel-top: #1c1832; --panel-base: #0c0a18; --face1: #3a3050; --face2: #120e1c;
  --cool: #9fd0ff; --glow: #ff963c; --hp1: #6fcf62; --hp2: #c8f08a; --mp1: #4d8df0; --mp2: #9fd0ff; --radius: 6px;
  --font-title: 'Cinzel', serif; --font-body: 'Alegreya Sans', sans-serif; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; color: var(--ink); font: 500 15px var(--font-body); }
  canvas#view { display: block; }
  .panel { background: linear-gradient(180deg, color-mix(in srgb, var(--panel-top) 78%, transparent), var(--panel)); border: 1px solid color-mix(in srgb, var(--edge) 75%, transparent); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), 0 6px 24px rgba(0, 0, 0, 0.5); border-radius: var(--radius); backdrop-filter: blur(3px); }
  #party { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; width: min(1180px, calc(100vw - 112px)); }
  .pc { display: flex; gap: 7px; align-items: center; padding: 6px 9px 6px 6px; min-width: 0; flex: 1 1 0; overflow: visible; }
  .pi { overflow: hidden; }
  .pi { min-width: 0; } .pi b, .pi span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  @media (max-width: 1100px) { .pc canvas { width: 34px; height: 34px; } .pi span { display: none; } }   /* (narrow windows: the cards shrink to fit, class line goes) */
  .pc canvas { image-rendering: pixelated; border: 1px solid color-mix(in srgb, var(--edge) 50%, transparent); border-radius: 3px; background: radial-gradient(var(--face1), var(--face2)); }
  .pi { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .pi b { font: 600 14px var(--font-title); color: var(--gold2); letter-spacing: 0.04em; }
  .pi span { font-size: 12px; opacity: 0.75; text-transform: capitalize; margin-top: -2px; }
  .bar { display: block; height: 5px; background: rgba(0, 0, 0, 0.6); border-radius: 3px; overflow: hidden; }
  .bar em { display: block; height: 100%; transition: width 0.4s; }
  .bar.hp em { background: linear-gradient(90deg, var(--hp1), var(--hp2)); } .bar.mp em { background: linear-gradient(90deg, var(--mp1), var(--mp2)); } .bar.none { opacity: 0; }
  #mapbox { position: fixed; right: 16px; top: 16px; padding: 10px; }
  #map { display: block; image-rendering: pixelated; width: 216px; }
  #bag { margin-top: 8px; font-size: 13px; line-height: 1.45; opacity: 0.9; } #bag b { color: var(--gold2); font-size: 15px; }
  #lvl { position: fixed; left: 50%; top: 58px; transform: translateX(-50%); font: 600 12px var(--font-title); letter-spacing: 0.12em; color: var(--gold); opacity: 0.75; white-space: nowrap; text-shadow: 0 1px 3px #000; }
  .battle #lvl { opacity: 0; }
  #compass { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); font: 600 20px var(--font-title); color: var(--gold2); padding: 4px 16px; }
  #msg { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); padding: 8px 18px; opacity: 0; transition: opacity 0.4s; pointer-events: none; font-size: 17px; max-width: 70vw; text-align: center; }
  #msg.on { opacity: 1; }
  #help { position: fixed; left: 16px; top: 16px; padding: 8px 12px; font-size: 13px; line-height: 1.5; opacity: 0.85; }
  #help b { color: var(--gold2); font-weight: 700; }
  #stats { position: fixed; left: 16px; bottom: 100px; font: 12px ui-monospace, monospace; padding: 4px 8px; background: rgba(0, 0, 0, 0.72); color: #f2ead8; border-radius: 4px; display: none; z-index: 7; }   /* (its own light text: a theme's ink can be dark brown) */
  #stats.on { display: block; }
  #cmd { position: fixed; left: 16px; bottom: 100px; padding: 8px; display: none; flex-direction: column; gap: 4px; min-width: 150px; }
  #cmd.on { display: flex; }
  #cmd button { all: unset; cursor: pointer; padding: 5px 12px; font: 600 15px var(--font-title); color: var(--ink); border-radius: 3px; }
  #cmd button:hover, #cmd button:first-child { background: linear-gradient(90deg, color-mix(in srgb, var(--edge) 35%, transparent), transparent); color: var(--gold2); }
  #cmd .hint { font-size: 12px; opacity: 0.6; padding: 2px 12px; }
  #enemies { position: fixed; left: 16px; top: 16px; display: flex; flex-direction: column; gap: 6px; }
  #enemies div { padding: 6px 12px; min-width: 160px; font: 600 14px var(--font-title); background: var(--panel); border: 1px solid color-mix(in srgb, var(--edge) 60%, transparent); border-radius: 5px; }
  #enemies .bar { margin-top: 4px; }
  #turns { position: fixed; left: 50%; top: 58px; transform: translateX(-50%); display: none; gap: 5px; padding: 5px 8px; background: var(--panel); border: 1px solid color-mix(in srgb, var(--edge) 45%, transparent); border-radius: 6px; z-index: 6; max-width: calc(100vw - 32px); flex-wrap: wrap; justify-content: center; }
  #turns.on { display: flex; } #turns .tn { width: 36px; height: 36px; border-radius: 4px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--edge) 40%, transparent); transition: transform 0.15s, opacity 0.2s; background: radial-gradient(var(--face1), var(--face2)); }
  #turns .tn canvas { width: 36px; height: 36px; image-rendering: pixelated; display: block; } #turns .tn.foe { border-color: rgba(220, 90, 70, 0.7); }
  #turns .tn.now { transform: translateY(3px) scale(1.18); border-color: var(--gold2); box-shadow: 0 0 10px color-mix(in srgb, var(--gold2) 60%, transparent); } #turns .tn.done, #turns .tn.skip { opacity: 0.4; } #turns .tn.gone { opacity: 0.15; }
  .battle #help, .battle #mapbox, .battle #compass { opacity: 0; transition: opacity 0.6s; }
  #floats { position: fixed; inset: 0; pointer-events: none; }
  .float { position: absolute; left: 0; top: 0; font: 700 26px var(--font-title); color: var(--title); text-shadow: 0 2px 0 #5a2a10, 0 0 10px rgba(255, 140, 40, 0.8); }
  .float.hurt { color: #ffb0a0; text-shadow: 0 2px 0 #400, 0 0 10px rgba(255, 40, 40, 0.8); }
  .float.heal { color: #b8ffb0; text-shadow: 0 2px 0 #042, 0 0 10px rgba(60, 255, 120, 0.8); }
  #hud.veiled { opacity: 0; } #hud { transition: opacity 1.2s 0.4s; }
  #title { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bg) 15%, transparent), color-mix(in srgb, var(--bg) 85%, transparent) 75%); cursor: pointer; transition: opacity 1.4s; z-index: 5; }
  #title.gone { opacity: 0; pointer-events: none; }
  .tbox { text-align: center; padding: 0 16px; position: relative; isolation: isolate; }
  /* a soft dark pool behind the words, blurred and fading at its edges, so the small lines read over any scene */
  .tbox::before { content: ''; position: absolute; inset: -60px -90px; z-index: -1; pointer-events: none;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--bg) 78%, transparent), color-mix(in srgb, var(--bg) 55%, transparent) 55%, transparent);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent); mask-image: radial-gradient(closest-side, #000 55%, transparent); }
  #title .tbox > *:not(h1) { text-shadow: 0 1px 3px color-mix(in srgb, var(--bg) 90%, transparent), 0 0 10px color-mix(in srgb, var(--bg) 70%, transparent); }
  .kicker { font: 600 13px var(--font-title); letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold); opacity: 0.85; }
  #title h1 { font: 600 clamp(38px, 7vw, 86px) var(--font-title); margin: 10px 0 6px; color: var(--title); letter-spacing: 0.04em; text-shadow: 0 0 24px color-mix(in srgb, var(--glow) 45%, transparent), 0 4px 0 #2a1608; }
  .sub { font-size: 15px; opacity: 0.7; }
  .press { margin-top: 44px; font: 600 18px var(--font-title); color: var(--gold2); letter-spacing: 0.2em; animation: pulse 2.2s ease-in-out infinite; }
  .small { margin-top: 14px; font-size: 13px; opacity: 0.55; }
  @keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
  .pc { cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; } .pc:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--gold2), 0 8px 24px rgba(0, 0, 0, 0.6); }
  #bag .hint { margin-top: 6px; font-size: 11px; opacity: 0.55; }
  #fs { position: fixed; right: 16px; bottom: 16px; z-index: 20; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; color: var(--gold2); padding: 0; }
  #fs svg path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  #fs .exit { display: none; } #fs.full .exit { display: inline; } #fs.full .enter { display: none; } #fs:hover { filter: brightness(1.25); }
  #pause { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); z-index: 30; backdrop-filter: blur(2px); }
  #pause.on { display: grid; } #pause .panel { padding: 22px 46px; text-align: center; } #pause h2 { font: 600 34px var(--font-title); color: var(--gold2); margin: 0 0 6px; letter-spacing: 0.08em; }
  #pmenu { margin-top: 14px; display: grid; gap: 10px; font-size: 14px; min-width: min(460px, calc(100vw - 80px)); } #pmenu .pm-row { display: flex; gap: 6px; justify-content: center; }
  #pmenu .pm-slots { display: grid; gap: 4px; } #pmenu .pm-slot { display: flex; align-items: center; gap: 4px; } #pmenu .pm-slot span { flex: 1; text-align: left; color: var(--dim); } #pmenu small { opacity: 0.6; margin-left: 4px; } #pmenu i { opacity: 0.5; }
  #pmenu button { font: inherit; font-size: 13px; padding: 4px 11px; background: color-mix(in srgb, var(--panel-base) 80%, transparent); color: var(--ink); border: 1px solid color-mix(in srgb, var(--edge) 45%, transparent); border-radius: 4px; cursor: pointer; } #pmenu button:hover:not(:disabled) { border-color: var(--gold2); color: var(--gold2); } #pmenu button:disabled { opacity: 0.35; cursor: default; } #pmenu button.sure { background: rgba(140, 40, 30, 0.6); border-color: #e0806a; }
  #title .cont { margin-top: 10px; font-size: 15px; color: var(--dim); cursor: pointer; } #title .cont small { opacity: 0.6; }
  #restset { margin-top: 16px; display: grid; gap: 6px; font-size: 14px; } #restset .rs-row { display: flex; align-items: center; gap: 4px; } #restset span { flex: 1; text-align: left; margin-right: 10px; color: var(--ink2, var(--dim)); }
  #restset button { font: inherit; font-size: 13px; padding: 3px 9px; background: color-mix(in srgb, var(--panel-base) 80%, transparent); color: var(--dim); border: 1px solid color-mix(in srgb, var(--edge) 35%, transparent); border-radius: 4px; cursor: pointer; } #restset button.on { background: color-mix(in srgb, var(--edge) 28%, transparent); color: var(--gold2); border-color: color-mix(in srgb, var(--gold2) 80%, transparent); }
  #sheet { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 50%, transparent); z-index: 24; }   /* (over a talk: opened mid-conversation, the sheets come first) */
  #sheet.on { display: grid; }
  /* the sheet is one fixed size for everyone: the bag takes whatever room is left and scrolls on its own */
  #sheet .card { width: min(780px, calc(100vw - 32px)); height: min(760px, calc(100vh - 40px)); display: flex; flex-direction: column; overflow: hidden; padding: 14px 20px 18px; box-sizing: border-box; }
  .sh-head { flex: none; }
  #sheetbody { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  #sheetbody > * { flex: none; }
  /* the tabs, and the one pane open below them: all the room left, scrolling on its own */
  .sh-tabs { display: flex; gap: 4px; margin: 14px 0 0; border-bottom: 1px solid color-mix(in srgb, var(--edge) 35%, transparent); }
  #sheet .sh-tabs button { border-radius: 6px 6px 0 0; border-bottom: none; padding: 6px 16px; font: 600 15px var(--font-title); letter-spacing: 0.05em; color: var(--dim, var(--ink)); background: transparent; }
  #sheet .sh-tabs button:not(.on) { opacity: 0.62; } #sheet .sh-tabs button:not(.on):hover { opacity: 1; }
  #sheet .sh-tabs button small { opacity: 0.6; font: 500 12px var(--font-body); margin-left: 3px; }
  #sheet .sh-tabs button.on, :root[data-art] #sheet .sh-tabs button.on { color: var(--gold2); background: color-mix(in srgb, var(--gold) 30%, transparent) !important; box-shadow: inset 0 -3px 0 var(--gold) !important; }
  :root[data-art]:not([data-art="pixel"]) #sheet .sh-tabs button.on { color: var(--ink) !important; background: color-mix(in srgb, var(--gold) 45%, transparent) !important; }
  #sheet .chip.sel, :root[data-art] #sheet .chip.sel { box-shadow: 0 0 0 2px var(--gold) !important; }
  #sheetbody > .sh-main { flex: 1 1 0; min-height: 0; min-width: 0; display: flex; flex-direction: column; } .sh-main > * { flex: none; }
  .sh-main > .sh-pane { flex: 1 1 0; min-height: 80px; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 6px 0;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 8px, #000 calc(100% - 14px), transparent 100%); mask-image: linear-gradient(180deg, transparent 0, #000 8px, #000 calc(100% - 14px), transparent 100%); }   /* (soft edges: there is more above or below) */
  #sheet .sh-pane .bagf { position: sticky; top: 0; z-index: 1; padding: 2px 0 6px; background: linear-gradient(var(--panel-top), color-mix(in srgb, var(--panel-top) 80%, transparent)); }
  /* spells as chips: name and cost; what the one under the pointer does, below */
  .chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 3px; }   /* (room for the chosen one's ring: the pane clips at its edge) */
  #sheet .chip { padding: 6px 12px; border-radius: 16px; font: 600 14px var(--font-body); } #sheet .chip span { color: var(--cool); font-size: 12px; margin-left: 4px; }
  #sheet .chip.off { opacity: 0.45; } #sheet .chip.sel { box-shadow: 0 0 0 1px var(--gold2); color: var(--gold2); }
  .sp-info { margin-top: 12px; padding: 8px 10px; min-height: 3.2em; font-size: 14px; line-height: 1.4; border: 1px solid color-mix(in srgb, var(--edge) 30%, transparent); border-radius: 6px; background: rgba(255, 255, 255, 0.03); opacity: 0.9; }
  .sp-info b { color: var(--gold2); } .sp-info span { color: var(--cool); font-size: 12px; margin-right: 4px; } .sp-info em { color: var(--gold); }
  /* scrollbars: a slim gold rod in a dark groove */
  @supports not selector(::-webkit-scrollbar) { #sheet *, #sheet { scrollbar-width: thin; scrollbar-color: var(--edge) color-mix(in srgb, var(--panel-base) 70%, transparent); } }   /* (Chrome drops the styled bar when these are set) */
  #sheet ::-webkit-scrollbar { width: 12px; height: 0; }
  #sheet ::-webkit-scrollbar-track { background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 85%, transparent), color-mix(in srgb, var(--panel-base) 85%, transparent)); border: 1px solid color-mix(in srgb, var(--edge) 25%, transparent); border-radius: 6px; }
  #sheet ::-webkit-scrollbar-thumb { background: linear-gradient(90deg, var(--edge-dark), var(--edge-light) 45%, var(--edge) 60%, var(--edge-dark)); border: 2px solid color-mix(in srgb, var(--panel-base) 90%, transparent); border-radius: 6px; min-height: 36px; box-shadow: inset 0 0 0 1px rgba(255, 235, 180, 0.25); }
  #sheet ::-webkit-scrollbar-thumb:hover { background: linear-gradient(90deg, var(--edge-dark), var(--gold2) 45%, var(--edge) 60%, var(--edge-dark)); }
  #sheet ::-webkit-scrollbar-button { display: none; height: 0; }
  .sh-head { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
  .sh-head button, #sheet button { all: unset; cursor: pointer; padding: 4px 10px; border: 1px solid color-mix(in srgb, var(--edge) 50%, transparent); border-radius: 4px; font: 600 13px var(--font-body); color: var(--ink); background: rgba(255, 255, 255, 0.04); }
  #sheet button:hover:not([disabled]) { background: color-mix(in srgb, var(--edge) 25%, transparent); color: var(--gold2); } #sheet button[disabled] { opacity: 0.4; cursor: default; }
  #sheetnav { font-size: 13px; opacity: 0.7; margin: 0 4px; }
  .sh-top { display: grid; grid-template-columns: auto 1fr 170px; gap: 18px; align-items: start; }
  .sh-art canvas { image-rendering: pixelated; display: block; background: radial-gradient(#3a3050, #120e1c 70%); border: 1px solid color-mix(in srgb, var(--edge) 50%, transparent); border-radius: 4px; width: 162px; }
  .sh-id h2 { font: 600 30px var(--font-title); color: var(--gold2); margin: 0; } .sh-sub { opacity: 0.75; text-transform: capitalize; margin-bottom: 10px; }
  .sh-bars span { font-size: 13px; display: block; margin-top: 6px; } .sh-bars .bar { height: 7px; }
  .sh-derived { display: flex; gap: 22px; margin-top: 14px; } .sh-derived div { text-align: center; font-size: 12px; opacity: 0.85; } .sh-derived b { display: block; font: 600 26px var(--font-title); color: var(--ink); }
  .sh-stats div { display: flex; justify-content: space-between; border-bottom: 1px solid color-mix(in srgb, var(--edge) 18%, transparent); padding: 3px 0; font-size: 14px; } .sh-stats b { color: var(--gold2); }
  #sheet .bagf { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
  #sheet .bagf button { all: unset; cursor: pointer; padding: 2px 10px; border-radius: 12px; font: 600 13px var(--font-body); color: var(--ink); border: 1px solid color-mix(in srgb, var(--edge) 40%, transparent); }
  #sheet .bagf button small { opacity: 0.6; font-weight: 500; margin-left: 2px; }
  #sheet .bagf button:hover { border-color: var(--edge); }
  #sheet .bagf button.on { background: color-mix(in srgb, var(--gold) 28%, transparent); border-color: var(--gold); }
  #sheet h3 { font: 600 15px var(--font-title); color: var(--gold); margin: 16px 0 6px; letter-spacing: 0.06em; border-bottom: 1px solid color-mix(in srgb, var(--edge) 30%, transparent); padding-bottom: 3px; }
  .slots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; } .slot { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 2px 8px; font-size: 14px; }
  .slot span { opacity: 0.6; font-size: 12px; } .slot small { grid-column: 2; opacity: 0.6; font-size: 12px; } .slot button { grid-row: 1 / 3; grid-column: 3; } .slot em { opacity: 0.45; }
  .spells { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .spells button { display: block !important; padding: 7px 10px !important; } .spells span { color: var(--cool); font-size: 12px; } .spells small { display: block; opacity: 0.65; font-weight: 500; font-size: 12px; margin-top: 2px; }
  .items .item { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); } .items small { grid-column: 1; opacity: 0.6; font-size: 12px; } .items .item button { grid-row: 1 / 3; } .empty { opacity: 0.55; font-size: 14px; }
  /* a phone (narrow, or held sideways): the sheet fills the screen in one column, the portrait a small face beside the
     name, the stats a 3 x 2 grid, and the tabs at the bottom under the thumb; only the pane scrolls */
  @media (max-width: 640px), (max-height: 520px) {
    #sheet .card { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
    .sh-top { grid-template-columns: 64px 1fr; gap: 4px 10px; }
    .sh-art canvas { width: 64px; } .sh-id h2 { font-size: 22px; } .sh-sub { margin-bottom: 2px; font-size: 13px; }
    .sh-derived { margin-top: 4px; gap: 16px; } .sh-derived b { font-size: 18px; display: inline; margin-right: 4px; }
    .sh-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; } .sh-stats div { font-size: 13px; padding: 1px 0; }
    .sh-main > .sh-pane { order: 2; } .sh-main > .sh-tabs { order: 3; margin: 4px 0 0; border-bottom: none; border-top: 1px solid color-mix(in srgb, var(--edge) 35%, transparent); }
    #sheet .sh-tabs button { flex: 1; text-align: center; border-radius: 0 0 6px 6px; border-top: none; border-bottom: 1px solid color-mix(in srgb, var(--edge) 50%, transparent); }
    .slots { grid-template-columns: 1fr; } .order { margin-top: 6px; font-size: 13px; }
  }
  /* held sideways (short): who they are in a column on the left, the tabs and their pane beside it */
  @media (max-height: 520px) {
    #sheet .card { position: relative; } #sheetbody { flex-direction: row; gap: 14px; } .sh-art { display: none; }
    #sheetbody > .sh-top { flex: 0 0 min(36%, 260px); display: block; overflow-y: auto; }
    .sh-stats { grid-template-columns: 1fr 1fr; margin-top: 6px; } .sh-bars span { margin-top: 3px; } .sh-bars .bar { height: 5px; }
    .sh-head { position: absolute; top: 6px; right: 10px; z-index: 2; } .sh-main { padding-top: 34px; } .sh-tabs { margin-top: 0; }
    html.touch #sheet .sh-head button { min-height: 30px; min-width: 34px; padding: 2px 8px; }
    html.touch #sheet .bagf { flex-wrap: nowrap; overflow-x: auto; } html.touch #sheet .bagf button, html.touch #sheet .sh-tabs button { min-height: 34px; font-size: 14px; }
    html.touch #sheet .chip { min-height: 36px; } html.touch #sheet .items .item button { min-height: 38px; padding: 2px 12px; } .items .item { padding: 2px 0; }
  }
  #sheet .sh-tabs button, #sheet .bagf button, #sheet .chip { white-space: nowrap; } #sheet .sh-tabs button { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #pick { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); z-index: 25; }
  #pick.on { display: grid; }
  #pick .pk { padding: 18px 20px 16px; width: min(560px, calc(100vw - 32px)); text-align: center; }
  .pk-title { font: 600 19px var(--font-title); color: var(--gold2); margin-bottom: 14px; }
  .pk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  #pick button { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 8px 9px; border: 1px solid color-mix(in srgb, var(--edge) 45%, transparent); border-radius: 6px; background: rgba(255, 255, 255, 0.04); font-size: 13px; }
  #pick button canvas { image-rendering: pixelated; border-radius: 3px; background: radial-gradient(var(--face1), var(--face2)); }
  #pick button b { font: 600 14px var(--font-title); color: var(--gold2); } #pick button span { opacity: 0.75; } #pick button .bar { width: 100%; }
  #pick button:hover { background: color-mix(in srgb, var(--edge) 22%, transparent); box-shadow: 0 0 0 1px var(--gold2); } #pick button.full { opacity: 0.6; }
  #pick .pk-cancel { display: block; margin: 14px auto 0; padding: 5px 18px; flex-direction: row; }
  .pc.ordered { box-shadow: 0 0 0 1px var(--cool), 0 0 14px color-mix(in srgb, var(--cool) 45%, transparent); } .pi .ord { color: var(--cool); opacity: 1; text-transform: none; }
  .pc { position: relative; } .badge { position: absolute; top: -9px; right: 6px; padding: 1px 7px; font: 600 11px var(--font-title); color: #10202f; background: linear-gradient(var(--cool), var(--cool)); border-radius: 8px; box-shadow: 0 0 10px color-mix(in srgb, var(--cool) 70%, transparent); }
  .order { margin: 12px 0 0; padding: 7px 10px; font-size: 14px; border: 1px solid color-mix(in srgb, var(--cool) 50%, transparent); border-radius: 5px; background: color-mix(in srgb, var(--cool) 8%, transparent); } .order b { color: var(--cool); } .order button { margin-left: 8px; }
  .pick { margin-top: 10px; padding: 10px; border: 1px solid var(--gold); border-radius: 6px; background: color-mix(in srgb, var(--edge) 8%, transparent); display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .pick h3 { grid-column: 1 / -1; margin: 0 0 4px !important; border: 0 !important; } .pick button { display: block !important; } .pick .bar { margin-top: 4px; } .pick .cancel { grid-column: 1 / -1; text-align: center; }
  @media (max-width: 640px) { .sh-top { grid-template-columns: auto 1fr; } .sh-stats { grid-column: 1 / -1; } .slots, .spells { grid-template-columns: 1fr; } }
  #loading { position: fixed; inset: 0; display: grid; place-items: center; font: 600 22px var(--font-title); color: var(--gold2); background: var(--bg); }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 30; }
/* arriving by stairs (or walking a draft in the editor): no title, not even for the moment it takes to load */
.arriving #title { display: none; } .arriving #loading { font-size: 0; }

/* the pointer hides when still (the game adds .nocursor after two seconds) */
body.nocursor, body.nocursor * { cursor: none !important; }

/* ---------- frames: the theme's "frame" sets data-frame on <html>. gilded is the default above ---------- */
:root[data-frame="metal"] .panel, :root[data-frame="metal"] .talk { border: 2px solid transparent; border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-top) 88%, transparent), var(--panel)) padding-box,
              linear-gradient(180deg, color-mix(in srgb, var(--edge) 55%, white), color-mix(in srgb, var(--edge) 60%, black) 48%, color-mix(in srgb, var(--edge) 80%, white) 52%, color-mix(in srgb, var(--edge) 50%, black)) border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.55), 0 6px 22px rgba(0, 0, 0, 0.55); }
:root[data-frame="neon"] .panel, :root[data-frame="neon"] .talk { border: 1px solid var(--edge); border-radius: var(--radius);
  box-shadow: 0 0 10px color-mix(in srgb, var(--edge) 70%, transparent), inset 0 0 14px color-mix(in srgb, var(--edge) 25%, transparent), 0 6px 24px rgba(0, 0, 0, 0.5); }
:root[data-frame="plain"] .panel, :root[data-frame="plain"] .talk { border: 1px solid color-mix(in srgb, var(--edge) 55%, transparent); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); backdrop-filter: none; }
:root[data-frame="parchment"] .panel, :root[data-frame="parchment"] .talk { border: 3px double var(--edge); border-radius: var(--radius); backdrop-filter: none;
  background: radial-gradient(ellipse at 50% 40%, var(--panel-top), var(--panel-base)); box-shadow: inset 0 0 18px color-mix(in srgb, var(--edge-dark) 45%, transparent), 0 6px 20px rgba(0, 0, 0, 0.5); }
:root[data-frame="pixel"] .panel, :root[data-frame="pixel"] .talk { border: 3px solid var(--edge); border-radius: 0; backdrop-filter: none;
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
  box-shadow: inset 0 0 0 2px var(--edge-dark); background: var(--panel); }

/* the button a controller or the arrow keys have highlighted */
.kfocus { outline: 2px solid var(--gold2); outline-offset: 2px; box-shadow: 0 0 12px color-mix(in srgb, var(--gold2) 50%, transparent) !important; }

/* how much of the level has been found (the map panel) */
#found { margin-top: 8px; font-size: 12px; color: var(--dim); cursor: help; } #found .bar { height: 6px; margin-bottom: 3px; } #found .bar em { background: linear-gradient(90deg, var(--edge-dark), var(--gold2)); }

/* ---------- touch (html.touch: a finger was seen) ---------- */
#touchui { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
#touchui button { pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none; font: 700 22px var(--font-body); color: var(--ink); border: 1px solid color-mix(in srgb, var(--edge) 70%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--panel-base) 55%, transparent); backdrop-filter: blur(2px); }
#touchui button.down { background: color-mix(in srgb, var(--gold2) 35%, transparent); }
#touchui .tpad { position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(78px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 56px); grid-auto-rows: 56px; gap: 7px; pointer-events: none; }
#touchui .tuse { position: absolute; right: calc(16px + 3 * 63px + 14px + env(safe-area-inset-right)); bottom: calc(78px + env(safe-area-inset-bottom)); width: 72px; height: 72px; border-radius: 50%; font-size: 17px; color: var(--gold2); }
#touchui .tmenu { position: absolute; left: calc(12px + env(safe-area-inset-left)); top: calc(12px + env(safe-area-inset-top)); width: 52px; height: 52px; }
html.touch-nopad #touchui .tpad { display: none; } html.touch-nopad #touchui .tuse { right: calc(20px + env(safe-area-inset-right)); }
html.touch-battle #touchui .tpad { display: none; } html.touch-battle #touchui .tuse { right: calc(20px + env(safe-area-inset-right)); }   /* (in a fight the pad does nothing; Use fights a round) */
html.touch #help, html.touch #stats { display: none !important; }
html.touch #mapbox { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); padding: 6px; } html.touch #map { width: 118px; } html.touch #bag { font-size: 12px; margin-top: 4px; } html.touch #found { margin-top: 4px; font-size: 11px; }
html.touch #bag .hint { display: none; }   /* (no portraits to click with a mouse) */
@media (max-height: 430px) { html.touch #bag .items { display: none; } }   /* (a phone on its side: only the money, so the panel stays small) */
html.touch #party { bottom: calc(8px + env(safe-area-inset-bottom)); }
/* finger-sized: battle commands, the target picker, sheet buttons, talk choices, the pause menu */
html.touch #cmd button, html.touch .pk-grid button, html.touch #sheet button, html.touch .tk-choices button, html.touch #pmenu button, html.touch #restset button { min-height: 46px; min-width: 46px; font-size: 16px; }
html.touch .tk-choices button { padding: 10px 14px; text-align: left; }
html, body { overscroll-behavior: none; } canvas#view { touch-action: none; }
/* a phone held upright: ask for landscape */
#turnme { display: none; position: fixed; inset: 0; z-index: 60; place-items: center; text-align: center; padding: 24px; background: var(--bg); color: var(--ink); font: 600 20px var(--font-title); }
@media (orientation: portrait) and (max-width: 700px) { html.touch #turnme { display: grid; } }
/* the phone's first screen (touch.js startGate) */
#tapstart { position: fixed; inset: 0; z-index: 70; display: grid; place-content: center; justify-items: center; gap: 22px; padding: 24px; text-align: center; background: var(--bg); color: var(--ink); }
#tapstart .tg-name { font: 600 30px var(--font-title); color: var(--title, var(--gold2)); letter-spacing: 0.06em; }
#tapstart button { font: 700 24px var(--font-title); padding: 18px 54px; border-radius: 999px; color: var(--gold2); background: color-mix(in srgb, var(--panel-base) 85%, transparent); border: 2px solid var(--edge); touch-action: none; }
#tapstart .tg-hint { font: 500 14px var(--font-body); opacity: 0.7; }
/* pause on a phone: the menu scrolls to fit, the pad and Use give way, and the menu button (or a tap outside) carries on */
#pause { overflow-y: auto; } #pause .panel { max-height: calc(100dvh - 16px); overflow-y: auto; box-sizing: border-box; }
html.touch #pause .panel { padding: 12px 18px; } html.touch #pause h2 { font-size: 24px; } html.touch #pause .panel > div:nth-child(2) { display: none; }
html.paused #touchui { z-index: 31; } html.paused #touchui .tpad, html.paused #touchui .tuse { display: none; }
/* the title on a phone: no pad or menu over it, no keyboard help */
html.touch-title #touchui .tpad, html.touch-title #touchui .tmenu { display: none; } html.touch-title #touchui .tuse { right: calc(20px + env(safe-area-inset-right)); } html.touch #title .small { display: none; }
/* the pause menu's clues: riddles and inscriptions read on this level, so none is lost to a quick message */
#pmenu .pm-clues { text-align: left; border-top: 1px solid color-mix(in srgb, var(--edge) 40%, transparent); padding-top: 8px; } #pmenu .pm-clues b { color: var(--gold2); font-size: 13px; } #pmenu .pm-clues p { margin: 4px 0 0; color: var(--ink); line-height: 1.4; }
/* level-ups after a fight: stacked under the messages, one after another, gone together */
#ups { position: fixed; left: 0; right: 0; top: 64px; z-index: 21; display: grid; justify-items: center; gap: 6px; pointer-events: none; transition: opacity 0.5s; } #ups.out { opacity: 0; }
#ups .up { padding: 7px 16px; font-size: 15px; max-width: min(720px, calc(100vw - 32px)); box-sizing: border-box; text-align: center; animation: st-in 0.25s ease-out both; }
/* fights: the fallen, troubles, the boss's bar, the end of the party, gear compared */
.pc.down { filter: grayscale(0.9) brightness(0.6); }
.ails { position: absolute; top: -9px; left: 6px; display: flex; gap: 3px; pointer-events: none; }
.ails i { font: normal 600 10px var(--font-title); font-style: normal; padding: 1px 6px; border-radius: 7px; color: #120c08; background: #ccc; letter-spacing: 0.03em; }
.ails .ail-poison { background: #9be070; } .ails .ail-sleep { background: #a8b8ff; } .ails .ail-stun { background: #ffe070; } .ails .ail-weak { background: #e0a0c8; }
#enemies .ails, #bossbar .ails { position: static; display: inline-flex; margin-left: 8px; vertical-align: 2px; }
.float.weak { color: #ffe070; font-size: 20px; } .float.resist { color: #c8c8d8; font-size: 18px; text-shadow: 0 2px 0 #222, 0 0 8px rgba(0, 0, 0, 0.8); }
.float.skill { color: #ffd0a0; font-size: 20px; text-shadow: 0 2px 0 #401, 0 0 12px rgba(255, 60, 30, 0.9); }
.float.poison { color: #a8f080; text-shadow: 0 2px 0 #130, 0 0 10px rgba(80, 220, 40, 0.8); }
.float[class*="ail-"] { font-size: 19px; } .float.ail-poison { color: #a8f080; } .float.ail-sleep { color: #b8c4ff; } .float.ail-stun { color: #ffe070; } .float.ail-weak { color: #f0b0d8; }
#bossbar { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); width: min(460px, calc(100vw - 260px)); padding: 7px 14px 9px; display: none; z-index: 6; text-align: center; }
#bossbar.on { display: block; } #bossbar b { font: 600 17px var(--font-title); color: var(--gold2); letter-spacing: 0.06em; } #bossbar .bar { margin-top: 5px; height: 9px; } #bossbar .bar em { background: linear-gradient(#e05040, #a02018); }
html.bossfight #turns { top: 70px; }
#gameover { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(4, 0, 0, 0); transition: background 2s; }
#gameover .panel { padding: 24px 40px; text-align: center; opacity: 0; transform: translateY(10px); transition: opacity 1.4s 0.6s, transform 1.4s 0.6s; max-width: calc(100vw - 40px); box-sizing: border-box; }
#gameover.on { background: rgba(10, 0, 0, 0.72); } #gameover.on .panel { opacity: 1; transform: none; }
#gameover h2 { font: 600 34px var(--font-title); color: #e8907a; margin: 0 0 8px; letter-spacing: 0.06em; } #gameover p { color: var(--dim); margin: 0 0 16px; }
#gameover .pm-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#gameover button { font: inherit; font-size: 15px; padding: 6px 14px; background: color-mix(in srgb, var(--panel-base) 80%, transparent); color: var(--ink); border: 1px solid color-mix(in srgb, var(--edge) 45%, transparent); border-radius: 4px; cursor: pointer; } #gameover button:hover { border-color: var(--gold2); color: var(--gold2); }
html.touch #gameover button { min-height: 46px; font-size: 16px; }
.vs { font-style: normal; margin-left: 4px; white-space: nowrap; } .vs.up { color: color-mix(in srgb, #1fa82a 72%, var(--ink)); font-weight: 700; } .vs.dn { color: color-mix(in srgb, #d8301e 72%, var(--ink)); font-weight: 700; }   /* (mixed with the theme's ink: dark on parchment, bright on a dark panel) */
#cmd button:disabled { opacity: 0.35; cursor: default; }
#restset input[type=range] { flex: 0 0 210px; accent-color: var(--gold2); }
#pmenu .pm-party { display: grid; gap: 3px; border-top: 1px solid color-mix(in srgb, var(--edge) 40%, transparent); padding-top: 8px; text-align: left; }
#pmenu .pm-pc { display: grid; grid-template-columns: 32px 1fr 1.4fr 1.3fr 1.2fr 1fr; gap: 8px; align-items: center; font-size: 12.5px; color: var(--dim); cursor: pointer; padding: 1px 4px; border-radius: 4px; } #pmenu .pm-pc:hover { background: color-mix(in srgb, var(--edge) 15%, transparent); }
#pmenu .pm-pc b { color: var(--ink); font-size: 13.5px; } #pmenu .pm-face canvas { display: block; image-rendering: pixelated; border-radius: 3px; }
@media (max-width: 760px) { #pmenu .pm-pc { grid-template-columns: 32px 1fr 1.3fr; } #pmenu .pm-pc span:nth-of-type(2), #pmenu .pm-pc span:nth-of-type(4), #pmenu .pm-pc span:nth-of-type(5) { display: none; } }
.vs:first-child { margin-left: 0; }
/* choosing the party, before the story */
#choose { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); overflow-y: auto; }
#choose .panel { padding: 20px 28px; text-align: center; max-width: min(880px, calc(100vw - 24px)); box-sizing: border-box; max-height: calc(100dvh - 16px); overflow-y: auto; }
#choose h2 { font: 600 30px var(--font-title); color: var(--gold2); margin: 0 0 14px; letter-spacing: 0.08em; }
#choose .cp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
#choose .cp-pc { display: grid; justify-items: center; gap: 2px; padding: 8px 6px; border: 1px solid color-mix(in srgb, var(--edge) 40%, transparent); border-radius: 6px; font-size: 13px; color: var(--dim); }
#choose .cp-pc b { color: var(--ink); font: 600 16px var(--font-title); } #choose .cp-pc small { font-size: 11px; opacity: 0.8; } #choose .cp-face canvas { display: block; image-rendering: pixelated; border-radius: 4px; }
#choose .cp-row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
#choose button { font: inherit; font-size: 16px; padding: 7px 18px; background: color-mix(in srgb, var(--panel-base) 80%, transparent); color: var(--ink); border: 1px solid color-mix(in srgb, var(--edge) 45%, transparent); border-radius: 4px; cursor: pointer; } #choose button:hover { border-color: var(--gold2); color: var(--gold2); }
#choose button.go { border-color: var(--gold2); color: var(--gold2); } #choose button small { opacity: 0.55; margin-left: 4px; font-size: 12px; }
@media (max-width: 700px), (max-height: 500px) { #choose .cp-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; } #choose .cp-pc small { display: none; } #choose .cp-face canvas { width: 40px; height: 40px; } #choose h2 { font-size: 22px; margin-bottom: 8px; } html.touch #choose button { min-height: 46px; } }
#ups .up { transition: opacity 0.55s, transform 0.55s; } #ups .up.out { opacity: 0; transform: translateY(-6px); }
#title:not(.ready) .tbox { visibility: hidden; }   /* (until the game has filled in its own name: the loading line shows alone) */
/* a lift's floor buttons */
#liftmenu { position: fixed; inset: 0; z-index: 32; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); }
#liftmenu .panel { padding: 16px 22px; display: grid; gap: 6px; min-width: 240px; max-height: calc(100dvh - 24px); overflow-y: auto; box-sizing: border-box; }
#liftmenu h3 { margin: 0 0 6px; font: 600 20px var(--font-title); color: var(--gold2); text-align: center; }
#liftmenu button { font: inherit; font-size: 15px; text-align: left; padding: 7px 12px; background: color-mix(in srgb, var(--panel-base) 80%, transparent); color: var(--ink); border: 1px solid color-mix(in srgb, var(--edge) 45%, transparent); border-radius: 4px; cursor: pointer; }
#liftmenu button b { display: inline-block; width: 1.4em; color: var(--gold2); } #liftmenu button:hover:not(:disabled) { border-color: var(--gold2); } #liftmenu button:disabled { opacity: 0.45; cursor: default; }
html.touch #liftmenu button { min-height: 46px; font-size: 17px; }
html.peek body > :not(#view) { display: none !important; }   /* (a peek draws the place only) */

/* Low and Medium: no see-through blur behind the panels (the browser redoes it every frame; on a small GPU that alone costs
   frames). The panels keep their tint. */
:root[data-q="low"] .panel, :root[data-q="medium"] .panel, :root[data-q="low"] .talk, :root[data-q="medium"] .talk,
:root[data-q="low"] #pause, :root[data-q="medium"] #pause, :root[data-q="low"] #touchui button, :root[data-q="medium"] #touchui button { backdrop-filter: none; -webkit-backdrop-filter: none; }

/* playing: no text selection by dragging, and (main.js) no right-click menu; typing boxes still select */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
/* the full map (M): the level as seen, over a dimmed view */
#fullmap { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 60%, transparent); z-index: 29; }
#fullmap.on { display: grid; } #fullmap .panel { padding: 12px 18px 10px; text-align: center; }
#fullmap h2 { font: 600 22px var(--font-title); color: var(--gold2); margin: 0 0 8px; letter-spacing: 0.06em; }
#fullmap canvas { display: block; margin: 0 auto; }
#fullmap .fm-hint { margin-top: 6px; font-size: 12px; opacity: 0.6; }

/* the ledger (L): each dungeon cleared, in order, how much of it is found and what it gave */
#ledger { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 60%, transparent); z-index: 29; }
#ledger.on { display: grid; } #ledger .panel { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 60px); overflow: auto; padding: 16px 24px 18px; }
#ledger .lg-head { display: flex; gap: 14px; align-items: baseline; border-bottom: 1px solid color-mix(in srgb, var(--edge) 60%, transparent); margin-bottom: 6px; }
#ledger h2 { font: 600 20px var(--font-title); color: var(--gold2); margin: 0 0 6px; letter-spacing: 0.06em; }
#ledger .lg-whole { flex: 1; font-size: 14px; opacity: 0.85; } #ledger .lg-hint { font-size: 12px; opacity: 0.6; }
#ledger section { padding: 9px 0 10px; border-bottom: 1px dashed color-mix(in srgb, var(--edge) 45%, transparent); } #ledger section:last-child { border-bottom: none; }
#ledger .lg-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; } #ledger .lg-top b { font-weight: 600; font-size: 16px; }
#ledger .lg-top small { font-size: 11px; color: var(--gold); margin-left: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
#ledger section.done .lg-top span { color: var(--gold2); } #ledger .bar { display: block; margin: 6px 0 7px; }
#ledger .lg-got { display: flex; flex-wrap: wrap; gap: 4px 6px; } #ledger .lg-got span { font-size: 13px; padding: 1px 8px; border: 1px solid color-mix(in srgb, var(--edge) 50%, transparent); border-radius: 10px; }
#ledger .lg-got .none { border: none; opacity: 0.6; padding: 0; } #ledger section p { margin: 6px 0 0; font-size: 13px; opacity: 0.75; }
#ledger section.unreached b { font-weight: normal; opacity: 0.6; }

/* the settings window, over the pause menu */
#settings { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 45%, transparent); z-index: 32; overflow-y: auto; }
#settings.on { display: grid; } #settings > .panel { padding: 20px 36px; text-align: center; max-height: calc(100dvh - 16px); overflow-y: auto; box-sizing: border-box; min-width: min(460px, calc(100vw - 32px)); }
#settings h2 { font: 600 28px var(--font-title); color: var(--gold2); margin: 0 0 4px; letter-spacing: 0.08em; } #settings .st-hint { color: var(--dim); font-size: 13px; }
#settings #restset { margin-top: 12px; } #settings .st-back { margin-top: 14px; }
#settings .st-back button { font: inherit; font-size: 14px; padding: 5px 22px; background: color-mix(in srgb, var(--panel-base) 80%, transparent); color: var(--ink); border: 1px solid color-mix(in srgb, var(--edge) 45%, transparent); border-radius: 4px; cursor: pointer; }
html.touch #settings > .panel { padding: 12px 16px; } html.touch #settings .st-hint { display: none; } html.touch #settings .st-back button { min-height: 46px; }
:root[data-q="low"] #settings, :root[data-q="medium"] #settings { backdrop-filter: none; }
#settings > .panel { width: min(560px, calc(100vw - 16px)); min-width: 0; } #settings .rs-row { flex-wrap: wrap; row-gap: 4px; } #settings #restset span { min-width: 7em; }
#settings #restset input[type=range] { flex: 1 1 110px; min-width: 90px; } #settings select { max-width: 100%; min-width: 0; }
/* the pause menu stays a readable width; what was read on the level scrolls in a box of its own */
#pause .panel { width: min(820px, calc(100vw - 24px)); } #pmenu { min-width: 0; }
#pmenu .pm-clues { max-height: min(30vh, 220px); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; }
#msg { text-align: left; }   /* (typed left to right: the line grows from its start, readable as it comes) */
/* (#msg's width: the whole message's, from the first letter: typewriter() lays the words still to come out unseen) */
#msg { z-index: 26; }   /* (over the character sheet: a battle order said while the sheet is open is seen) */
.bar.found em { background: linear-gradient(90deg, var(--edge-dark, #6a5530), var(--gold2)); }   /* (the journey's found bars: lit as far as found, wherever they show) */
/* the controls panel's ✕, and the little ? left in its place when it is put away */
#help .help-x { float: right; margin: -4px -6px 0 10px; background: none; border: 0; color: var(--dim); font-size: 14px; cursor: pointer; padding: 2px 4px; } #help .help-x:hover { color: var(--gold2); }
#helpchip { display: none; position: fixed; left: 16px; top: 16px; width: 30px; height: 30px; padding: 0; font: 700 15px var(--font-title); color: var(--gold2); cursor: pointer; z-index: 5; }
html.nohelp #help { display: none; } html.nohelp #helpchip { display: block; } .battle #helpchip { opacity: 0; } html.touch #helpchip { display: none !important; }
/* in a battle the turn order runs along the top: messages sit below it */
#hud.battle #msg { top: 118px; } html.bossfight #hud.battle #msg { top: 130px; }
#enemies { top: 58px; }   /* (below the little ? of the controls panel, top left) */
#sheet .bestgear { text-align: center; margin: 2px 0 8px; }   /* (the pack's 'Assign Best Gear To Each Member', centred over the filters) */
#blockhint { position: fixed; left: 50%; bottom: 128px; transform: translateX(-50%); padding: 5px 14px; font: 600 14px var(--font-title); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold2); display: none; z-index: 7; pointer-events: none; } #blockhint.on { display: block; }   /* (facing a block: push and pull) */
#restset .rs-sub span { padding-left: 14px; font-size: 13px; opacity: 0.85; }   /* (one of the people's and foes' sounds, under the row that sets them all) */
/* a screen filter over the menus and panels too, as over the picture (main.js's SVG filters): a handheld's four greens, 1-bit's ink and paper; outermost panels only, so none is filtered twice */
:root[data-screen="handheld"] :is(.panel, .talk, #tapstart, #turnme):not(:is(.panel, .talk) *), :root[data-screen="handheld"] #party .pc { filter: url(#scr-handheld); }
:root[data-screen="1-bit"] :is(.panel, .talk, #tapstart, #turnme):not(:is(.panel, .talk) *), :root[data-screen="1-bit"] #party .pc { filter: url(#scr-1bit); }
/* the battle menu on a phone: no key hints (no keyboard or controller there), and it starts below the menu button, not under it */
html.touch #cmd .hint { display: none; }
html.touch #cmd { top: calc(74px + env(safe-area-inset-top)); bottom: auto; left: calc(12px + env(safe-area-inset-left)); max-height: calc(100dvh - 86px); overflow-y: auto; }
html.touch #enemies { left: auto; right: calc(12px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); align-items: flex-end; }   /* (a phone: the foes' bars top right, clear of the menu button and the battle menu) */
#restset .rs-warn { font-size: 12px; color: #ffb070; text-align: left; margin: -2px 0 4px; line-height: 1.35; }   /* (a quality heavier than the device looks fit for) */
/* held sideways: the portrait kept, small, beside the name at the head of the left column */
@media (max-height: 520px) { .sh-art { display: block; float: left; margin: 2px 10px 4px 0; } .sh-art canvas { width: 58px; } }
html.touch #turns { top: calc(8px + env(safe-area-inset-top)); }   /* (a phone: the turn order at the very top, between the menu button and the foes' bars) */
html.touch #hud.battle #msg { top: calc(66px + env(safe-area-inset-top)); }
html.touch.bossfight #turns { top: calc(62px + env(safe-area-inset-top)); } html.touch.bossfight #hud.battle #msg { top: calc(122px + env(safe-area-inset-top)); }   /* (a boss's bar has the top) */
#title .watch { margin-top: 18px; font: 600 15px var(--font-body, inherit); padding: 9px 20px; border-radius: 999px; cursor: pointer; color: var(--gold2); background: color-mix(in srgb, var(--panel) 85%, transparent); border: 1px solid color-mix(in srgb, var(--gold2) 50%, transparent); }
#title .watch:hover { background: color-mix(in srgb, var(--gold2) 18%, var(--panel)); }
#title .diffpick { margin-top: 14px; display: flex; gap: 6px; align-items: center; justify-content: center; font: 500 13px var(--font-body, inherit); color: var(--ink-dim, var(--gold2)); }
#title .diffpick span { margin-right: 4px; opacity: 0.8; }
#title .diffpick button { font: inherit; padding: 4px 12px; border-radius: 999px; cursor: pointer; color: var(--gold2); background: color-mix(in srgb, var(--panel) 70%, transparent); border: 1px solid color-mix(in srgb, var(--gold2) 30%, transparent); }
#title .diffpick button.on { background: color-mix(in srgb, var(--gold2) 28%, var(--panel)); border-color: var(--gold2); }
html.autoplay #touchui, html.autoplay #cmd .hint { display: none; }   /* (watching: no controls in the picture) */
html.inroom body > :not(.moment):not(#view) { visibility: hidden !important; } html.inroom body > :not(.moment) * { visibility: hidden !important; }   /* (turning in: the room alone, no panels over it) */

/* the faces' credit on the title (FLAME, CC-BY-4.0) */
#title .credit { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 11px; opacity: 0.55; pointer-events: none; }
