/*
==============================================================
REVAMED MANSION — UI SCREEN SYSTEM V1
Visual authority: moonlit mansion + brass/gold RM identity.
This layer styles real game systems; it does not replace gameplay.
==============================================================
*/

:root {
  --rm-gold: #d5a64a;
  --rm-gold-bright: #f3d48b;
  --rm-ivory: #f4ecdc;
  --rm-sage: #cbd5c5;
  --rm-ink: #05070b;
  --rm-panel: rgba(8, 10, 15, .94);
  --rm-panel-soft: rgba(12, 15, 22, .88);
  --rm-line: rgba(213, 166, 74, .48);
  --rm-line-strong: rgba(243, 212, 139, .86);
  --rm-danger: #c86755;
  --rm-shadow: 0 24px 80px rgba(0,0,0,.64);
  --rm-radius: 12px;
  --rm-control: 54px;

  /* IMBLABS Gothic Victorian Palette */
  --imblabs-obsidian-void: #050508;
  --imblabs-abyssal-slate: #1A1C23;
  --imblabs-ember-glow: #C98A53;
  --imblabs-moonlit-cyan: #5B788A;
  --imblabs-aged-bone: #D1C7B7;
  --imblabs-crimson-rot: #7A110A;
}

/* ---------- TITLE / HOME ---------- */
#title-screen.title-screen {
  min-height: 100svh;
  display: grid;
  align-items: center;
  justify-items: start;
  padding: clamp(20px, 4vw, 64px);
  background:
    linear-gradient(90deg, rgba(2,4,8,.98) 0%, rgba(3,6,10,.92) 31%, rgba(3,6,11,.42) 56%, rgba(2,4,8,.12) 100%),
    #05070b url("../assets/image.jpg") 72% center / cover no-repeat, url("../assets/title-mansion.svg") 72% center / cover no-repeat !important;
  overflow: hidden;
}

#title-screen::after {
  content: "";
  position: absolute;
  inset: 14px;
  pointer-events: none;
  border: 1px solid rgba(213,166,74,.42);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.55);
}

#title-screen .title-card {
  width: min(520px, 94vw);
  margin: 0 0 0 clamp(0px, 3vw, 44px);
  padding: clamp(24px, 3.8vw, 50px);
  border: 0;
  background: linear-gradient(90deg, rgba(4,6,9,.96), rgba(6,8,12,.82) 74%, transparent);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 2;
}


#title-screen .eyebrow,
.rm-title-kicker {
  color: var(--rm-gold-bright) !important;
  font: 700 .72rem/1.3 system-ui, sans-serif;
  letter-spacing: .2em;
  text-transform: uppercase;
}

/*
 * font-size and color are deliberately left to release-visuals.css's
 * .title-card h1 rule, which already owns the metallic gradient text
 * treatment (via -webkit-text-fill-color) and a font-size clamp tuned to
 * the .title-card's actual rendered width. This ID-selector rule used to
 * redeclare its own, larger clamp, which won on specificity over that
 * tuned one and overflowed the card at wide desktop viewports - "REVAMED"
 * rendered past its own box, outside the gradient's paint area, so the
 * overflowing letters were invisible (transparent fill, nothing painted).
 */
#title-screen h1 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: .82;
  letter-spacing: .035em;
  text-shadow: 0 4px 28px rgba(0,0,0,.78), 0 0 24px rgba(213,166,74,.08);
}

#title-screen h1 span {
  display: block;
  margin-top: .22em;
  font-size: .66em;
  letter-spacing: .17em;
}

#title-screen .tagline {
  margin: 28px 0 12px;
  color: var(--rm-gold-bright) !important;
  font-family: Georgia, serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: .82rem;
}

.rm-title-menu,
.menu-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(390px, 100%);
  margin-top: 18vh;
}

