/* Shared room chrome — slim top bar, pills, pouch, menu (match town) */
:root {
  --rc-brass: #b8893a;
  --rc-ink: #2a1a0c;
  --rc-ink-soft: #5a4028;
  --rc-wood: #6b4226;
  --rc-wood-dark: #3a2410;
  --rc-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.top-hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(40, 24, 10, 0.4), transparent);
  pointer-events: none;
}
.top-hud > * { pointer-events: auto; }

.back-town {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--rc-brass);
  background:
    url("assets/town/icon_training.png") center/0 no-repeat,
    linear-gradient(180deg, #f3e2c0, #d9bf8e);
  color: var(--rc-ink);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--rc-shadow);
  flex-shrink: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none !important;
}
.back-town:hover { filter: brightness(1.06); }
.back-town span { font-size: 1.2rem; }

.menu-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 2px solid var(--rc-brass);
  background: linear-gradient(180deg, #f3e2c0, #d9bf8e);
  color: var(--rc-ink);
  font-size: 1.2rem;
  box-shadow: var(--rc-shadow);
  flex-shrink: 0;
  cursor: pointer;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
  justify-content: flex-end;
  align-items: center;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--rc-brass);
  background: linear-gradient(180deg, #f7ebcf, #e2c992);
  color: var(--rc-ink);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: "Crimson Text", Georgia, serif;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.pill i {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.pill.gems i {
  background-image: url("assets/town/icon_gems.png");
  background-color: #2a9cc8;
  box-shadow: 0 0 6px #5ec8e8;
}
.pill.gold i {
  background-image: url("assets/town/icon_gold.png");
  background-color: #c99620;
}
.pill.coin i {
  background-image: url("assets/town/icon_coin.png");
  background-color: #a87828;
}
.pill.pouch {
  cursor: pointer;
  font-family: inherit;
  border: none;
}
.pill.pouch i {
  border-radius: 4px;
  background: linear-gradient(180deg, #a07040, #6b4226);
}

.pouch-panel {
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 51;
  width: min(300px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(165deg, #f3e2c0, #d9bf8e);
  border: 2px solid var(--rc-brass);
  box-shadow: var(--rc-shadow);
  color: var(--rc-ink);
  font-family: "Crimson Text", Georgia, serif;
}
.pouch-panel[hidden] { display: none !important; }
.pouch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sack {
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(107, 66, 38, 0.12);
  border: 1px solid rgba(107, 66, 38, 0.25);
  text-align: center;
}
.sack span {
  display: block;
  font-size: 0.65rem;
  color: var(--rc-ink-soft);
}
.sack strong {
  font-family: "IM Fell French Canon", Georgia, serif;
  font-size: 1rem;
  color: var(--rc-wood-dark);
}

.menu-fly {
  position: fixed;
  top: 60px;
  left: 12px;
  z-index: 52;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 168px;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(165deg, #f3e2c0, #d4b888);
  border: 2px solid var(--rc-brass);
  box-shadow: var(--rc-shadow);
  font-family: "Crimson Text", Georgia, serif;
}
.menu-fly[hidden] { display: none !important; }
.menu-fly a {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--rc-ink);
  text-decoration: none !important;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.menu-fly a:hover, .menu-fly a.active {
  background: rgba(107, 66, 38, 0.15);
}
.menu-fly a.active { color: var(--rc-wood); font-weight: 700; }

/* Cost chips with resource icons */
.cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cost i.res {
  width: 16px; height: 16px;
  border-radius: 50%;
  display: inline-block;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.cost i.res.gems { background-image: url("assets/town/icon_gems.png"); background-color: #2a9cc8; }
.cost i.res.gold { background-image: url("assets/town/icon_gold.png"); background-color: #c99620; }
.cost i.res.coin { background-image: url("assets/town/icon_coin.png"); background-color: #a87828; }

/* Toast — top, short-lived */
.toast, p.toast {
  position: fixed !important;
  left: 50% !important;
  top: max(72px, calc(env(safe-area-inset-top) + 64px)) !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  z-index: 80 !important;
  max-width: min(360px, 90vw);
  padding: 10px 16px;
  background: linear-gradient(180deg, #f3e2c0, #d9bf8e);
  border: 2px solid var(--rc-brass);
  border-radius: 10px;
  color: var(--rc-ink);
  font-family: "Crimson Text", Georgia, serif;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: var(--rc-shadow);
  pointer-events: none;
}
.toast[hidden] { display: none !important; }
.toast.err { border-color: #a04850; color: #6a1818; }

/* Room pages pad content under fixed hud */
body.room-page .app {
  padding-top: 64px;
  max-width: none;
}
body.room-page .legacy-topbar,
body.room-page .topbar,
body.room-page header.topbar { display: none !important; }

/* Light scene overlays — keep art readable */
body.room-page .yard-vignet,
body.room-page .college-vignet,
body.room-page .gate-vignet,
body.room-page .tent-vignet {
  background:
    linear-gradient(180deg, rgba(20, 10, 4, 0.12) 0%, transparent 18%, transparent 70%, rgba(10, 5, 2, 0.35) 100%) !important;
  opacity: 0.85;
}
body.room-page .yard-bg,
body.room-page .college-bg,
body.room-page .gate-bg {
  filter: saturate(1.05) contrast(1.02) brightness(1.08) !important;
}

/* In-world hanging signs (tabs) */
.sign-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 8px 12px 12px;
  position: relative;
  z-index: 3;
}
.sign-tab {
  position: relative;
  min-height: 48px;
  padding: 10px 16px 14px;
  border: none;
  cursor: pointer;
  font-family: "IM Fell French Canon", "Crimson Text", Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #2a1a0c;
  background:
    linear-gradient(180deg, #e8d4a8, #c8a878);
  clip-path: polygon(6% 0, 94% 0, 100% 12%, 100% 100%, 0 100%, 0 12%);
  box-shadow: 0 4px 0 #5a3a1c, 0 8px 16px rgba(0,0,0,0.35);
  border-radius: 2px;
}
.sign-tab::before {
  content: "";
  position: absolute;
  top: -6px; left: 50%;
  width: 8px; height: 10px;
  transform: translateX(-50%);
  background: #8a6238;
  border-radius: 2px;
  box-shadow: 0 -2px 0 #5a3a1c;
}
.sign-tab.active {
  background: linear-gradient(180deg, #f0e0b8, #d4a860);
  color: #1a1008;
  box-shadow: 0 4px 0 #8a6238, 0 0 16px rgba(255, 180, 60, 0.35);
}
.sign-tab:focus-visible { outline: 2px solid #f0d78c; outline-offset: 2px; }

.top-hud .menu-btn { margin-left: 2px; }
.pad-ring .empty-glyph { font-size: 1.1rem; content: none; }

.toast:empty, .toast[hidden] { display: none !important; }
