/* Survival Builders – Oberfläche (Besitzer: UI). Hochformat-first, Safe-Areas, 44-px-Ziele, keine Bilddateien.
   Farben nach Vertrag §9 + Nachtrag (V1-Messung): Fläche #F7F2EA/#F0ECEB, Akzent #524FFE. */
:root {
  --card: #F7F2EA; --card2: #F0ECEB; --card3: #E8E2D8; --ink: #2B2A33; --ink2: #6B6878; --ink3: #9A97A6;
  --primary: #524FFE; --primary2: #3F3CD6; --danger: #E5484D; --success: #3FAE5A; --gold: #F2B134; --warn: #E8862E;
  --water: #97DFD4; --sea: #2F7FD0; --shadow: 0 6px 18px rgba(30, 20, 60, .18), 0 1px 2px rgba(30, 20, 60, .12);
  --shadow-soft: 0 2px 8px rgba(30, 20, 60, .12); --r: 18px; --r-s: 12px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --hud-top-h: 112px; --bar-h: 84px; --bg: #F7F2EA;
}
#ui, #ui * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
#ui { font: 15px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); touch-action: manipulation; overflow: hidden; }
#ui button { font: inherit; color: inherit; }
#ui .layer { position: absolute; inset: 0; pointer-events: none; }
#ui .layer > * { pointer-events: auto; }
#ui .hidden { display: none !important; }
#ui svg.ic { display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#ui svg.ic .a { fill: var(--ic2, #D9D2C5); }
#ui .ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
#ui b, #ui strong { font-weight: 700; }
#ui ::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- Buttons ---------- */
#ui .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 14px;
  background: var(--card3); color: var(--ink); font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08); user-select: none; -webkit-user-select: none; transition: transform .08s, filter .12s, background .15s; }
#ui .btn:active { transform: scale(.96); filter: brightness(.95); }
#ui .btn:disabled { opacity: .5; cursor: default; filter: grayscale(.4); }
#ui .btn-primary { background: var(--primary); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18), 0 2px 6px rgba(82, 79, 254, .35); }
#ui .btn-danger { background: var(--danger); color: #fff; }
#ui .btn-success { background: var(--success); color: #fff; }
#ui .btn-warn { background: var(--warn); color: #fff; }
#ui .btn-ghost { background: transparent; box-shadow: none; color: var(--ink2); }
#ui .btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
#ui .btn-big { min-height: 52px; font-size: 17px; border-radius: 16px; }
#ui .btn-round { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
#ui .btn-round.btn-small { width: 36px; height: 36px; min-height: 36px; }
#ui .btn-block { width: 100%; }
#ui .btn .btn-label:empty { display: none; }
#ui .row { display: flex; gap: 8px; align-items: center; }
#ui .row.wrap { flex-wrap: wrap; }
#ui .grow { flex: 1 1 auto; min-width: 0; }
#ui .muted { color: var(--ink2); }
#ui .small { font-size: 12px; }
#ui .danger { color: var(--danger); }
#ui .success { color: var(--success); }
#ui .warn { color: var(--warn); }
#ui .center { text-align: center; }

/* ---------- Karten / Chips / Kosten / Balken ---------- */
#ui .card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; }
#ui .chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--card3); font-size: 12px; font-weight: 600; }
#ui .cost-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
#ui .cost { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 14px; color: var(--ink); }
#ui .cost small { font-weight: 500; color: var(--ink3); font-size: 11px; }
#ui .cost.nok { color: var(--danger); }
#ui .cost.nok small { color: var(--danger); opacity: .8; }
#ui .cost-free { font-size: 13px; color: var(--success); font-weight: 700; }
#ui .bar { position: relative; height: 14px; border-radius: 999px; background: var(--card3); overflow: hidden; }
#ui .bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--primary); border-radius: 999px; transition: width .25s; }
#ui .bar.success .bar-fill { background: var(--success); }
#ui .bar.gold .bar-fill { background: var(--gold); }
#ui .bar.danger .bar-fill { background: var(--danger); }
#ui .bar.water .bar-fill { background: #3FA7E0; }
#ui .bar.thin { height: 8px; }
#ui .bar.tall { height: 22px; }
#ui .bar-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--ink); text-shadow: 0 0 2px rgba(255, 255, 255, .8); }
#ui .bar-label:empty { display: none; }
#ui .ring circle { fill: none; }
#ui .ring .ring-bg { stroke: rgba(43, 42, 51, .12); }
#ui .ring .ring-fg { stroke: var(--gold); transition: stroke-dashoffset .3s linear; }
#ui .ring-wrap { display: inline-flex; line-height: 0; }
#ui .toggle { position: relative; width: 52px; height: 32px; border-radius: 999px; border: 0; background: var(--card3); padding: 0; cursor: pointer; transition: background .15s; flex: none; }
#ui .toggle.on { background: var(--success); }
#ui .toggle-knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-soft); transition: left .15s; }
#ui .toggle.on .toggle-knob { left: 23px; }
#ui .tabs { display: flex; gap: 4px; padding: 4px; background: var(--card3); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
#ui .tab { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; padding: 0 8px; border: 0; border-radius: 11px; background: transparent; font-weight: 700; font-size: 13px; color: var(--ink2); cursor: pointer; white-space: nowrap; position: relative; }
#ui .tabs.stacked { scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
#ui .tabs.stacked .tab { flex: 1 0 auto; min-width: 62px; flex-direction: column; gap: 1px; padding: 4px 5px; font-size: 11px; min-height: 48px; scroll-snap-align: start; }
#ui .tabs.stacked .tab span:last-child { overflow: visible; max-width: none; }
#ui .tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-soft); }
#ui .tab .badge { position: absolute; top: 2px; right: 4px; }
#ui .select { min-height: 40px; padding: 0 10px; border-radius: 11px; border: 2px solid var(--card3); background: #fff; font: inherit; font-weight: 600; color: var(--ink); max-width: 100%; }
#ui input[type=range] { width: 100%; accent-color: var(--primary); height: 32px; }
#ui textarea, #ui input[type=text] { width: 100%; font: 13px/1.4 ui-monospace, Menlo, monospace; border: 2px solid var(--card3); border-radius: 12px; padding: 8px; background: #fff; color: var(--ink); resize: none; }
#ui .badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; }
#ui .badge.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; }
#ui .confirm { margin-top: 10px; padding: 12px; border-radius: var(--r-s); background: #fff; border: 2px solid var(--danger); }
#ui .confirm-text { font-weight: 600; margin-bottom: 10px; }
#ui .kicker { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink3); }
#ui .empty { padding: 16px; text-align: center; color: var(--ink3); font-size: 14px; }
#ui .flash-up { animation: flashUp .5s ease-out; }
#ui .flash-down { animation: flashDown .5s ease-out; }
@keyframes flashUp { 0% { color: var(--success); transform: scale(1.25); } 100% { color: inherit; transform: none; } }
@keyframes flashDown { 0% { color: var(--danger); transform: scale(1.15); } 100% { color: inherit; transform: none; } }
#ui .float-text { position: absolute; transform: translate(-50%, -50%); font-weight: 800; font-size: 18px; color: var(--success); text-shadow: 0 1px 0 #fff, 0 0 6px rgba(255, 255, 255, .9); pointer-events: none; animation: floatUp 1.2s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -160%); } }