.menu-btn {
  background: transparent !important;
  border: none !important;
  color: rgba(180, 175, 165, 0.8) !important;
  font-size: 22px !important;
  font-family: 'Cinzel', serif !important;
  text-transform: uppercase !important;
  letter-spacing: 4px !important;
  cursor: pointer !important;
  transition: color 0.3s ease, text-shadow 0.3s ease !important;
  padding: 8px 20px !important;
  box-shadow: none !important;
  text-align: center !important;
  min-height: unset !important;
  width: auto !important;
}

.menu-btn:hover,
.menu-btn.active,
#title-screen .menu-btn:hover,
#title-screen .menu-btn.active {
  color: #c98a53 !important;
  text-shadow: 0 0 15px rgba(201, 138, 83, 0.6) !important;
}

#title-screen button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

#title-screen .access-note,
#title-screen .baseline-mark,
#title-screen #public-release-marker {
  color: #9f9b92;
  font-size: .72rem;
}

/* ---------- GAMEPLAY HUD ---------- */
#game-screen {
  min-height: 100svh;
  background: #05070b;
}

#game-screen .game-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(180px,1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(12px, 2vw, 24px);
  background: linear-gradient(180deg, rgba(5,7,10,.98), rgba(7,9,13,.91));
  border-bottom: 1px solid var(--rm-line);
  box-shadow: 0 10px 30px rgba(0,0,0,.32);
}

.rm-menu-button,
.rm-header-control,
.game-header .small-button,
.game-header .help-toggle-btn {
  min-height: 46px !important;
  border: 1px solid var(--rm-line) !important;
  border-radius: 6px !important;
  background: rgba(13,15,20,.94) !important;
  color: var(--rm-ivory) !important;
  font-weight: 700 !important;
  padding: 0 14px !important;
  touch-action: manipulation;
}

.rm-menu-button {
  width: 48px;
  padding: 0 !important;
  font-size: 1.35rem;
}

.game-header .room-kicker {
  color: var(--rm-gold-bright);
  letter-spacing: .15em;
  font-size: .68rem;
}

.game-header #room-title {
  margin: 2px 0 0;
  color: var(--rm-ivory);
  font: 700 clamp(1.2rem, 2vw, 1.65rem)/1.05 Georgia, serif;
}

.game-header .header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.rm-header-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--rm-gold);
  color: #08090b;
  font: 900 .7rem system-ui;
}

#clear-instruction-strip,
.clear-instruction-strip,
#hover-label,
.hover-label,
.backbone-feedback {
  margin: 0 !important;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 16px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(213,166,74,.25) !important;
  background: rgba(6,8,11,.96) !important;
  color: #d8d0c2 !important;
  font-size: .86rem;
}

.scene {
  /*
   * No min-height here: styles.css's width: min(1280px, 100%) +
   * aspect-ratio: 16/9 already sizes .scene sensibly at every width, and
   * the short-viewport max-height rule (styles.css, "SHORT VIEWPORTS")
   * caps it on wide-but-short viewports like 1194x834 iPad. A
   * min-height here used to win that conflict (min-height beats
   * max-height when they disagree) and pushed the verb bar below the
   * fold before any interaction even happened.
   */
  border-left: 1px solid rgba(213,166,74,.24);
  border-right: 1px solid rgba(213,166,74,.24);
  box-shadow: inset 0 0 120px rgba(0,0,0,.58);
}

.hotspot-word {
  pointer-events: none;
  border: 1px solid rgba(243,212,139,.55) !important;
  border-radius: 4px !important;
  background: rgba(5,7,10,.9) !important;
  color: #f7ecd2 !important;
  padding: 5px 8px !important;
  font: 700 .72rem/1 system-ui, sans-serif !important;
  letter-spacing: .02em;
  box-shadow: 0 8px 18px rgba(0,0,0,.32);
}

.hotspot:focus-visible,
.hotspot:hover {
  outline: 2px solid var(--rm-gold-bright) !important;
  outline-offset: -2px;
  background: rgba(213,166,74,.08) !important;
}

