/* Menüs im Basislager im Sprechblasen-Stil (siehe base-ui.js) */
.bu-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 8px 10px; margin: 2px 0 8px; background: rgba(255, 252, 240, 0.98); border: 3px solid var(--cs-ink, #2b1a0e); border-radius: 12px; box-shadow: 3px 3px 0 var(--cs-ink, #2b1a0e); color: var(--cs-ink, #2b1a0e); position: relative; }
.bu-head::after { content: ""; position: absolute; left: 26px; bottom: -11px; width: 14px; height: 14px; background: rgba(255, 252, 240, 0.98); border-right: 3px solid var(--cs-ink, #2b1a0e); border-bottom: 3px solid var(--cs-ink, #2b1a0e); transform: rotate(45deg); }
.bu-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bu-av { position: relative; display: block; width: 40px; height: 52px; overflow: hidden; flex: none; background: #efe0bd; border: 2px solid var(--cs-ink, #2b1a0e); border-radius: 8px; }
.bu-av .pixel-avatar { position: absolute; left: -7px; top: -2px; transform: scale(0.78); transform-origin: top left; animation: none; }
.bu-av-i { display: grid; place-items: center; font-size: 1.3rem; }
.bu-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.bu-id b { font-size: 0.95rem; }
.bu-id small, .bu-mid small, .bu-htxt { opacity: 0.72; font-weight: 700; font-size: 0.7rem; }
.bu-mid { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bu-stage { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 800; }
.bu-pips { display: inline-flex; gap: 3px; }
.bu-pip { display: block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--cs-ink, #2b1a0e); background: #fff; }
.bu-pip.on { background: #f2c94c; }
.bu-bar { height: 7px; border: 2px solid var(--cs-ink, #2b1a0e); border-radius: 5px; background: #fff; overflow: hidden; max-width: 220px; }
.bu-bar i { display: block; height: 100%; background: #6cc070; }
.bu-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.bu-hours { font-size: 0.72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; border: 2px solid var(--cs-ink, #2b1a0e); background: #fff; white-space: nowrap; }
.bu-hours.open { background: #c8f0c4; }
.bu-hours.closed { background: #ffd0c8; }
.bu-helps { display: inline-flex; }
.bu-help { appearance: none; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid var(--cs-ink, #2b1a0e); background: #fff6d6; color: var(--cs-ink, #2b1a0e); font: 800 0.85rem/1 inherit; cursor: pointer; box-shadow: 1px 1px 0 var(--cs-ink, #2b1a0e); }
.bu-help:hover, .bu-help:focus-visible { background: #f2c94c; }
.bu-lock { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; border: 2px dashed #8a7a60; background: #f1ead8; color: #5a4a30; font-size: 0.72rem; font-weight: 800; }
.bu-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; border: 2px solid var(--cs-ink, #2b1a0e); background: #fff; font-size: 0.74rem; font-weight: 800; }
.bu-chip.ok { background: #c8f0c4; } .bu-chip.warn { background: #ffe9a8; } .bu-chip.bad { background: #ffd0c8; }
.bu-note { padding: 6px 10px; margin: 4px 0 8px; background: #fff6d6; border: 2px dashed #b8860b; border-radius: 9px; font-size: 0.78rem; font-weight: 700; line-height: 1.35; }
.bu-pop { position: fixed; z-index: 9600; padding: 10px 12px 10px; background: rgba(255, 252, 240, 0.99); border: 3px solid var(--cs-ink, #2b1a0e); border-radius: 12px; box-shadow: 4px 4px 0 var(--cs-ink, #2b1a0e); color: var(--cs-ink, #2b1a0e); font: 700 0.82rem/1.4 inherit; }
.bu-pop-t { padding-right: 18px; }
.bu-pop-x { position: absolute; right: 6px; top: 4px; appearance: none; border: 0; background: none; font: 800 0.9rem/1 inherit; cursor: pointer; color: var(--cs-ink, #2b1a0e); }
.bu-more { display: inline-block; margin-top: 6px; font-size: 0.74rem; font-weight: 800; color: #8a5a00; text-decoration: underline; }
.bu-tail { position: absolute; width: 14px; height: 14px; background: rgba(255, 252, 240, 0.99); transform: rotate(45deg); }
.bu-tail.up { top: -10px; border-left: 3px solid var(--cs-ink, #2b1a0e); border-top: 3px solid var(--cs-ink, #2b1a0e); }
.bu-tail.down { bottom: -10px; border-right: 3px solid var(--cs-ink, #2b1a0e); border-bottom: 3px solid var(--cs-ink, #2b1a0e); }
.bu-note.closed { background: #ffe3dc; border-color: #c4553a; }
.base-menu-sect .bu-help { margin-left: 6px; vertical-align: middle; }
@media (max-width: 520px) { .bu-head { grid-template-columns: auto minmax(0, 1fr); } .bu-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; } }

/* Karten: ruhiger, ohne schwere Rahmen; der Aktions-Knopf trägt den Preis und zeigt mit der Farbe, ob man ihn sich leisten kann */
.base-panel .base-card { border-width: 2px; border-radius: 12px; box-shadow: none; background: rgba(255, 252, 240, 0.98); padding: 8px 10px; gap: 10px; align-items: center; }
.base-panel .base-card-icon { font-size: 1.5rem; }
.base-panel .base-card-main p { margin: 2px 0 0; font-size: 0.78rem; line-height: 1.35; opacity: 0.85; }
.base-panel .base-card-main strong { font-size: 0.95rem; }
.base-panel .base-class { margin-left: 4px; vertical-align: 1px; }
.bu-act { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 76px; padding: 5px 12px; border-radius: 12px; line-height: 1.15; }
.bu-act .l { font-weight: 900; }
.bu-act .c { display: inline-flex; gap: 6px; font-size: 0.7rem; font-weight: 800; opacity: 0.95; }
.bu-act .c i { font-style: normal; white-space: nowrap; }
.base-btn.bu-act.ok { background: #3f9a55; color: #fff; }
.base-btn.bu-act.short { background: #d9553f; color: #fff; box-shadow: 2px 2px 0 var(--cs-ink, #2b1a0e); cursor: not-allowed; }
.base-btn.bu-act.short .c i.s { text-decoration: underline wavy rgba(255, 255, 255, 0.85); text-underline-offset: 2px; }
.base-btn.bu-act.lock { background: #c9c3b3; color: #6b6558; box-shadow: none; }
.base-btn.bu-act.max { background: #e8e1cf; color: #6b6558; box-shadow: none; }

/* Medaillenshop und Schmiede: gleiche Preis-Knöpfe */
.ms-buy button.bu-act { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; min-width: 84px; padding: 5px 12px; border-radius: 12px; line-height: 1.15; border: 2px solid var(--cs-ink, #2b1a0e); font-weight: 900; cursor: pointer; }
.ms-buy button.bu-act.ok { background: #3f9a55; color: #fff; }
.ms-buy button.bu-act.short { background: #d9553f; color: #fff; cursor: not-allowed; opacity: 1; }
.ms-buy button.bu-act.lock { background: #c9c3b3; color: #6b6558; cursor: not-allowed; }
.ms-buy button.bu-act.max { background: #e8e1cf; color: #6b6558; cursor: default; }
.ms-buy button.bu-act.short .c i { text-decoration: none; }

/* Wo oberhalb schon die Sprechblase der Zuständigen steht (Shop, Schmiede), zeigt der Kopf nur Stufe und Zeiten */
.ms-keeper + .bu-head { grid-template-columns: minmax(0, 1fr) auto; }
.ms-keeper + .bu-head .bu-who, .ms-keeper + .bu-head::after { display: none; }

/* „Hier lohnt sich etwas“: kleiner Punkt an Gebäuden, Ruinen und Häusern (base-hints.js) */
.base-obj.bu-new::after { content: "!"; position: absolute; right: 6%; top: -4px; z-index: 30; width: 22px; height: 22px; border-radius: 50%; background: #ff9a1e; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--cs-ink, #2b1a0e); color: #fff; font: 900 0.85rem/18px system-ui; text-align: center; animation: buPulse 1.3s ease-in-out infinite; pointer-events: none; }
@keyframes buPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .base-obj.bu-new::after { animation: none; } }
#pxMini .mm-n { color: #ffb347; margin-left: 4px; }

.bu-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.bu-row .bu-help { margin-left: auto; }

.bu-chip, .bu-lock, .bu-note, .bu-head { color: var(--cs-ink, #2b1a0e); }
.base-panel .base-menu-sect { color: var(--cs-ink, #2b1a0e); margin-top: 10px; }
.base-panel .base-card-main > p.bu-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.base-panel .base-card-main > p.bu-clamp::after { content: " …"; }

details.base-combos { margin: 4px 0 8px; padding: 6px 10px; background: rgba(255, 252, 240, 0.98); border: 2px solid var(--cs-ink, #2b1a0e); border-radius: 12px; font-size: 0.8rem; font-weight: 700; color: var(--cs-ink, #2b1a0e); }
details.base-combos > summary { cursor: pointer; }
details.base-combos[open] > summary { margin-bottom: 6px; }

/* Bewohner-Menü: Abschnitte zum Aufklappen statt einer langen Liste */
.bu-sec { margin: 6px 0; background: rgba(255, 252, 240, 0.98); border: 2px solid var(--cs-ink, #2b1a0e); border-radius: 12px; color: var(--cs-ink, #2b1a0e); }
.bu-sec > summary { display: flex; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; font-weight: 900; font-size: 0.85rem; list-style: none; }
.bu-sec > summary::-webkit-details-marker { display: none; }
.bu-sec > summary::after { content: "▾"; margin-left: auto; opacity: 0.6; transition: transform 0.15s; }
.bu-sec[open] > summary::after { transform: rotate(180deg); }
.bu-sec > summary small { font-weight: 700; opacity: 0.7; }
.bu-sec > summary .bu-help { margin-left: 4px; }
.bu-sec-body { padding: 2px 10px 10px; }
.bu-trustrow { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.bu-trustrow .base-trust { flex: 1; }
.bu-btns { display: flex; flex-direction: column; gap: 4px; }

/* Meta-Zeile in der Sprechblase von Shop und Schmiede: Stufe, Öffnungszeiten, Hilfe */
.bu-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 0.74rem; font-weight: 800; }
.bu-meta .bu-hours { font-size: 0.7rem; }
.bu-meta .bu-htxt { opacity: 0.7; }
.bu-meta .bu-helps { margin-left: auto; }

/* Auf dem Handy kürzte eine ältere Regel jede Kartenbeschreibung auf zwei Zeilen — so ging bei Ausbauten die Vorschau „alt → neu“ verloren.
   Jetzt kürzt nur noch .bu-clamp (lange Texte ohne Vorschau); Antippen klappt auf. */
.base-panel .base-card-main > p:not(.bu-clamp) { display: block; -webkit-line-clamp: unset; overflow: visible; }
.bu-side .bu-helps { margin-left: auto; }

/* Wie bei den Panels: Menü-Knopf, Hinweis-Knopf, Ressourcenleiste und Minimap treten zurück, solange das Bewohner-Menü offen ist (sonst liegen sie auf dem Namen) */
body.in-base:has(#baseNpcMenu:not([hidden])) #mobileMenuBtn,
body.in-base:has(#baseNpcMenu:not([hidden])) #noticeBtn,
body.in-base:has(#baseNpcMenu:not([hidden])) #baseResBar,
body.in-base:has(#baseNpcMenu:not([hidden])) #baseBuildBtn,
body.in-base:has(#baseNpcMenu:not([hidden])) #pxMini,
body.in-base:has(#baseNpcMenu:not([hidden])) #pxMiniShow { visibility: hidden; pointer-events: none; }

/* Kopfzeile der Basis-Reiter (Shop, Schmiede, Gobbo …) auf dem Handy: umbrechen statt über den Rand laufen */
@media (max-width: 520px) {
  .home-wrap .home-header { flex-wrap: wrap; row-gap: 6px; }
  .home-wrap .home-header h1 { flex: 1 1 auto; min-width: 0; }
  .home-wrap .home-header .home-back-btn { white-space: nowrap; }
  .home-wrap .home-header .base-ambience-setting { margin-left: 0; }
  .home-wrap .home-header .base-options-btn { margin-left: auto; padding: 5px 9px; font-size: 0.78rem; }
}

/* Handy: Reiter umbrechen, und Knöpfe mit vielen Preisposten bekommen eine eigene Zeile unter dem Text */
@media (max-width: 520px) {
  .base-panel .base-tabs { flex-wrap: wrap; }
  .base-panel .base-card { flex-wrap: wrap; }
  .base-panel .base-card > .base-card-main { flex: 1 1 150px; min-width: 0; }
  .base-panel .base-card > button.bu-act.wide { flex: 1 1 100%; flex-direction: row; justify-content: space-between; align-items: center; padding: 6px 14px; }
  .base-panel .base-card > button.bu-act.wide .c { font-size: 0.74rem; }
}

/* Marken, die selbst eine Hilfe öffnen (Öffnungszeiten, Baupläne) */
button.bu-hours, button.bu-chip-h { appearance: none; font-family: inherit; cursor: pointer; color: var(--cs-ink, #2b1a0e); }
button.bu-chip-h b { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--cs-ink, #2b1a0e); background: #fff6d6; font-size: 0.65rem; }
button.bu-hours:hover, button.bu-chip-h:hover, button.bu-hours:focus-visible, button.bu-chip-h:focus-visible { filter: brightness(0.95); outline: 2px solid #f2c94c; }
.bu-trustrow > .base-btn { flex: 1; }