/* ---------- HUD oben ---------- */
#ui .hud-top { position: absolute; top: calc(var(--sat) + 8px); left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); display: flex; align-items: flex-start; gap: 8px; }
#ui .hud-card { flex: 1 1 auto; min-width: 0; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px 8px; }
#ui .hud-row { display: flex; align-items: center; gap: 6px; }
#ui .hud-row + .hud-row { margin-top: 5px; }
#ui .hud-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 9px 0 6px; border: 0; border-radius: 11px; background: var(--card2); font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
#ui .hud-chip .ico { color: var(--ink); }
#ui .hud-chip small { font-weight: 600; font-size: 11px; color: var(--ink2); }
#ui .hud-chip .num { min-width: 1.4em; text-align: left; display: inline-block; }
#ui .hud-chip.warn { background: #FBE7CF; color: #9A4D00; }
#ui .hud-chip.danger { background: #FBD9DA; color: #9E1F24; }
#ui .hud-chip.chip-voll { background: #FBE7CF; }
#ui .hud-chip.grow { flex: 1 1 0; }
#ui .hud-day { position: relative; padding-left: 4px; }
#ui .hud-day .ring-wrap { position: relative; }
#ui .hud-day .day-ic { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--gold); }
#ui .hud-day .day-ic .ic .a { fill: var(--gold); }
#ui .hud-day.night .day-ic { color: #5B6BB3; }
#ui .hud-day.night .day-ic .ic .a { fill: #8FA0E6; }
#ui .hud-expand { margin-left: auto; width: 34px; height: 34px; min-height: 34px; border-radius: 10px; flex: none; }
#ui .hud-expand .ic { transition: transform .2s; }
#ui .hud-card.expanded .hud-expand .ic { transform: rotate(180deg); }
#ui .hud-details { display: none; flex-wrap: wrap; gap: 4px 6px; padding-top: 6px; margin-top: 6px; border-top: 1px dashed rgba(43, 42, 51, .15); }
#ui .hud-card.expanded .hud-details { display: flex; }
#ui .hud-res { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 6px 2px 3px; border-radius: 8px; background: var(--card2); }
#ui .hud-res small { font-weight: 500; color: var(--ink3); font-size: 10px; }
#ui .hud-res.chip-voll { background: #FBE7CF; }
#ui .hud-res.zero { opacity: .5; }
#ui .hud-gear { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); }
#ui .hud-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: none; }
#ui .hud-boost { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: var(--gold); color: #3B2A00; font-size: 12px; font-weight: 800; box-shadow: var(--shadow-soft); white-space: nowrap; }
#ui .hud-boost .ic .a { fill: #fff; }
#ui .topstack { position: absolute; top: calc(var(--sat) + var(--hud-top-h) + 6px); left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); display: flex; flex-direction: column; align-items: stretch; gap: 6px; pointer-events: none; }
#ui .topstack > * { pointer-events: auto; }
#ui .tracker { display: flex; flex-direction: column; gap: 4px; margin-right: 52px; }
#ui .tracker-item { display: flex; align-items: center; gap: 8px; background: rgba(247, 242, 234, .92); border-radius: 12px; padding: 6px 10px; box-shadow: var(--shadow-soft); font-size: 12px; cursor: pointer; }
#ui .tracker-item .tr-title { font-weight: 800; white-space: nowrap; }
#ui .tracker-item .tr-step { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
#ui .tracker-item .bar { width: 44px; flex: none; }
#ui .sendmode { align-self: center; max-width: 100%; display: flex; align-items: center; gap: 10px; background: var(--primary); color: #fff; padding: 8px 10px 8px 14px; border-radius: 999px; box-shadow: var(--shadow); font-weight: 700; font-size: 14px; white-space: nowrap; animation: pop .2s ease-out; }
#ui .sendmode .btn { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- HUD unten ---------- */
#ui .hud-bottom { position: absolute; left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); bottom: calc(var(--sab) + 8px); display: flex; flex-direction: column; align-items: stretch; gap: 8px; transition: transform .22s, opacity .2s; }
#ui .hud-bottom.away { transform: translateY(140%); opacity: 0; pointer-events: none; visibility: hidden; }
#ui .hud-bar { display: flex; justify-content: space-around; align-items: flex-end; gap: 4px; padding: 6px 6px 6px; background: var(--card); border-radius: 26px; box-shadow: var(--shadow); }
#ui .hb { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; padding: 0; min-width: 56px; cursor: pointer; position: relative; }
#ui .hb .hb-ic { width: 52px; height: 52px; border-radius: 50%; background: var(--card2); display: flex; align-items: center; justify-content: center; color: var(--ink); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .07); transition: transform .1s, background .15s; }
#ui .hb:active .hb-ic { transform: scale(.92); }
#ui .hb .hb-label { font-size: 10px; font-weight: 700; color: var(--ink2); }
#ui .hb.primary .hb-ic { width: 62px; height: 62px; background: var(--primary); color: #fff; margin-top: -14px; box-shadow: 0 4px 12px rgba(82, 79, 254, .4), inset 0 -3px 0 rgba(0, 0, 0, .15); }
#ui .hb.primary .hb-ic .ic .a { fill: rgba(255, 255, 255, .35); }
#ui .hb.active .hb-ic { background: var(--gold); }
#ui .hb.fast.active .hb-ic { background: var(--gold); animation: pulseGold 1s infinite; }
#ui .hb .badge { position: absolute; top: -2px; right: 4px; border: 2px solid var(--card); }
#ui .hb .hb-sub { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; background: var(--ink); color: #fff; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
@keyframes pulseGold { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 177, 52, .6); } 70% { box-shadow: 0 0 0 10px rgba(242, 177, 52, 0); } }
#ui .actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-right: 4px; }
#ui .act { flex-direction: row-reverse; gap: 6px; }
#ui .act .act-label { text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
#ui .act { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; padding: 0; cursor: pointer; animation: pop .3s ease-out; }
#ui .act .act-ic { width: 50px; height: 50px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; position: relative; }
#ui .act .act-ic .ic { color: var(--ink); }
#ui .act .act-label { font-size: 10px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
#ui .act.antreiben .act-ic { background: var(--gold); animation: bob 1.4s ease-in-out infinite; }
#ui .act.antreiben .act-ic .ic .a { fill: #fff; }
#ui .act.treibgut .act-ic { background: #D2A05A; animation: bob 1.8s ease-in-out infinite; }
#ui .act.geschenk .act-ic { background: #F5A3C7; }
#ui .act.akt-belohnung .act-ic { background: var(--success); color: #fff; }
#ui .act.akt-belohnung .act-ic .ic { color: #fff; }
#ui .act .arrow { position: absolute; top: -8px; right: -6px; background: var(--primary); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; animation: bob .9s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------- Blätter (Bottom Sheets) & Panels ---------- */
#ui .sheet { position: absolute; left: calc(var(--sal) + 6px); right: calc(var(--sar) + 6px); bottom: 0; max-height: calc(100% - var(--hud-top-h) - var(--sat) - 20px); background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -6px 24px rgba(30, 20, 60, .22); transform: translateY(110%); visibility: hidden; transition: transform .24s cubic-bezier(.2, .8, .2, 1), height .24s, visibility 0s linear .24s; display: flex; flex-direction: column; padding: 0 12px calc(var(--sab) + 12px); overflow: hidden; }
#ui .sheet.open { transform: translateY(0); visibility: visible; transition-delay: 0s; }
#ui .sheet.half { height: 52%; }
#ui .sheet.tall { height: 72%; }
#ui .sheet.full { height: calc(100% - var(--hud-top-h) - var(--sat) - 20px); }
#ui .sheet.auto { height: auto; }
#ui .sheet-handle { flex: none; height: 22px; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; }
#ui .sheet-handle::before { content: ""; width: 42px; height: 5px; border-radius: 999px; background: rgba(43, 42, 51, .2); }
#ui .sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: 6px; }
#ui .sheet-foot { flex: none; padding-top: 8px; display: flex; gap: 8px; }
#ui .panel-head { display: flex; align-items: center; gap: 10px; padding: 2px 0 8px; }
#ui .panel-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--card2); display: flex; align-items: center; justify-content: center; flex: none; }
#ui .panel-titles { flex: 1 1 auto; min-width: 0; }
#ui .panel-title { font-size: 19px; font-weight: 800; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ui .panel-close { flex: none; }
#ui .section { margin-top: 10px; }
#ui .section-title { font-size: 12px; font-weight: 800; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
#ui .line { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--card2); margin-bottom: 6px; }
#ui .line .grow { flex: 1 1 auto; min-width: 0; }
#ui .line-title { font-weight: 700; font-size: 14px; }
#ui .line-sub { font-size: 12px; color: var(--ink2); }