/* ---------- ACTION BAR ---------- */
.command-console {
  display: grid;
  grid-template-columns: minmax(0,1.5fr) minmax(240px,.75fr) minmax(220px,.75fr);
  gap: 10px;
  padding: 10px;
  background: #07090d;
  border-top: 1px solid var(--rm-line);
}

.verb-bar {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: stretch;
}

.verb-label { display: none !important; }

.verb {
  min-height: 58px !important;
  border: 1px solid var(--rm-line) !important;
  border-radius: 5px !important;
  background: linear-gradient(180deg, #14161b, #090a0e) !important;
  color: var(--rm-ivory) !important;
  font: 700 .86rem/1.2 Georgia, serif !important;
  letter-spacing: .04em;
  touch-action: manipulation;
}

.verb span { display: none !important; }

.verb.active {
  border-color: var(--rm-gold-bright) !important;
  color: #fff0bd !important;
  box-shadow: inset 0 0 22px rgba(213,166,74,.09), 0 0 18px rgba(213,166,74,.09);
}

.status-panel,
.inventory-panel {
  min-height: 58px;
  padding: 10px 12px !important;
  border: 1px solid rgba(213,166,74,.28) !important;
  border-radius: 5px;
  background: rgba(10,12,16,.9) !important;
}

.status-heading,
.inventory-heading {
  color: var(--rm-gold-bright) !important;
  letter-spacing: .12em;
  font-size: .62rem !important;
}

/* ---------- UNIFIED MODALS / SCREENS ---------- */
#hint-modal,
#onboarding-modal,
#rm-pause-screen,
#rm-inventory-screen,
#rm-completion-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.76);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

#hint-modal[hidden],
#onboarding-modal[hidden],
#rm-pause-screen[hidden],
#rm-inventory-screen[hidden],
#rm-completion-screen[hidden] { display: none !important; }

.hint-card,
.onboarding-card,
#settings-panel,
#clue-journal-panel,
.rm-screen-card {
  width: min(720px, calc(100vw - 28px));
  max-height: min(82svh, 820px);
  overflow: auto;
  border: 1px solid var(--rm-line-strong) !important;
  border-radius: var(--rm-radius) !important;
  background:
    linear-gradient(180deg, rgba(15,17,22,.98), rgba(6,8,11,.98)) !important;
  color: var(--rm-ivory) !important;
  box-shadow: var(--rm-shadow), inset 0 1px rgba(255,255,255,.05) !important;
}

#settings-panel,
#clue-journal-panel {
  position: fixed !important;
  z-index: 5100 !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
}

#settings-panel[hidden],
#clue-journal-panel[hidden] { display: none !important; }

.clue-journal-header,
.hint-card-header,
.onboarding-header,
.rm-screen-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px !important;
  border-bottom: 1px solid var(--rm-line) !important;
  background: rgba(7,9,13,.98) !important;
}

.clue-journal-title,
#hint-title,
#onboarding-title,
.rm-screen-title {
  margin: 0;
  color: var(--rm-gold-bright) !important;
  font: 700 1.35rem/1.1 Georgia, serif !important;
}

#hint-close,
#hint-reveal,
#onboarding-close-btn,
#clue-journal-close,
#settings-close,
.rm-screen-close,
.rm-screen-action {
  min-height: 46px;
  border: 1px solid var(--rm-line) !important;
  border-radius: 5px !important;
  background: #111319 !important;
  color: var(--rm-ivory) !important;
  padding: 0 14px;
  font-weight: 700;
}

.hint-item,
.clue-item,
.rm-inventory-item,
.rm-menu-row {
  margin: 10px 0;
  padding: 14px;
  border: 1px solid rgba(213,166,74,.28) !important;
  border-radius: 6px;
  background: rgba(14,16,20,.78) !important;
}

.hint-item strong,
.clue-badge,
.rm-item-name { color: var(--rm-gold-bright) !important; }

