/* =====================================================================
   Round 3 (Agent P): controls-hint bar, Settings notebook, in-game menu.
   Built on theme.css + setpieces.css + journal.css (field-journal kit).
   ===================================================================== */

/* ===================================================================== CONTROLS-HINT BAR (#hintbar) */
:root { --hints-h: 0px; }
body.hints-on { --hints-h: 1.75rem; }
#hintbar { position: fixed; left: 50%; bottom: 0.3rem; transform: translate(-50%, 0.4rem); z-index: calc(var(--z-hud) + 1); display: flex; align-items: center; gap: 0.15rem 0.5rem; flex-wrap: nowrap; max-width: calc(100vw - 1rem); overflow: hidden; white-space: nowrap;
  padding: 0.18rem 1.6rem 0.2rem; pointer-events: none; opacity: 0; transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
  background: linear-gradient(180deg, rgba(24, 38, 80, 0.86), rgba(15, 25, 54, 0.88)); border: 2px solid rgba(255, 255, 255, 0.12); border-radius: var(--r-pill); box-shadow: var(--shadow-1); font-family: var(--font-ui); font-weight: 800; font-size: var(--fs-2xs); color: rgba(255, 255, 255, 0.92); letter-spacing: 0.02em; }
#hintbar.is-on { opacity: 1; transform: translate(-50%, 0); }
#hintbar .hb-item { display: inline-flex; align-items: center; gap: 0.32rem; transition: color var(--t-med); }
#hintbar .hb-lab { font-weight: 800; text-shadow: none; }
#hintbar .hb-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 203, 5, 0.55); flex: none; }
#hintbar .hb-sep { margin: 0 0.1rem; opacity: 0.7; }
#hintbar .hb-item.is-flash { color: var(--gold-hi); animation: hb-flash 0.6s var(--ease-out); }
@keyframes hb-flash { 30% { transform: translateY(-2px); } }
/* keycaps: cream typewriter-style caps with a brass rim; pad buttons: round faces */
.hb-key { display: inline-grid; place-items: center; min-width: 1.32rem; height: 1.25rem; padding: 0 0.3rem; border-radius: var(--r-sm); font: 900 0.66rem/1 var(--font-ui); letter-spacing: 0.01em; color: #1f2a4a; text-shadow: none;
  background: linear-gradient(180deg, #ffffff, #e9eef8); box-shadow: inset 0 -2px 0 rgba(31, 42, 74, 0.22), 0 1px 2px rgba(0, 0, 0, 0.4); }
.hb-key--wide { padding: 0 0.42rem; }
.hb-key--pad { border-radius: 50%; min-width: 1.32rem; width: 1.32rem; height: 1.32rem; padding: 0; color: #fff; background: radial-gradient(circle at 40% 35%, #4a5680, #222c50); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.4), 0 0 0 1.5px rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.5); }
.hb-key--pill { border-radius: 0.7rem; width: auto; padding: 0 0.45rem; font-size: 0.56rem; letter-spacing: 0.06em; }
.hb-pad-a { color: #8ff09a; } .hb-pad-b { color: #ff9a86; } .hb-pad-x { color: #8fc8ff; } .hb-pad-y { color: #ffe06a; }
/* the bottom-anchored HUD steps up while the bar shows */
body.hints-on #moves, body.hints-on #log, body.hints-on .lf-strip, body.hints-on .lf-build { margin-bottom: var(--hints-h); }
body.hints-on #dialog { bottom: calc(var(--gutter) + 0.5rem + var(--hints-h)); }
body.hints-on .lf-buffs { bottom: calc(var(--gutter) + 3.2rem + var(--hints-h)); }
@media (max-width: 720px) { #hintbar { font-size: 0.6rem; padding-inline: 0.8rem; gap: 0.1rem 0.35rem; } #hintbar .hb-dot { display: none; } }

/* ===================================================================== SETTINGS (a notebook with index tabs) */
.st-wrap { position: fixed; inset: 0; z-index: calc(var(--z-screen) + 5); display: grid; place-items: center; font-family: var(--font-ui); color: var(--text); }
.st-scrim { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(10, 8, 6, 0.45), rgba(6, 5, 4, 0.82)); animation: ui-fade var(--t-med) both; }
.st-book { position: relative; width: min(54rem, calc(100vw - 1.5rem)); height: min(38rem, calc(100vh - 2rem)); display: flex; flex-direction: column; padding: 1rem 1.2rem 1.2rem; animation: ui-panel-in var(--t-slow) var(--ease-out) both; }
.st-head { display: flex; align-items: baseline; gap: 0.8rem; padding: 0 0.5rem 0.6rem; position: relative; z-index: 1; }
.st-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: var(--fs-xl); letter-spacing: 0.02em; color: var(--gold-hi); }
.st-sub { flex: 1; font-family: var(--font-prose); font-style: italic; color: var(--text-dim); font-size: 0.95rem; }
.st-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 9.5rem 1fr; gap: 0; position: relative; z-index: 1; }
.st-tabs { display: flex; flex-direction: column; gap: 0.35rem; padding-top: 0.8rem; }
.st-wrap button.st-tab { all: unset; cursor: pointer; position: relative; padding: 0.6rem 0.9rem 0.6rem 1rem; margin-right: -0.6rem; font-family: var(--font-display); font-weight: 900; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(242, 234, 216, 0.72); border-radius: 0.45rem 0 0 0.45rem; background: linear-gradient(90deg, rgba(255, 240, 210, 0.05), rgba(255, 240, 210, 0.02)); transition: color var(--t-fast), background var(--t-fast); }
.st-wrap button.st-tab:hover, .st-wrap button.st-tab:focus-visible { color: var(--gold-hi); outline: none; background: rgba(255, 240, 210, 0.08); }
.st-wrap button.st-tab.is-on { color: var(--ink); background: var(--grain), linear-gradient(90deg, #d8c08a, #ecdcb9); box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.35); z-index: 2; }
.st-page { min-height: 0; display: flex; flex-direction: column; }
.st-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 1.2rem 1.6rem 1.4rem; scrollbar-width: thin; scrollbar-color: var(--fj-paper-dark) transparent; }
.st-page .st-leaf { right: 1.2rem; bottom: 1rem; --r: 30deg; opacity: 0.55; }
.st-h { margin: 0 0 0.6rem; font-family: var(--font-print); font-weight: 400; font-size: 1.45rem; color: var(--ink); letter-spacing: 0.04em; text-shadow: var(--fj-ink-smudge); border-bottom: 1px solid rgba(31, 42, 74, 0.217); padding-bottom: 0.25rem; }
.st-h--sub { font-size: 1.15rem; margin-top: 1.2rem; }
.st-row { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(12rem, 1.25fr); gap: 0.4rem 1.2rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px dashed rgba(31, 42, 74, 0.174); }
.st-k b { display: block; font-family: var(--font-prose); font-weight: 600; font-size: 1.12rem; color: var(--ink); }
.st-k small { display: block; font-family: var(--font-prose); font-style: italic; font-size: 0.9rem; color: var(--ink-soft); line-height: 1.25; }
.st-seg { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.st-wrap button.st-opt, .st-wrap button.st-toggle { all: unset; cursor: pointer; padding: 0.28rem 0.7rem; border-radius: var(--r-sm); font: 700 0.82rem/1.2 var(--font-ui); color: var(--ink-soft); border: 1px solid rgba(31, 42, 74, 0.248); background: rgba(255, 250, 235, 0.35); transition: background var(--t-fast), color var(--t-fast); }
.st-wrap button.st-opt:hover, .st-wrap button.st-toggle:hover, .st-wrap button.st-opt:focus-visible, .st-wrap button.st-toggle:focus-visible { background: rgba(255, 245, 215, 0.9); color: var(--ink); outline: 2px solid rgba(44, 74, 99, 0.3); outline-offset: 1px; }
.st-wrap button.st-opt.is-on { color: #fbf3e0; background: var(--ink-blue); border-color: var(--ink-blue); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.st-wrap button.st-toggle { display: inline-flex; align-items: center; gap: 0.5rem; }
.st-wrap button.st-toggle i { width: 1.05rem; height: 1.05rem; border: 1.5px solid var(--ink); border-radius: var(--r-sm); display: grid; place-items: center; }
.st-wrap button.st-toggle.is-on i::after { content: '✓'; font: 700 1rem/1 var(--font-hand); color: var(--ink-green); transform: translate(1px, -2px) rotate(-6deg); }
.st-wrap button.st-toggle.is-on { color: var(--ink); }
.st-range { display: flex; align-items: center; gap: 0.7rem; }
.st-range output { min-width: 3rem; text-align: right; font: 700 0.85rem var(--font-ui); color: var(--ink); font-variant-numeric: tabular-nums; }
.st-range input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 1.4rem; background: transparent; cursor: pointer; }
.st-range input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: var(--r-sm); background: rgba(31, 42, 74, 0.341); }
.st-range input[type=range]::-moz-range-track { height: 3px; background: rgba(31, 42, 74, 0.341); }
.st-range input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1.05rem; height: 1.05rem; margin-top: -0.43rem; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1c4, var(--gold) 45%, var(--gold-deep)); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45); }
.st-range input[type=range]::-moz-range-thumb { width: 1rem; height: 1rem; border-radius: 50%; border: 0; background: radial-gradient(circle at 35% 30%, #fff1c4, var(--gold) 45%, var(--gold-deep)); }
.st-range input[type=range]:focus-visible { outline: 2px solid rgba(44, 74, 99, 0.35); outline-offset: 2px; }
.st-note { font-family: var(--font-hand); font-size: 1.15rem; color: var(--ink-blue); margin: 0.6rem 0; line-height: 1.2; }
.st-acts { display: flex; gap: 0.6rem; margin-top: 0.9rem; }
.st-page .ui-btn { --b-line: rgba(31, 42, 74, 0.31); --b-fill: rgba(255, 250, 235, 0.6); --b-c: var(--ink); color: var(--ink); }
.st-page .ui-btn:hover, .st-page .ui-btn:focus-visible { --b-fill: rgba(255, 245, 215, 0.98); color: var(--ink); }
.st-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.6rem; }
.st-key { display: grid; grid-template-columns: 1fr auto 4.6rem; align-items: center; gap: 0.6rem; padding: 0.3rem 0.2rem; border-bottom: 1px dashed rgba(31, 42, 74, 0.155); }
.st-key__l { font-family: var(--font-prose); font-size: 1rem; color: var(--ink); }
.st-key__g .ui-key { min-width: 1.6rem; }
.st-key.is-moved .st-key__g::after { content: '•'; color: var(--ink-red); margin-left: 0.2rem; }
.st-key.is-wait { background: rgba(200, 68, 42, 0.08); }
.st-key em { font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink-red); font-style: normal; }
.st-wrap button.st-link { all: unset; cursor: pointer; font-family: var(--font-hand); font-weight: 700; font-size: 1.05rem; color: var(--ink-blue); text-align: right; }
.st-wrap button.st-link:hover, .st-wrap button.st-link:focus-visible { text-decoration: underline; outline: none; }
.st-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem 1rem; font-family: var(--font-prose); font-size: 0.98rem; color: var(--ink); }
.st-pad span { display: flex; align-items: center; gap: 0.45rem; }
.st-mgs { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; }
.st-mg { font-family: var(--font-prose); font-size: 0.98rem; color: var(--ink); padding: 0.15rem 0.55rem; border: 1px solid rgba(31, 42, 74, 0.217); border-radius: var(--r-sm); background: rgba(255, 250, 235, 0.3); }
.st-mg b { font-family: var(--font-hand); font-size: 1.05rem; color: var(--ink-blue); margin-left: 0.25rem; }
.st-mg.is-done b { color: var(--ink-green); }
@media (max-width: 720px) {
  .st-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .st-tabs { flex-direction: row; overflow-x: auto; padding-top: 0; }
  .st-wrap button.st-tab { border-radius: 0.45rem 0.45rem 0 0; margin: 0 0 -0.4rem; padding: 0.5rem 0.7rem; }
  .st-row { grid-template-columns: 1fr; }
  .st-keys { grid-template-columns: 1fr; }
  .st-pad { grid-template-columns: 1fr 1fr; }
  .st-sub { display: none; }
}