/* Vollbild-Panels */
#ui .full { position: absolute; inset: 0; background: var(--card); display: flex; flex-direction: column; padding: calc(var(--sat) + 10px) calc(var(--sar) + 12px) calc(var(--sab) + 12px) calc(var(--sal) + 12px); transform: translateY(100%); opacity: 0; visibility: hidden; transition: transform .26s cubic-bezier(.2, .8, .2, 1), opacity .2s, visibility 0s linear .26s; }
#ui .full.open { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
#ui .full .full-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#ui .full .panel-title { font-size: 22px; }

/* ---------- Baumenü ---------- */
#ui .reco { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
#ui .reco-card { flex: none; width: 128px; border-radius: 14px; background: #fff; padding: 8px; display: flex; flex-direction: column; gap: 4px; border: 2px solid transparent; cursor: pointer; text-align: left; box-shadow: var(--shadow-soft); }
#ui .reco-card.ok { border-color: var(--success); }
#ui .reco-card .rc-name { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ui .reco-card .ico { align-self: flex-start; }
#ui .bcard { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 16px; background: #fff; margin-bottom: 8px; box-shadow: var(--shadow-soft); cursor: pointer; border: 0; width: 100%; text-align: left; position: relative; }
#ui .bcard:active { filter: brightness(.97); }
#ui .bcard .b-ic { width: 54px; height: 54px; border-radius: 14px; background: var(--card2); display: flex; align-items: center; justify-content: center; flex: none; background-image: linear-gradient(rgba(43, 42, 51, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(43, 42, 51, .06) 1px, transparent 1px); background-size: 9px 9px; }
#ui .bcard .b-main { flex: 1 1 auto; min-width: 0; }
#ui .bcard .b-name { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; }
#ui .bcard .b-desc { font-size: 12px; color: var(--ink2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#ui .bcard .b-cost { margin-top: 4px; }
#ui .bcard .b-act { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--success); color: #fff; display: flex; align-items: center; justify-content: center; }
#ui .bcard.nok .b-act { background: var(--card3); color: var(--ink3); }
#ui .bcard.locked { opacity: .75; }
#ui .bcard.locked .b-act { background: var(--card3); color: var(--ink2); }
#ui .bcard .b-lock { font-size: 12px; color: var(--danger); font-weight: 700; margin-top: 2px; }
#ui .bcard .b-count { font-size: 11px; font-weight: 700; color: var(--ink3); background: var(--card2); padding: 1px 6px; border-radius: 999px; }
#ui .bcard .b-tag { font-size: 10px; font-weight: 700; color: var(--ink2); background: var(--card2); padding: 1px 6px; border-radius: 999px; }

/* ---------- Platzieren-Karte ---------- */
#ui .place { position: absolute; left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); bottom: calc(var(--sab) + 8px); background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; transform: translateY(130%); visibility: hidden; transition: transform .22s, visibility 0s linear .22s; }
#ui .place.open { transform: none; visibility: visible; transition-delay: 0s; }
#ui .place-x { position: absolute; right: 10px; top: -54px; display: flex; gap: 8px; }
#ui .place-x .btn { background: var(--card); box-shadow: var(--shadow); }
#ui .place .cost-line { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--card2); margin: 8px 0 10px; font-size: 13px; color: var(--ink2); }
#ui .place .grund { font-size: 13px; font-weight: 700; color: var(--danger); min-height: 18px; margin-bottom: 6px; }
#ui .place .grund.ok { color: var(--success); }
#ui .place .row .btn { flex: 1 1 0; }

