/* M9 guidance (game/guide.js, game/firsthints.js), accessibility themes (ui/settings.js) and the responsive top bar
   (BACKLOG 47). Loaded by index.html after style.css / econ.css. Layout reference 1280 x 720 at UI scale 1. */

/* ---------------------------------------------------------------- the guide card (lower left of the map) */
.guide-card {
  position: absolute;
  left: 56px;
  bottom: 104px;
  top: auto !important;
  right: auto !important;
  width: 318px;
  max-height: calc(100% - 300px);
  overflow-y: auto;
  padding: 6px 8px 7px;
  z-index: 12;
  font: calc(12px * var(--fz)) / calc(16px * var(--fz)) var(--font);
  color: var(--text);
}
.guide-card.min {
  width: 230px;
  padding: 3px 6px;
}
.gd-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gd-head .portrait {
  flex: none;
  image-rendering: pixelated;
  box-shadow: 0 0 0 1px var(--brass-dk);
}
.gd-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.gd-title {
  font-weight: 700;
  color: var(--brass-hi);
  overflow-wrap: anywhere;
}
.gd-sub {
  color: var(--dim);
  font-size: calc(11px * var(--fz));
}
.gd-min {
  flex: none;
  align-self: flex-start;
}
.gd-text {
  margin: 6px 0 4px;
}
.gd-wait {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 3px 0;
  color: var(--warn);
}
.gd-progress {
  position: relative;
  height: 14px;
  margin: 5px 0 3px;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--steel-lo);
}
.gd-progress .gd-fill,
.gd-bar .gd-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--teal-dk);
}
.gd-ptext {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: calc(11px * var(--fz));
  line-height: calc(14px * var(--fz));
}
.gd-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 5px 0;
}
.gd-choice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 5px;
  background: rgba(7, 8, 10, 0.45);
  box-shadow: inset 0 0 0 1px var(--steel-lo);
}
.gd-ch-title {
  font-weight: 700;
  color: var(--brass-hi);
}
.gd-ch-text {
  color: var(--dim);
  font-size: calc(11px * var(--fz));
  line-height: calc(14px * var(--fz));
}
.gd-ch-line {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-size: calc(11px * var(--fz));
}
.gd-ch-line .good {
  color: var(--good);
}
.gd-ch-line .bad {
  color: var(--bad);
}
.gd-hint {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 4px 0;
  padding: 3px 4px;
  color: var(--text);
  background: rgba(240, 168, 60, 0.08);
  box-shadow: inset 2px 0 0 var(--warn);
}
.gd-hint > .glyph {
  flex: none;
  color: var(--warn);
  margin-top: 2px;
}
.gd-hint > span {
  flex: 1;
}
.gd-hint .btn {
  flex: none;
}
.gd-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.gd-skip,
.gd-skipall {
  margin-left: auto;
  opacity: 0.8;
}
.gd-skip + .gd-skipall {
  margin-left: 0;
}
.gd-objrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 5px 0;
}
.gd-objrow.main .gd-objtxt {
  font-weight: 700;
}
.gd-objtxt {
  flex: 1 1 200px;
}
.gd-bar {
  position: relative;
  flex: 1 1 100%;
  height: 3px;
  background: var(--ink);
}

/* map pins of "Show me" (positioned per frame by game/guide.js) */
.guide-pin {
  position: absolute;
  top: 0;
  left: 0;
  right: auto !important;
  bottom: auto !important;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -100%);
  pointer-events: none !important;
  animation: gp-bob 1.1s ease-in-out infinite;
}
.gp-label {
  padding: 1px 5px;
  font: 700 calc(11px * var(--fz)) / calc(14px * var(--fz)) var(--font);
  color: var(--ink);
  background: var(--brass-hi);
  box-shadow: 0 0 0 1px var(--ink);
  white-space: nowrap;
}
.gp-arrow {
  color: var(--brass-hi);
  font-size: calc(12px * var(--fz));
  line-height: calc(10px * var(--fz));
  text-shadow: 0 1px 0 var(--ink);
}
.guide-pin.gp-b .gp-label {
  background: var(--cyan-hi);
}
.guide-pin.gp-b .gp-arrow {
  color: var(--cyan-hi);
}
.guide-pin.off .gp-arrow {
  visibility: hidden;
}
@keyframes gp-bob {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -4px; }
}

/* UI elements the guide points at */
.guide-hl {
  box-shadow: 0 0 0 2px var(--brass-hi), 0 0 10px 2px rgba(255, 210, 122, 0.55) !important;
  animation: guide-pulse 1.2s ease-in-out infinite;
}
.guide-flash {
  animation: guide-pulse 0.4s ease-in-out 4;
}
@keyframes guide-pulse {
  0%, 100% { outline: 2px solid rgba(255, 210, 122, 0.95); outline-offset: 1px; }
  50% { outline: 2px solid rgba(255, 210, 122, 0.15); outline-offset: 3px; }
}
:root[data-fx='minimal'] .guide-pin,
:root[data-fx='reduced'] .guide-pin {
  animation: none;
}
:root[data-fx='reduced'] .guide-hl {
  animation: none;
}

