/* Atlas shell (UX_SPEC §5, §6, §7, §11): five labelled doors, progressive reveal, trust markers, Codex, hints. */

/* ---- doors ------------------------------------------------------------------------------------------------ */
.tb-buttons { display: flex; gap: 6px; align-items: center; }
#topbar .nav-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; position: relative; }
#topbar .nav-btn .lbl { display: inline !important; }
#topbar .nav-btn.btn-icon { padding: 4px 8px; }
#btn-play .emoji { font-size: 14px; }
.btn.nav-btn[aria-pressed="true"] { background: linear-gradient(180deg, #5a4a24, #3a2f15); }

/* ---- progressive reveal: hidden until earned (body.rv-*) -------------------------------------------------- */
body:not(.rv-yields) #yields, body:not(.rv-yields) #turn { display: none !important; }
body:not(.rv-lenses) #lens-dock { display: none !important; }
body:not(.rv-lenses) #btn-minimap { display: none !important; }
body:not(.rv-lensDepth) #btn-lenses { display: none !important; }
body:not(.rv-councils) #btn-advisors { display: none !important; }
body:not(.rv-layers) #btn-res, body:not(.rv-layers) #btn-maplayers { display: none !important; }
body.rv-lenses #lens-dock { animation: rv-arrive .3s ease-out both; }

/* The quiet "New" dot: 6 px warm gold, never a red count. */
.new-dot { position: relative; }
.new-dot::after { content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%;
  background: #f2c75c; box-shadow: 0 0 0 1.5px #1b2a3a; pointer-events: none; }
#lens-dock.new-dot::after { top: 6px; right: 6px; }

@keyframes rv-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- landing prompt --------------------------------------------------------------------------------------- */
/* A small pill near the bottom edge of the map, clear of the labels and of every panel; fades on first interaction. */
.touch-prompt { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 8px); z-index: 6; pointer-events: none;
  font-family: var(--serif); font-size: 14px; letter-spacing: .05em; color: #f3ead2; opacity: 0; white-space: nowrap;
  padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(201,164,92,.55);
  background: rgba(16,14,10,.72); box-shadow: 0 4px 14px rgba(0,0,0,.4); transition: opacity .6s, transform .6s; }
body:has(#city-panel:not([hidden])) .touch-prompt, body:has(.modal:not([hidden])) .touch-prompt, body:has(.adv-dock:not([hidden])) .touch-prompt, body:has(#lens-picker:not([hidden])) .touch-prompt { display: none; }
/* Codex links on jargon (CMA, CSD, LIM-AT…): quiet dotted underline, opens the entry. */
.cx-term { all: unset; cursor: pointer; border-bottom: 1px dotted currentColor; text-underline-offset: 2px; }
.cx-term:hover, .cx-term:focus-visible { color: var(--gold, #c9a45c); outline: none; }
.lp-explorer { margin-left: auto; margin-right: 8px; font-size: 12px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  background: transparent; color: inherit; border: 1px solid rgba(201,164,92,.5); }
.lp-explorer:hover { border-color: var(--gold, #c9a45c); }
.touch-prompt.in { opacity: .92; transform: translate(-50%, 0); }

/* ---- one-line hints --------------------------------------------------------------------------------------- */
.rv-hint { position: fixed; z-index: 60; max-width: 300px; display: flex; gap: 10px; align-items: center;
  padding: 8px 10px 8px 12px; border-radius: 10px; border: 1px solid var(--gold); color: #2a2216; font-size: 13px; line-height: 1.35;
  background: linear-gradient(180deg, #f6ecd2, #e8d9b4); box-shadow: 0 6px 18px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
.rv-hint.above { transform: translateY(-8px); }
.rv-hint.in { opacity: 1; transform: none; }
.rv-hint.still { transition: opacity .3s; transform: none; }
.rv-hint::before { content: ""; position: absolute; left: var(--ax, 50%); width: 10px; height: 10px; margin-left: -5px; background: #f2e6c8;
  border: 1px solid var(--gold); transform: rotate(45deg); }
.rv-hint.below::before { top: -6px; border-right: 0; border-bottom: 0; }
.rv-hint.above::before { bottom: -6px; border-left: 0; border-top: 0; background: #e8d9b4; }
.rv-hint-ok { flex: none; border: 1px solid #8a6d32; background: transparent; border-radius: 6px; padding: 3px 8px; font: inherit; font-size: 12px; color: #4a3a1c; cursor: pointer; }
.rv-hint-ok:hover { background: rgba(138,109,50,.15); }

/* ---- overflow menu ---------------------------------------------------------------------------------------- */
.more-menu { position: fixed; z-index: 55; min-width: 230px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.more-menu[hidden] { display: none; }
.more-menu .mm-item, .more-menu .mm-ext > button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 10px;
  background: transparent; border: 0; border-radius: 6px; color: var(--ink, #ece3cc); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.more-menu .mm-item:hover, .more-menu .mm-item:focus-visible, .more-menu .mm-ext > button:hover { background: rgba(201,164,92,.16); color: var(--gold-bright); }
.more-menu .mm-item .lbl, .more-menu .mm-ext .lbl { display: inline !important; }
.more-menu .mm-ext { display: flex; flex-direction: column; gap: 2px; }
.more-menu .mm-ext[hidden] { display: none; }
.more-menu .mm-sep { height: 1px; margin: 4px 6px; background: rgba(201,164,92,.35); }
.more-menu .mm-state { margin-left: auto; font-size: 12px; opacity: .7; }
.more-menu [aria-checked="true"] .mm-state { color: var(--gold-bright); opacity: 1; }

/* ---- labelled top-bar numbers ----------------------------------------------------------------------------- */
#yields .yield { align-items: center; gap: 6px; padding-bottom: 0; }
#yields .yield .caret { display: none; }
#yields .yield .ico { display: inline-flex; align-self: center; }
#yields .y-stack { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
#yields .y-val { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
#yields .y-lbl { font-family: system-ui, sans-serif; font-size: 10px; margin-top: 1px; letter-spacing: .02em; color: #cbbf9f; opacity: .85; white-space: nowrap; }

/* ---- trust markers (§6.1): shape carries meaning; colour is secondary ------------------------------------- */
.trust { display: inline-grid; place-items: center; width: 1.05em; height: 1.05em; margin-right: 4px; font-size: 10px; line-height: 1;
  font-style: normal; font-family: system-ui, "Segoe UI Symbol", sans-serif; opacity: .7; cursor: pointer; vertical-align: 1px; border-radius: 3px; flex: none; }
.trust:hover, .trust:focus-visible { opacity: 1; outline: 1px solid currentColor; outline-offset: 1px; }
.t-observed { color: #EDE6D6; }
.t-forecast { color: #8FB3D9; }
.t-estimate { color: #E0B45C; }
.t-assumption { color: #D98A5C; }
.t-illustrative { color: #b7b1a3; background: repeating-linear-gradient(135deg, rgba(160,155,140,.35) 0 2px, transparent 2px 4px); }
#city-panel .trust { color-scheme: dark; }
.cp-pop .trust, .stat-row .trust { margin-left: 2px; }
.trust-card { position: fixed; z-index: 70; width: 290px; padding: 10px 12px; font-size: 13px; line-height: 1.4; }
.trust-card[hidden] { display: none; }
.trust-card .tc-head { display: flex; align-items: center; gap: 6px; font-family: var(--serif); color: var(--gold-bright); font-size: 14px; }
.trust-card .tc-head .trust { font-size: 13px; opacity: 1; }
.trust-card p { margin: 6px 0; }
.trust-card .tc-what { opacity: .85; }
.trust-card .tc-src { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.trust-card .tc-src span { opacity: .75; font-size: 12px; }
.trust-card .tc-row { display: flex; gap: 8px; font-size: 12px; } .trust-card .tc-row span { opacity: .6; min-width: 52px; }
.trust-card .tc-note { font-size: 12px; opacity: .8; }
.trust-card .tc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.trust-card a { color: var(--gold-bright); }
.trust-card .tc-codex { background: none; border: 0; color: #cbbf9f; font: inherit; font-size: 12px; text-decoration: underline dotted; cursor: pointer; padding: 0; }

/* legends: model estimates carry a fine diagonal sheen; the faith sub-select sits in the head */
#legend .lg-head .trust { font-size: 12px; }
#legend.lg-estimate .lg-head { background: repeating-linear-gradient(135deg, rgba(224,180,92,.10) 0 3px, transparent 3px 7px); border-radius: 6px; }
#legend .lg-sub { margin-left: 6px; max-width: 150px; background: rgba(0,0,0,.35); color: var(--gold-bright); border: 1px solid rgba(201,164,92,.6); border-radius: 4px; font: inherit; font-size: 12px; padding: 1px 4px; }
.lp-tile .lp-sub { font-size: 11px; opacity: .65; }
.lp-tile .lp-tag { display: block; font-size: 10px; letter-spacing: .03em; color: #d9b56a; opacity: .85; margin-top: 1px; }
.lp-tile.tier-research { opacity: .88; }
.lp-more-note { margin: 10px 4px 2px; font-size: 12px; opacity: .8; }
.lp-more-note .lp-research { background: none; border: 0; padding: 0; color: var(--gold-bright); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---- Codex ------------------------------------------------------------------------------------------------ */
.codex-modal .codex-card { position: relative; width: min(860px, 94vw); height: min(620px, 86vh); display: flex; flex-direction: column; padding: 16px 18px; }
.codex-card h2 { margin: 0 0 8px; font-family: var(--serif); color: var(--gold-bright); font-weight: normal; display: flex; align-items: baseline; gap: 10px; }
.codex-card .cx-count { font-family: system-ui, sans-serif; font-size: 13px; color: #cbbf9f; }
.codex-card .close { position: absolute; top: 12px; right: 12px; }
.cx-tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.cx-tabs [role=tab] { background: transparent; border: 1px solid rgba(201,164,92,.5); color: #e8dcc0; border-radius: 14px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.cx-tabs [role=tab][aria-selected="true"] { background: rgba(201,164,92,.22); color: var(--gold-bright); border-color: var(--gold); }
.cx-q { margin-left: auto; width: 180px; background: rgba(0,0,0,.35); border: 1px solid rgba(201,164,92,.5); border-radius: 4px; color: #f3ead2; padding: 4px 8px; font: inherit; font-size: 13px; }
.cx-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
.cx-list { overflow: auto; border-right: 1px solid rgba(201,164,92,.25); padding-right: 6px; }
.cx-list h4 { margin: 10px 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #cbbf9f; font-weight: normal; }
.cx-list button { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: 0; border-radius: 5px; padding: 5px 8px; color: #e8dcc0; font: inherit; font-size: 14px; cursor: pointer; }
.cx-list button:hover, .cx-list button.on { background: rgba(201,164,92,.16); color: var(--gold-bright); }
.cx-list .cx-new { width: 5px; height: 5px; border-radius: 50%; border: 1px solid rgba(201,164,92,.6); flex: none; }
.cx-entry { overflow: auto; padding-right: 6px; font-size: 15px; line-height: 1.5; }
.cx-entry h3 { margin: 2px 0 8px; font-family: var(--serif); font-size: 24px; font-weight: normal; color: var(--gold-bright); }
.cx-entry .cx-cat { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #cbbf9f; }
.cx-entry .cx-plain { font-size: 16px; }
.cx-entry .cx-met, .cx-entry .cx-src, .cx-entry .cx-foot { font-size: 13px; opacity: .8; }
.cx-entry a { color: var(--gold-bright); }

/* ---- Councils picker (advisor dock) ----------------------------------------------------------------------- */
.adv-tabs .adv-tab-sep { display: inline-block; width: 1px; height: 26px; margin: 0 4px; background: rgba(201,164,92,.45); align-self: center; }
.adv-council-group { margin-bottom: 6px; }
.adv-council-line { margin: -2px 14px 8px; font-size: 13px; opacity: .78; }

/* ---- widths ---------------------------------------------------------------------------------------------- */
@media (max-width: 1500px) and (min-width: 701px) {
  #yields { gap: 10px; }
  .search { min-width: 0; }
}
@media (max-width: 1100px) and (min-width: 701px) {
  #topbar .nav-btn { padding: 4px 8px; }
  #topbar .brand-text { display: none; }
}

/* ---- phone: map first (≥70% of the height), header never clipped ----------------------------------------- */
@media (max-width: 700px) {
  #topbar { overflow: visible !important; gap: 6px !important; padding: 0 6px !important; }
  #topbar::before, #topbar::after { display: none !important; }
  #topbar .brand-text { display: none; }
  #topbar .brand-emblem { margin-right: 0; }
  #topbar .search { flex: 1 1 auto; min-width: 0; width: auto; }
  #topbar #search-input { width: 100%; min-width: 0; }
  #topbar .search-kbd { display: none; }
  #yields, #turn { display: none !important; }
  .tb-buttons { gap: 4px; flex: none; }
  #topbar .nav-btn { flex-direction: column; gap: 0; padding: 2px 6px; min-width: 44px; min-height: 36px; justify-content: center; }
  #topbar .nav-btn .lbl { font-size: 10px; line-height: 12px; font-family: system-ui, sans-serif; }
  #topbar .nav-btn.btn-icon { min-width: 36px; }
  #btn-minimap, #minimap-wrap { display: none !important; }
  .touch-prompt { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); font-size: 13px; }
  .codex-modal .codex-card { width: 100vw; height: 100%; border-radius: 0; padding: 12px; }
  .cx-body { grid-template-columns: 1fr; grid-template-rows: 38% 1fr; }
  .cx-list { border-right: 0; border-bottom: 1px solid rgba(201,164,92,.25); }
  .cx-q { width: 120px; }
  .rv-hint { max-width: calc(100vw - 16px); font-size: 15px; }
  .trust { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  body.rv-lenses #lens-dock { animation: none; }
  .touch-prompt, .rv-hint { transition: opacity .3s; transform: none !important; }
}
body:not(.rv-lenses) #minimap-wrap { display: none !important; }
.rv-hint.side::before { top: 16px; left: auto; right: -6px; border-left: 0; border-bottom: 0; transform: rotate(45deg); }
.yield-tile { position: relative; }
.yield-tile .val .trust { position: absolute; top: 4px; left: 4px; margin: 0; }
@media (max-width: 700px) { #city-panel ~ .rv-hint.side { display: none; } }
body:has(.modal:not([hidden])) .rv-hint { display: none; }