/* ---------- Gebäude-Panel ---------- */
#ui .status-line { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--card2); font-size: 13px; font-weight: 600; }
#ui .status-line .ico { color: var(--ink2); }
#ui .workers { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
#ui .wslot { position: relative; width: 56px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; }
#ui .wslot .wname { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ui .wslot .wx { position: absolute; top: -4px; right: 2px; width: 22px; height: 22px; min-height: 22px; border-radius: 50%; background: var(--ink); color: #fff; padding: 0; display: flex; align-items: center; justify-content: center; border: 2px solid var(--card); }
#ui .wslot.empty .wbox { width: 48px; height: 48px; border-radius: 50%; border: 2px dashed rgba(43, 42, 51, .25); }
#ui .wslot.add .wbox { width: 52px; height: 52px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
#ui .wslot.add.disabled { opacity: .4; }
#ui .wcount { display: flex; align-items: center; gap: 6px; margin-left: auto; }
#ui .wcount .btn-round { width: 48px; height: 48px; min-height: 48px; }
#ui .wcount .btn-round .ic { width: 28px; height: 28px; }
#ui .wcount .btn-round.minus { background: #FBD9DA; color: #9E1F24; }
#ui .wcount .btn-round.plus { background: #D7F1DC; color: #1F6E33; }
#ui .wcount b { min-width: 2.2em; text-align: center; font-size: 16px; }
#ui .prod { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 700; }
#ui .prod .ico { color: var(--ink2); }
#ui .prod .miss { color: var(--danger); font-size: 12px; }
#ui .delivery { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
#ui .dres { background: #fff; border-radius: 12px; padding: 6px; text-align: center; font-size: 12px; font-weight: 700; border: 2px solid transparent; }
#ui .dres.done { border-color: var(--success); }
#ui .dres .ico { display: block; margin: 0 auto 2px; }
#ui .tap-hint { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #FFF6DF; color: #6B4A00; font-size: 13px; font-weight: 700; animation: hintPulse 1.6s infinite; }
#ui .tap-hint .ic .a { fill: var(--gold); }
@keyframes hintPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 177, 52, .35); } 50% { box-shadow: 0 0 0 6px rgba(242, 177, 52, 0); } }
#ui .ubtn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 14px; border: 0; background: var(--card3); text-align: left; cursor: pointer; color: var(--ink); }
#ui .ubtn.ok { background: #FBE2C4; }
#ui .ubtn.ok .u-arrow { background: var(--success); color: #fff; }
#ui .ubtn .u-arrow { width: 36px; height: 36px; border-radius: 50%; background: var(--card2); color: var(--ink3); display: flex; align-items: center; justify-content: center; flex: none; }
#ui .ubtn .u-title { font-weight: 800; font-size: 14px; }
#ui .ubtn.max { opacity: .6; cursor: default; }
#ui .actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
#ui .actions-row .btn.wide { grid-column: 1 / -1; }

/* ---------- Siedler ---------- */
#ui .settler { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: #fff; margin-bottom: 8px; box-shadow: var(--shadow-soft); }
#ui .settler .s-main { flex: 1 1 auto; min-width: 0; }
#ui .settler .s-name { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; }
#ui .settler .s-job { font-size: 12px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ui .needs { display: flex; gap: 6px; margin-top: 4px; }
#ui .need { flex: 1 1 0; display: flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; color: var(--ink2); }
#ui .need .bar { flex: 1 1 auto; height: 6px; }
#ui .need.low .bar-fill { background: var(--danger); }
#ui .need .ic { width: 12px; height: 12px; }
#ui .s-btns { display: flex; flex-direction: column; gap: 4px; flex: none; }
#ui .s-btns .btn { min-height: 36px; padding: 0 10px; font-size: 12px; border-radius: 10px; }
#ui .s-btns .btn-send { min-height: 44px; font-size: 13px; border-radius: 12px; }
#ui .btn-send-big { min-height: 60px; }
#ui .btn-send-big .btn-label { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
#ui .btn-send-big small { font-weight: 600; font-size: 12px; opacity: .9; }
#ui .role-tag { font-size: 10px; font-weight: 800; color: #fff; background: var(--primary); border-radius: 999px; padding: 1px 6px; }

/* ---------- Inselkarte ---------- */
#ui .map-full { padding: 0; background: #1E5FA8; }
#ui .map-svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#ui .map-top { position: absolute; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 12px); right: calc(var(--sar) + 12px); display: flex; align-items: center; gap: 10px; color: #fff; }
#ui .map-top .map-title { font-size: 20px; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, .4); flex: 1; }
#ui .map-bottom { position: absolute; left: calc(var(--sal) + 12px); right: calc(var(--sar) + 12px); bottom: calc(var(--sab) + 12px); display: flex; flex-direction: column; align-items: stretch; gap: 8px; pointer-events: none; }
#ui .map-bottom > * { pointer-events: auto; }
#ui .map-legend { background: rgba(247, 242, 234, .95); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
#ui .map-legend .lg { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
#ui .map-legend .lg i { width: 18px; height: 0; border-top: 3px dashed var(--gold); display: inline-block; }
#ui .map-legend .lg i.solid { border-top-style: solid; border-color: var(--primary); }
#ui .map-legend .lg .dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); display: inline-block; }
#ui .map-island { cursor: pointer; }
#ui .map-island text { font-weight: 800; fill: #fff; font-size: calc(3.4px / var(--mz, 1)); text-anchor: middle; paint-order: stroke; stroke: rgba(0, 0, 0, .45); stroke-width: calc(.7px / var(--mz, 1)); pointer-events: none; }
#ui .map-island .sub { font-size: calc(2.5px / var(--mz, 1)); font-weight: 600; }
#ui .map-island text.big { font-size: calc(7px / var(--mz, 1)); }
#ui .map-island.pressed { opacity: .8; }
#ui .map-top .map-reset { background: rgba(247, 242, 234, .96); box-shadow: var(--shadow); }
#ui .map-boat .hit { pointer-events: all; }
#ui .map-boat { cursor: pointer; }
#ui .map-island.current .ring-cur { stroke: #fff; stroke-width: .8; fill: none; stroke-dasharray: 2 1.4; animation: spinDash 6s linear infinite; }
@keyframes spinDash { to { stroke-dashoffset: -100; } }
#ui .map-route { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: .7; stroke-dasharray: 2 1.6; }
#ui .map-route.inactive { stroke: rgba(255, 255, 255, .35); }
#ui .map-boat circle { fill: #fff; stroke: var(--ink); stroke-width: .5; }
#ui .map-boat .ic { color: var(--ink); }
#ui .map-row-bar { display: flex; justify-content: center; }
#ui .map-row-bar .btn { background: var(--gold); color: #3B2A00; box-shadow: var(--shadow); animation: bob 1.2s infinite; max-width: 100%; white-space: normal; text-align: left; border-radius: 16px; padding: 8px 16px; }
#ui .map-row-bar .btn .btn-label { display: flex; flex-direction: column; min-width: 0; }
#ui .map-row-bar .btn small { font-weight: 600; font-size: 12px; opacity: .85; }
#ui .map-row-bar .btn .ic .a { fill: #fff; }
#ui .map-boat .row-ring { fill: none; stroke: var(--gold); stroke-width: .8; opacity: 0; }
#ui .map-boat.rowable .row-ring { opacity: 1; transform-box: fill-box; transform-origin: center; animation: rowRing 1.2s ease-out infinite; }
@keyframes rowRing { 0% { transform: scale(.6); opacity: .95; } 100% { transform: scale(1.9); opacity: 0; } }
#ui .map-card { position: absolute; left: calc(var(--sal) + 12px); right: calc(var(--sar) + 12px); bottom: calc(var(--sab) + 70px); background: var(--card); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); animation: pop .2s ease-out; }