/* ---------------------------------------------------------------- first-contact cards (above the guide card) */
.fc-stack {
  position: absolute;
  left: 380px;
  bottom: 104px;
  top: auto !important;
  right: auto !important;
  width: 280px;
  z-index: 12;
  pointer-events: none !important;
}
.fc-card {
  pointer-events: auto;
  padding: 5px 7px 6px;
  font: calc(12px * var(--fz)) / calc(16px * var(--fz)) var(--font);
  animation: fc-in 0.25s ease-out;
}
.fc-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fc-new {
  padding: 0 4px;
  font-weight: 700;
  font-size: calc(10px * var(--fz));
  color: var(--ink);
  background: var(--teal);
}
.fc-title {
  flex: 1;
  font-weight: 700;
  color: var(--brass-hi);
}
.fc-text {
  margin: 5px 0;
}
.fc-foot {
  display: flex;
  gap: 5px;
}
@keyframes fc-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------------------------------------------------------------- the how-to card */
.howto-modal .modal-body,
.howto-modal .win-body {
  max-width: 760px;
}
.howto-lead {
  margin: 0 0 8px;
  color: var(--dim);
}
.howto-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  gap: 8px;
}
.howto-cell {
  padding: 6px 8px;
  background: rgba(7, 8, 10, 0.45);
  box-shadow: inset 0 0 0 1px var(--steel-lo);
}
.howto-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--brass-hi);
  font-weight: 700;
}
.howto-n {
  display: inline-block;
  width: 16px;
  text-align: center;
  color: var(--ink);
  background: var(--brass);
}
.howto-text {
  margin: 5px 0;
  line-height: calc(16px * var(--fz));
}
.howto-key {
  margin: 0;
  color: var(--dim);
  font-size: calc(11px * var(--fz));
}

/* help sheet buttons (ui/help.js block 'action') */
.help-action {
  margin: 4px 6px 4px 0;
}

/* ---------------------------------------------------------------- responsive top bar (BACKLOG 47)
   game/hud.js measures the bar and sets data-fit 1..3 on it while the right-hand items would cover the clock */
.topbar[data-fit] {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}
.topbar[data-fit] .tb-title {
  max-width: 150px;
}
.topbar[data-fit] .tb-right {
  gap: 4px;
}
.topbar[data-fit='1'] .wl-wish,
.topbar[data-fit='2'] .wl-wish,
.topbar[data-fit='3'] .wl-wish {
  display: none;
}
.topbar[data-fit='2'] .tb-title,
.topbar[data-fit='3'] .tb-title {
  max-width: 90px;
}
.topbar[data-fit='2'] .tb-plan > span,
.topbar[data-fit='3'] .tb-plan > span,
.topbar[data-fit='3'] .hv-sub {
  display: none;
}
.topbar[data-fit='3'] .tb-clock {
  min-width: 118px;
}
.topbar[data-fit='3'] .tb-title {
  display: none;
}

/* ---------------------------------------------------------------- accessibility (ui/settings.js) */
/* text size: data-text on :root scales every font up to 16px through --fz (style.css) */
:root[data-text='large'] {
  --fz: 1.3333;
}
:root[data-text='xl'] {
  --fz: 1.5;
}
/* high-contrast panels: solid dark plates, white text, bright outlines */
:root[data-contrast='high'] {
  --text: #ffffff;
  --dim: #d8d8d8;
  --mute: #b0b0b0;
  --steel-lo: #9aa0aa;
}
:root[data-contrast='high'] .frame,
:root[data-contrast='high'] .plate-solid,
:root[data-contrast='high'] .tooltip,
:root[data-contrast='high'] .modal,
:root[data-contrast='high'] .dock-card {
  border-image: none !important;
  border: 2px solid #ffffff !important;
  background: #000000 !important;
}
:root[data-contrast='high'] .btn,
:root[data-contrast='high'] button.hud-item,
:root[data-contrast='high'] .vw-btn {
  outline: 1px solid #ffffff;
}
:root[data-contrast='high'] .lx-u {
  text-decoration-thickness: 2px;
}
/* keyboard focus is always visible (full keyboard navigation of panels) */
:focus-visible {
  outline: 2px solid var(--cyan-hi) !important;
  outline-offset: 1px;
}
.key-conflict {
  color: var(--warn);
  font-size: calc(11px * var(--fz));
}
/* locked buttons stay hoverable for their tooltip (aria-disabled instead of disabled) */
.btn[aria-disabled='true'],
button[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}