/* ---------- PAUSE / MENU ---------- */
.rm-screen-card {
  padding-bottom: 18px;
  border: 1px solid rgba(213, 166, 74, 0.42) !important;
  background: rgba(8, 10, 15, 0.92) !important;
  backdrop-filter: blur(40px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(140%) !important;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.85), inset 0 0 24px rgba(213, 166, 74, 0.08) !important;
  border-radius: 8px;
}
.rm-screen-body { padding: 18px 20px; }
.rm-menu-grid { display: grid; gap: 10px; }
.rm-menu-row {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--rm-ivory);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease !important;
}
.rm-menu-row:hover,
.rm-menu-row:focus-visible {
  border-color: rgba(240, 193, 92, 0.75) !important;
  background: rgba(213, 166, 74, 0.14) !important;
  transform: translateX(4px);
  box-shadow: inset 0 0 12px rgba(240, 193, 92, 0.15), 0 4px 16px rgba(0, 0, 0, 0.4);
}
.rm-menu-row strong { color: var(--rm-gold-bright); }
.rm-save-ok { color: #a8d5aa; }

/* ---------- INVENTORY SCREEN ---------- */
.rm-inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.rm-inventory-item {
  min-height: 104px;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}
.rm-inventory-item[aria-pressed="true"] {
  border-color: var(--rm-gold-bright) !important;
  box-shadow: inset 0 0 22px rgba(213,166,74,.12);
}
.rm-empty-state { color: #aaa69d; font-style: italic; }

/* ---------- SETTINGS ---------- */
.settings-group { margin: 0 0 22px !important; }
.settings-label { color: var(--rm-ivory) !important; }
.settings-slider { accent-color: var(--rm-gold); }
.settings-toggle input { accent-color: var(--rm-gold); }
#settings-reset-save { border-color: rgba(200,103,85,.7) !important; color: #f0b0a4 !important; }

/* ---------- ACT I COMPLETE ---------- */
#rm-completion-screen .rm-screen-card {
  width: min(620px, calc(100vw - 28px));
  text-align: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(213,166,74,.12), transparent 40%),
    linear-gradient(180deg, #111319, #06070a) !important;
}
.rm-completion-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border: 1px solid var(--rm-line-strong);
  border-radius: 50%;
  color: var(--rm-gold-bright);
  font-size: 2rem;
}
.rm-completion-copy { color: #c9c2b5; line-height: 1.65; }
.rm-completion-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  #title-screen.title-screen {
    align-items: end;
    background-position: 66% center !important;
    padding: 14px;
  }
  #title-screen.title-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(3,5,8,.98) 0%, rgba(3,5,8,.9) 55%, rgba(3,5,8,.2) 100%);
    pointer-events: none;
  }
  #title-screen .title-card {
    width: 100%;
    max-height: calc(100svh - 28px);
    overflow-y: auto;
    margin: 0;
    padding: 22px;
    background: linear-gradient(180deg, rgba(5,7,10,.78), rgba(5,7,10,.98));
  }
  #game-screen .game-header {
    grid-template-columns: auto 1fr;
    min-height: 68px;
  }
  .game-header .header-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    width: 100%;
  }
  .game-header .header-actions > * { min-width: 0; font-size: .75rem !important; padding: 0 7px !important; }

  .scene { min-height: 42svh; }

  .command-console {
    grid-template-columns: 1fr;
    position: relative;
  }
  .verb-bar { grid-template-columns: 1fr 1fr; }
  .verb { min-height: 54px !important; }
  .status-panel { order: -1; }
  .inventory-panel { display: none !important; }
}

@media (max-width: 520px) {
  #title-screen::after { inset: 7px; }
  #title-screen .title-card { padding: 18px 16px 20px; }
  .rm-title-menu button,
  #title-screen .primary-button,
  #title-screen .secondary-button,
  #title-screen .help-toggle-btn,
  #title-screen #title-settings-toggle,
  #title-screen #install-app { min-height: 52px; }

  .game-header .header-actions { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .scene { min-height: 38svh; }
  .hotspot-word { font-size: .66rem !important; padding: 4px 6px !important; }
  .rm-completion-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  #title-screen button, .verb, .hotspot { transition: none !important; }
}