/* ---------- Routen-Editor / Expedition / Boote ---------- */
#ui .rule { background: #fff; border-radius: 14px; padding: 8px 10px; margin-bottom: 8px; box-shadow: var(--shadow-soft); }
#ui .rule .row + .row { margin-top: 6px; }
#ui .rule .select { flex: 1 1 0; min-width: 0; font-size: 13px; padding: 0 6px; }
#ui .rule .row { flex-wrap: wrap; }
#ui .rule .val { font-weight: 800; min-width: 56px; text-align: right; font-size: 14px; }
#ui .rule .del { width: 36px; height: 36px; min-height: 36px; background: #FBD9DA; color: #9E1F24; }
#ui .preview { background: #E7F4EA; border-radius: 12px; padding: 8px 10px; font-size: 13px; font-weight: 600; color: #1F6E33; }
#ui .preview.empty { background: var(--card2); color: var(--ink2); }
#ui .opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: #fff; margin-bottom: 6px; border: 2px solid transparent; cursor: pointer; box-shadow: var(--shadow-soft); width: 100%; text-align: left; }
#ui .opt.sel { border-color: var(--primary); background: #EEEDFF; }
#ui .opt.off { opacity: .5; cursor: default; }
#ui .opt .o-main { flex: 1 1 auto; min-width: 0; }
#ui .opt .o-title { font-weight: 800; font-size: 14px; }
#ui .opt .o-sub { font-size: 12px; color: var(--ink2); }
#ui .opt .o-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink3); display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
#ui .opt.sel .o-check { background: var(--primary); border-color: var(--primary); }
#ui .boat-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: #fff; margin-bottom: 6px; box-shadow: var(--shadow-soft); }
#ui .boat-row .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--water); display: flex; align-items: center; justify-content: center; flex: none; }

/* ---------- Toasts / Hinweis / Popups ---------- */
#ui .toasts { position: absolute; top: calc(var(--sat) + var(--hud-top-h) + 8px + var(--topstack-h, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(92%, 420px); pointer-events: none; transition: top .2s; }
#ui .toasts.low { top: auto; bottom: calc(var(--sab) + 150px); }
#ui .toast { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: rgba(43, 42, 51, .92); color: #fff; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); animation: toastIn .25s ease-out; max-width: 100%; }
#ui .toast .ic { color: #fff; }
#ui .toast.erfolg { background: var(--success); }
#ui .toast.warn { background: var(--warn); }
#ui .toast.fehler { background: var(--danger); }
#ui .toast.info { background: var(--primary); }
#ui .toast.out { animation: toastOut .25s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
#ui .hint { margin: 0 2px; }
#ui .hint-card { background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.4; box-shadow: var(--shadow); animation: pop .2s ease-out; cursor: pointer; }
#ui .hint-card:active { filter: brightness(.96); }
#ui .hint-card b { font-weight: 800; }
#ui .hint-card .ic { vertical-align: -3px; margin-right: 1px; }
#ui .hint-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
#ui .hint-row .btn-hide { min-height: 30px; padding: 0 10px; font-size: 12px; background: var(--card); border: 2px solid var(--ink); border-radius: 9px; box-shadow: none; }
#ui .hint-row .btn-next { width: 36px; height: 36px; min-height: 36px; border-radius: 11px; }
#ui .modal { position: absolute; inset: 0; background: rgba(20, 18, 40, .45); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s; }
#ui .modal-card { width: min(100%, 400px); max-height: 100%; overflow-y: auto; background: var(--card); border-radius: 22px; padding: 18px 16px; box-shadow: var(--shadow); animation: pop .22s ease-out; }
#ui .modal-card h2 { margin: 0 0 8px; font-size: 20px; }
#ui .modal-card p { margin: 0 0 10px; color: var(--ink2); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
#ui .popup-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
#ui .popup-band { background: var(--danger); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; display: inline-block; margin-bottom: 8px; }
#ui .gain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin: 8px 0; }
#ui .gain { background: #fff; border-radius: 12px; padding: 8px 6px; text-align: center; font-weight: 800; font-size: 14px; }
#ui .gain small { display: block; font-weight: 600; color: var(--ink2); font-size: 11px; }
#ui .gain .ico { display: block; margin: 0 auto 2px; }

/* ---------- Dialog ---------- */
#ui .dialog { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: calc(var(--sat) + 8px) calc(var(--sar) + 8px) calc(var(--sab) + 10px) calc(var(--sal) + 8px); background: rgba(20, 18, 40, .38); opacity: 0; visibility: hidden; transition: opacity .22s, visibility 0s linear .25s; cursor: pointer; touch-action: none; }
#ui .dialog.open { opacity: 1; visibility: visible; transition-delay: 0s; }
#ui .dlg-card { --sp: var(--primary); --sp-text: var(--primary); display: flex; flex-wrap: wrap; gap: 12px; width: min(100%, 520px); margin: 0 auto; background: var(--card); border-radius: 20px; padding: 14px 14px 26px; box-shadow: var(--shadow), inset 4px 0 0 var(--sp); min-height: 124px; position: relative; transform: translateY(120%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
#ui .dialog.open .dlg-card { transform: none; }
#ui .dlg-portrait { flex: none; width: 64px; }
#ui .dlg-portrait .avatar { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 3px var(--sp); }
#ui .dlg-portrait.small { width: 44px; }
#ui .dlg-portrait.small .avatar { width: 44px; height: 44px; box-shadow: 0 0 0 2px var(--sp); }
#ui .dlg-narr { width: 64px; height: 64px; border-radius: 50%; background: var(--card2); color: var(--ink2); display: flex; align-items: center; justify-content: center; }
#ui .dlg-main { flex: 1 1 0; min-width: 0; }
#ui .dlg-name { font-weight: 800; font-size: 13px; color: var(--sp-text); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
#ui .dlg-text { font-size: 16px; line-height: 1.4; min-height: 66px; white-space: pre-line; }
#ui .dlg-card.narrator .dlg-text { font-style: italic; color: var(--ink2); }
#ui .dlg-next { position: absolute; right: 12px; bottom: 6px; font-size: 12px; font-weight: 700; color: var(--ink3); display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; transition: background .2s, color .2s; }
#ui .dlg-next .dlg-tap { opacity: .55; }
#ui .dlg-card.ready .dlg-next { color: #fff; background: var(--primary); animation: tapPulse 1s ease-in-out infinite; }
#ui .dlg-card.ready .dlg-next .dlg-tap { opacity: 1; }
#ui .dlg-card.ready .dlg-next .ic { animation: bob .9s infinite; }
@keyframes tapPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(82, 79, 254, .55); } 60% { box-shadow: 0 0 0 7px rgba(82, 79, 254, 0); } }
/* Antwortknöpfe (Entscheidungsdialog): erscheinen, sobald der Text steht */
#ui .dlg-answers { flex: 1 1 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
#ui .dlg-answer { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--primary); background: #fff; color: var(--ink); font-weight: 700; font-size: 15px; line-height: 1.25; text-align: left; cursor: pointer; animation: pop .25s ease-out both; transition: transform .08s, background .15s; }
#ui .dlg-answer:active { transform: scale(.98); }
#ui .dlg-answer .dlg-ans-no { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
#ui .dlg-answer .dlg-ans-text { flex: 1 1 auto; min-width: 0; }
#ui .dlg-answer.sel { background: var(--primary); color: #fff; }
#ui .dlg-answer.sel .dlg-ans-no { background: #fff; color: var(--primary); }
#ui .dlg-answer:disabled:not(.sel) { opacity: .4; }
/* Tagebuchseite (Pergament) */
#ui .dlg-card.journal { --sp: #8E8E9A; flex-direction: column; flex-wrap: nowrap; gap: 8px; padding: 14px 16px 24px; max-height: min(64vh, 600px); background: #F3E6C3; background-image: repeating-linear-gradient(0deg, transparent 0 27px, rgba(120, 90, 30, .12) 27px 28px); border: 2px solid #C9A85C; box-shadow: var(--shadow); font-family: Georgia, "Times New Roman", serif; }
#ui .dlg-jhead { display: flex; align-items: center; gap: 10px; flex: none; }
#ui .dlg-jtitles { flex: 1 1 auto; min-width: 0; font-family: system-ui, -apple-system, sans-serif; }
#ui .dlg-kicker { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #8A6A2A; }
#ui .dlg-jtitle { font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 700; color: #4A3208; line-height: 1.15; }
#ui .dlg-jdate { font-size: 12px; font-style: italic; color: #6B4A12; margin-top: 2px; }
#ui .dlg-jicon { color: #8A6A2A; flex: none; }
#ui .dlg-jicon .ic .a { fill: #E9D7A5; }
#ui .dlg-card.journal .dlg-text { flex: 1 1 auto; min-height: 60px; max-height: 42vh; overflow-y: auto; -webkit-overflow-scrolling: touch; font-size: 15px; line-height: 1.5; color: #2E2410; padding-right: 4px; }
#ui .dlg-card.journal .dlg-next { color: #8A6A2A; font-family: system-ui, sans-serif; }
#ui .dlg-card.journal.ready .dlg-next { color: #fff; background: #8A6A2A; }
#ui .dlg-card.journal .dlg-name { color: #6B4A12; font-family: system-ui, sans-serif; }
#ui .dlg-card.journal .dlg-chapter { font-size: 18px; font-weight: 700; color: #4A3208; margin-bottom: 6px; }
#ui .bubbles { pointer-events: none; }
#ui .bubble { position: absolute; transform: translate(-50%, -100%); background: #fff; color: var(--ink); border-radius: 14px; padding: 6px 10px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-soft); max-width: 180px; text-align: center; animation: pop .2s ease-out; }
#ui .bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
#ui .bubble.out { opacity: 0; transition: opacity .3s; }