/* ===================================================================== IN-GAME MENU (Esc in town) */
#gamemenu .gm-card { position: relative; width: min(21rem, calc(100vw - 2rem)); padding: 1.3rem 1.4rem 1.2rem; animation: ui-panel-in var(--t-slow) var(--ease-out) both; transform: rotate(-0.6deg); }
.gm-who { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.8rem; padding-bottom: 0.7rem; border-bottom: 1px solid rgba(31, 42, 74, 0.217); }
.gm-who img { width: 3.2rem; height: 3.2rem; image-rendering: pixelated; background: #fbf6ea; padding: 0.15rem; box-shadow: 0 2px 4px rgba(15, 30, 70, 0.28); transform: rotate(-3deg); }
.gm-who b { display: block; font-family: var(--font-hand); font-size: 1.7rem; line-height: 1; color: var(--ink); }
.gm-who small { font-family: var(--font-prose); font-style: italic; color: var(--ink-soft); font-size: 0.95rem; }
.gm-list { display: flex; flex-direction: column; gap: 0.15rem; }
#gamemenu .gm-list button { all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 0.42rem 0.6rem; border-radius: var(--r-sm); font-family: var(--font-print-lc); font-size: 1.22rem; color: var(--ink); }
#gamemenu .gm-list button:hover, #gamemenu .gm-list button:focus-visible { background: rgba(44, 74, 99, 0.1); box-shadow: inset 3px 0 0 var(--ink-red); outline: none; }
#gamemenu .gm-list button:last-child { color: var(--ink-red); margin-top: 0.3rem; border-top: 1px dashed rgba(31, 42, 74, 0.186); border-radius: 0; }
.gm-save { margin-top: 0.7rem; font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink-green); text-align: center; }
.st-status { font-family: var(--font-hand); font-size: 1.2rem; color: var(--ink-green); }