/* ---------- Tipp-Herausforderung ---------- */
#ui .challenge { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(82, 79, 254, .55), rgba(20, 18, 40, .82)); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--sat) + 16px) 16px calc(var(--sab) + 16px); touch-action: none; user-select: none; -webkit-user-select: none; color: #fff; animation: fadeIn .2s; cursor: pointer; }
#ui .ch-top { position: absolute; top: calc(var(--sat) + 12px); left: 12px; right: 12px; display: flex; align-items: flex-start; gap: 10px; }
#ui .ch-goal { flex: 1 1 auto; background: rgba(247, 242, 234, .96); color: var(--ink); border-radius: 16px; padding: 10px 14px; font-weight: 800; font-size: 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; }
#ui .ch-goal small { display: block; font-weight: 600; font-size: 12px; color: var(--ink2); }
#ui .ch-cancel { background: rgba(247, 242, 234, .96); box-shadow: var(--shadow); }
#ui .ch-ring { position: relative; width: min(72vw, 300px); height: min(72vw, 300px); }
#ui .ch-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
#ui .ch-ring .bgc { fill: rgba(255, 255, 255, .12); stroke: rgba(255, 255, 255, .25); stroke-width: 14; }
#ui .ch-ring .fgc { fill: none; stroke: var(--gold); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .08s linear; filter: drop-shadow(0 0 6px rgba(242, 177, 52, .8)); }
#ui .ch-ring .decay { fill: none; stroke: var(--danger); stroke-width: 14; stroke-linecap: round; opacity: .55; transition: stroke-dashoffset .12s linear; }
#ui .ch-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
#ui .ch-count { font-size: 56px; font-weight: 900; line-height: 1; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
#ui .ch-count small { font-size: 22px; font-weight: 700; opacity: .8; }
#ui .ch-icon { color: #fff; opacity: .9; }
#ui .ch-icon .ic .a { fill: rgba(255, 255, 255, .3); }
#ui .ch-ring.pulse { animation: chPulse .14s ease-out; }
@keyframes chPulse { 0% { transform: scale(1.06); } 100% { transform: none; } }
#ui .ch-time { width: min(72vw, 300px); margin-top: 18px; }
#ui .ch-time .bar { height: 12px; background: rgba(255, 255, 255, .2); }
#ui .ch-time .bar-fill { background: #fff; transition: none; }
#ui .ch-time .bar.low .bar-fill { background: var(--danger); }
#ui .ch-timetxt { text-align: center; font-weight: 800; margin-top: 6px; font-size: 15px; }
#ui .ch-reward { margin-top: 14px; background: rgba(247, 242, 234, .96); color: var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
#ui .ch-tap { position: absolute; bottom: calc(var(--sab) + 28px); left: 0; right: 0; text-align: center; font-weight: 800; font-size: 16px; opacity: .9; display: flex; align-items: center; justify-content: center; gap: 8px; animation: bob 1s infinite; }
#ui .ch-tap .ic .a { fill: rgba(255, 255, 255, .3); }
#ui .ripple { position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 3px solid #fff; transform: translate(-50%, -50%); pointer-events: none; animation: ripple .5s ease-out forwards; }
@keyframes ripple { to { width: 120px; height: 120px; opacity: 0; } }
#ui .ch-result { width: min(100%, 360px); background: var(--card); color: var(--ink); border-radius: 22px; padding: 20px 18px; text-align: center; box-shadow: var(--shadow); animation: pop .3s cubic-bezier(.2, .8, .2, 1.2); position: relative; overflow: hidden; }
#ui .ch-result h2 { margin: 6px 0 4px; font-size: 24px; }
#ui .ch-result .ch-res-ic { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: var(--success); color: #fff; }
#ui .ch-result.fail .ch-res-ic { background: var(--danger); }
#ui .ch-result p { color: var(--ink2); margin: 0 0 12px; }
#ui .confetti { position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px; animation: confetti 1.6s ease-in forwards; }
@keyframes confetti { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(420px) rotate(720deg); opacity: 0; } }

/* ---------- Aufträge / Missionen ---------- */
#ui .chapter-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: linear-gradient(135deg, #524FFE, #7B78FF); color: #fff; margin: 8px 0 10px; }
#ui .chapter-head .ch-no { width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; flex: none; }
#ui .chapter-head .ch-title { font-weight: 800; font-size: 17px; }
#ui .chapter-head small { opacity: .85; font-weight: 600; }
#ui .quest { background: #fff; border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; box-shadow: var(--shadow-soft); }
#ui .quest.done { opacity: .7; }
#ui .q-title { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; }
#ui .q-steps { margin: 6px 0 4px; display: flex; flex-direction: column; gap: 4px; }
#ui .q-step { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
#ui .q-step .q-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink3); display: flex; align-items: center; justify-content: center; flex: none; color: #fff; margin-top: 1px; }
#ui .q-step.done .q-mark { background: var(--success); border-color: var(--success); }
#ui .q-step.done .q-text { text-decoration: line-through; color: var(--ink3); }
#ui .q-step.active .q-text { font-weight: 700; }
#ui .q-step .q-prog { font-size: 12px; color: var(--ink2); margin-left: auto; white-space: nowrap; }
#ui .q-reward { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); margin-top: 4px; }
#ui .mission { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow-soft); }
#ui .mission .m-main { flex: 1 1 auto; min-width: 0; }
#ui .mission .m-text { font-weight: 700; font-size: 14px; }
#ui .mission .bar { margin-top: 6px; }
#ui .mission .btn-claim { flex: none; min-width: 96px; flex-direction: column; gap: 0; line-height: 1.1; padding: 6px 10px; }
#ui .mission .btn-claim small { font-weight: 600; font-size: 11px; opacity: .9; }

/* ---------- Einstellungen ---------- */
#ui .setting { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border-radius: 14px; margin-bottom: 8px; box-shadow: var(--shadow-soft); }
#ui .setting .st-main { flex: 1 1 auto; }
#ui .setting .st-title { font-weight: 700; font-size: 15px; }
#ui .setting .st-sub { font-size: 12px; color: var(--ink2); }
#ui .seg { display: flex; gap: 4px; background: var(--card3); border-radius: 11px; padding: 3px; }
#ui .seg button { border: 0; border-radius: 9px; background: transparent; font-weight: 700; font-size: 13px; min-height: 34px; padding: 0 10px; color: var(--ink2); cursor: pointer; }
#ui .seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-soft); }
#ui .about { font-size: 13px; color: var(--ink2); line-height: 1.5; padding: 4px 2px; }

/* ---------- Offline ---------- */
#ui .offline-time { font-size: 28px; font-weight: 900; color: var(--primary); margin: 2px 0 8px; }

/* ---------- Lager-Übersicht ---------- */
#ui .stock { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
#ui .stock .st-name { width: 78px; font-weight: 700; font-size: 13px; flex: none; }
#ui .stock .bar { flex: 1 1 auto; height: 18px; }
#ui .stock .st-num { width: 70px; text-align: right; font-weight: 800; font-size: 13px; flex: none; font-variant-numeric: tabular-nums; }
#ui .stock .st-num small { font-weight: 600; color: var(--ink3); }

/* ---------- Kapitel-Karte (Vollbild-Band) ---------- */
#ui .modal.cards { padding: 20px; }
#ui .chapter-card { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; background: radial-gradient(ellipse at 50% 30%, rgba(82, 79, 254, .4), rgba(20, 18, 40, .88)); animation: fadeIn .25s; }
#ui .chc-confetti { position: absolute; inset: 0; pointer-events: none; }
#ui .chc-confetti .confetti { animation-name: confettiTall; }
@keyframes confettiTall { 0% { transform: translateY(-20px) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(900deg); opacity: .2; } }
#ui .chc-band { width: 118%; padding: 30px 12% 34px; background: linear-gradient(135deg, #524FFE, #7B78FF 60%, #9A97FF); color: #fff; text-align: center; transform: rotate(-3deg); box-shadow: 0 14px 44px rgba(0, 0, 0, .4), inset 0 -4px 0 rgba(0, 0, 0, .15); animation: bandIn .55s cubic-bezier(.2, .8, .2, 1.1) both; }
@keyframes bandIn { 0% { transform: rotate(-3deg) translateX(-110%); opacity: 0; } 100% { transform: rotate(-3deg) translateX(0); opacity: 1; } }
#ui .chc-kicker { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; font-weight: 800; opacity: .85; }
#ui .chc-name { font-size: clamp(26px, 8.5vw, 42px); font-weight: 900; line-height: 1.08; margin: 8px 0 6px; text-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
#ui .chc-sub { font-size: 15px; font-weight: 600; opacity: .94; max-width: 460px; margin: 0 auto; line-height: 1.35; }
#ui .chc-no { position: absolute; top: calc(var(--sat) + 26px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: rgba(247, 242, 234, .96); color: var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 900; font-size: 18px; box-shadow: var(--shadow); animation: pop .3s ease-out .2s both; }
#ui .chc-foot { position: absolute; bottom: calc(var(--sab) + 34px); left: 24px; right: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: pop .3s ease-out .35s both; }
#ui .chc-btn { min-width: 220px; }
#ui .chc-hint { color: rgba(255, 255, 255, .75); font-size: 13px; font-weight: 600; }

/* ---------- Freischaltungs-Karte ---------- */
#ui .unlock-card { padding: 16px 16px 14px; }
#ui .unl-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
#ui .unl-head h2 { margin: 2px 0 0; font-size: 22px; line-height: 1.1; }
#ui .unl-icon { width: 74px; height: 74px; border-radius: 20px; background: var(--card2); display: flex; align-items: center; justify-content: center; flex: none; background-image: linear-gradient(rgba(43, 42, 51, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(43, 42, 51, .06) 1px, transparent 1px); background-size: 9px 9px; box-shadow: var(--shadow-soft); }
#ui .unl-desc { margin: 0 0 10px; color: var(--ink2); font-size: 14px; }
#ui .unl-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
#ui .unl-box { background: #fff; border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-soft); text-align: left; }
#ui .unl-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink2); display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
#ui .unl-need .unl-title { color: var(--warn); }
#ui .unl-gives .unl-title { color: var(--success); }
#ui .unl-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
#ui .unl-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--ink2); background: var(--card2); border-radius: 999px; padding: 2px 8px 2px 5px; }
#ui .unl-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; padding: 3px 0; }
#ui .unl-line.sub { font-weight: 600; color: var(--ink2); font-size: 12px; }
#ui .unl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
#ui .unl-actions .btn:only-child { grid-column: 1 / -1; }