/* ===================================================================== AUTOSAVE INDICATOR (bottom-right) */
#autosave { position: fixed; right: calc(var(--gutter) + 0.2rem); bottom: calc(var(--gutter) + var(--hints-h)); z-index: calc(var(--z-hud) + 2); display: flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.75rem 0.3rem 0.5rem; pointer-events: none;
  font-family: var(--font-hand); font-weight: 700; font-size: 1.15rem; color: #f6ead0; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, 0.8);
  background: radial-gradient(ellipse at 30% 50%, rgba(10, 8, 6, 0.6), rgba(10, 8, 6, 0) 75%); opacity: 0; transform: translateY(0.4rem); transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out); }
#autosave.is-on { opacity: 1; transform: none; }
#autosave .as-g { width: 1.35rem; height: 1.35rem; color: var(--gold); }
#autosave .as-g svg { width: 100%; height: 100%; }
#autosave .as-flame { fill: #ffb24a; }
#autosave.is-saving .as-flame { animation: as-flick 0.35s ease-in-out infinite alternate; }
#autosave.is-saving .as-t { color: #e8dcbc; }
@keyframes as-flick { to { opacity: 0.45; transform: scaleY(0.85); transform-origin: 50% 90%; } }
#autosave.is-long { max-width: min(26rem, 70vw); white-space: normal; font-size: 1.1rem; line-height: 1.15; }
#autosave b { color: var(--gold-hi); }
body.cine-on #autosave, body.sp-busy #autosave, body.at-title #autosave { opacity: 0 !important; }
#autosave.is-dun { bottom: calc(var(--gutter) + var(--hints-h) + 8.6rem); }