/* ---------- Erste Minuten: Zeigehand auf dem Bauen-Knopf, pulsierende Empfohlen-Karte ---------- */
#ui .coach { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 3; }
#ui .coach-ring { position: absolute; left: 0; top: 0; width: calc(var(--coach-r, 62px) + 16px); height: calc(var(--coach-r, 62px) + 16px); border-radius: 50%; border: 3px solid var(--gold); box-shadow: 0 0 12px rgba(242, 177, 52, .7); transform: translate(-50%, -50%); animation: coachRing 1.3s ease-out infinite; }
@keyframes coachRing { 0% { transform: translate(-50%, -50%) scale(.8); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } }
#ui .coach-hand { position: absolute; left: 0; top: 0; line-height: 0; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); transform: translate(-28%, -125%); animation: coachHand 1s ease-in-out infinite; }
@keyframes coachHand { 0%, 100% { transform: translate(-28%, -138%); } 50% { transform: translate(-28%, -112%); } }
#ui .coach-text { position: absolute; left: 0; top: 0; transform: translate(-22%, -340%); white-space: nowrap; background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; padding: 7px 12px; border-radius: 999px; box-shadow: var(--shadow); animation: pop .3s ease-out; }
#ui .coach-text::after { content: ""; position: absolute; left: 28px; bottom: -6px; width: 12px; height: 12px; background: var(--ink); transform: rotate(45deg); border-radius: 2px; }
#ui .reco-card.pulse { border-color: var(--gold); animation: recoPulse 1.3s ease-out infinite; }
@keyframes recoPulse { 0% { box-shadow: 0 0 0 0 rgba(242, 177, 52, .75); } 100% { box-shadow: 0 0 0 12px rgba(242, 177, 52, 0); } }

/* ---------- Hämmern-Feedback im Baustellen-Panel ---------- */
#ui .hammer-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 68px; margin-top: 8px; padding: 8px 16px; border: 0; border-radius: 18px; background: linear-gradient(180deg, #FFC94D, #F2B134); color: #3B2A00; box-shadow: 0 5px 0 #B87A10, 0 8px 18px rgba(242, 177, 52, .45); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .06s, box-shadow .06s; }
#ui .hammer-btn:active, #ui .hammer-btn.hit { transform: translateY(4px); box-shadow: 0 1px 0 #B87A10, 0 3px 8px rgba(242, 177, 52, .35); }
#ui .hammer-btn .hb-icon { width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, .55); display: flex; align-items: center; justify-content: center; flex: none; }
#ui .hammer-btn .hb-icon .ic .a { fill: #fff; }
#ui .hammer-btn.hit .hb-icon { animation: hammerHit .18s ease-out; transform-origin: 70% 80%; }
@keyframes hammerHit { 0% { transform: rotate(-30deg); } 100% { transform: none; } }
#ui .hammer-btn .hb-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
#ui .hammer-btn .hb-text b { font-size: 20px; letter-spacing: .06em; }
#ui .hammer-btn .hb-text small { font-size: 12px; font-weight: 600; opacity: .85; }
#ui .hammer-btn.maxed { filter: grayscale(.6) brightness(.95); }
#ui .tap-big { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, #FFF3D2, #FFE3A6); border: 2px solid var(--gold); margin-top: 10px; animation: hintPulse 1.6s infinite; }
#ui .tb-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--gold); color: #3B2A00; display: flex; align-items: center; justify-content: center; flex: none; transform-origin: 65% 80%; animation: hammerSwing 1.1s ease-in-out infinite; }
#ui .tb-ic .ic .a { fill: #fff; }
@keyframes hammerSwing { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(16deg); } }
#ui .tb-main { flex: 1 1 auto; min-width: 0; }
#ui .tb-title { font-size: 17px; font-weight: 900; color: #3B2A00; line-height: 1.15; }
#ui .tb-sub { font-size: 12px; font-weight: 600; color: #6B4A00; margin-top: 3px; }
#ui .tap-pct { font-size: 26px; font-weight: 900; color: #3B2A00; font-variant-numeric: tabular-nums; flex: none; min-width: 60px; text-align: right; }
#ui .tap-pct.bump { animation: pctBump .4s cubic-bezier(.2, .8, .2, 1.4); }
@keyframes pctBump { 0% { transform: scale(1.5); color: var(--success); } 100% { transform: none; } }
#ui .kombo { position: absolute; right: 8px; top: -16px; background: var(--danger); color: #fff; font-weight: 900; font-size: 17px; padding: 3px 11px; border-radius: 999px; box-shadow: var(--shadow); transform: rotate(-8deg); }
#ui .kombo.pop { animation: komboPop .35s cubic-bezier(.2, .8, .2, 1.5); }
@keyframes komboPop { 0% { transform: rotate(-8deg) scale(.4); } 100% { transform: rotate(-8deg) scale(1); } }
#ui .tap-float { position: absolute; right: 18px; top: 2px; font-weight: 900; color: var(--success); font-size: 17px; text-shadow: 0 1px 0 #fff; pointer-events: none; animation: tapFloat .9s ease-out forwards; }
@keyframes tapFloat { 0% { opacity: 0; transform: translateY(6px) scale(.7); } 20% { opacity: 1; transform: translateY(-6px) scale(1.1); } 100% { opacity: 0; transform: translateY(-40px); } }

/* ---------- kleine Bildschirme ---------- */
@media (max-width: 374px) {
  #ui { font-size: 14px; }
  #ui .hud-chip { font-size: 13px; padding: 0 7px 0 5px; gap: 4px; }
  #ui .hb { min-width: 48px; }
  #ui .hb .hb-ic { width: 46px; height: 46px; }
  #ui .hb.primary .hb-ic { width: 56px; height: 56px; }
  #ui .ch-count { font-size: 46px; }
  #ui .sheet { padding: 0 8px calc(var(--sab) + 10px); }
  #ui .tabs.stacked .tab { min-width: 56px; padding: 4px 3px; font-size: 10px; }
  #ui .tab { font-size: 12px; padding: 0 6px; }
  #ui .full { padding-left: calc(var(--sal) + 8px); padding-right: calc(var(--sar) + 8px); }
  #ui .mission .btn-claim { min-width: 84px; padding: 6px 8px; }
  #ui .chapter-head .ch-title { font-size: 15px; }
  #ui .dlg-text { font-size: 15px; }
  #ui .dlg-answer { font-size: 14px; min-height: 50px; }
  #ui .tap-pct { font-size: 22px; min-width: 52px; }
  #ui .tb-title { font-size: 15px; }
  #ui .map-legend { font-size: 11px; gap: 4px 10px; padding: 8px 10px; }
  #ui .unl-actions .btn { font-size: 14px; padding: 0 10px; gap: 4px; }
  #ui .unl-head h2 { font-size: 20px; }
}
@media (min-width: 700px) {
  #ui .sheet, #ui .place { left: 50%; right: auto; width: 520px; transform: translate(-50%, 110%); }
  #ui .sheet.open, #ui .place.open { transform: translate(-50%, 0); visibility: visible; }
  /* HUD unten: Leiste 520 px mittig, schwebende Aktionsknöpfe bleiben rechts an der Kante */
  #ui .hud-bar { width: min(100%, 520px); align-self: center; }
  /* HUD oben: Karte max. 720 px mittig, Zahnrad/Boost rechts an der Kante */
  #ui .hud-top { padding-right: 52px; }
  #ui .hud-card { max-width: 720px; margin: 0 auto; }
  #ui .hud-side { position: absolute; right: 0; top: 0; }
  #ui .topstack, #ui .toasts { left: 50%; right: auto; width: min(720px, calc(100% - 16px)); transform: translateX(-50%); }
  #ui .full:not(.map-full) { left: 50%; right: auto; width: 560px; margin-left: -280px; border-radius: 0; }
}
