:root {
  --bg: #17181c;
  --panel: #23262d;
  --border: #3a3f48;
  --text: #ece6d6;
  --muted: #9aa0a8;
  --accent: #e8c15a;
  --gm: #cfe3c0;
  --world: #b9cde6;
  --error: #ff8a7a;
  --side: 340px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, "Segoe UI", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); min-height: 1.2em; }
.panel { background: var(--panel); border: 2px solid var(--border); border-radius: 4px; padding: 8px 10px; }
h1, h2, h3 { margin: 0 0 4px; }
h2 { font-size: 1.05rem; color: var(--accent); }
button { background: var(--accent); color: #222; border: 0; border-bottom: 3px solid #a8862e; border-radius: 3px;
  padding: 6px 10px; font-weight: 700; cursor: pointer; font-size: .85rem; }
button:active { border-bottom-width: 1px; transform: translateY(2px); }
button:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.8); }
.secondary { background: #3a4150; color: var(--text); border-bottom-color: #262a33; }
input, textarea { width: 100%; background: #16181d; color: var(--text); border: 2px solid var(--border);
  border-radius: 3px; padding: 6px 8px; font: inherit; resize: vertical; }
canvas.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .6); z-index: 10; padding: 16px; }
#login-form, #invite-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
#invite-fields { display: flex; flex-direction: column; gap: 10px; }
#invite-fields.hidden { display: none; }
.small-note { font-size: .78rem; }
#invite-form label, #login-form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }

/* --- Aufteilung: große Karte links, schmale Leiste rechts --- */
#game { display: flex; gap: 10px; padding: 8px; height: 100vh; }
#map-wrap { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
#topbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: .88rem; }
#clock { color: var(--accent); font-weight: 700; }
#realclock { color: #9fc3e8; font-weight: 600; cursor: help; }
#where { color: var(--muted); }
#topbar .zoom { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; }
#topbar .zoom button { padding: 2px 10px; }
#version { color: #6b7280; font-size: .75rem; margin-left: 6px; }
#map { flex: 1 1 0; width: 100%; min-height: 0; display: block; image-rendering: pixelated;
  border: 2px solid var(--border); border-radius: 4px; cursor: crosshair; background: #14161a; }
#tooltip { position: absolute; pointer-events: none; background: rgba(20, 22, 26, .94);
  border: 2px solid var(--border); border-radius: 3px; padding: 4px 8px; font-size: .8rem;
  max-width: 260px; z-index: 5; white-space: pre-line; }
#actionbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#actionbar .hint { margin-left: auto; font-size: .78rem; }

#side { flex: 0 0 var(--side); width: var(--side); display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto; min-height: 0; }

/* Charakter und Inventar */
#char-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
#char-portrait { flex: 0 0 48px; height: 48px; cursor: pointer; }
#char-portrait canvas { width: 48px; height: 48px; image-rendering: pixelated; background: #2c3a2a; border: 2px solid #5a4a32;
                        border-radius: 4px; display: block; }
.char-id { flex: 1 1 auto; min-width: 0; }
#char-attrs { font-size: .78rem; }
#inv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 6px; }
.slot { position: relative; aspect-ratio: 1; background: #16181d; border: 2px solid #3a3f48; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot.empty { cursor: default; opacity: .45; }
.slot.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.slot .qty { position: absolute; right: 2px; bottom: 0; font-size: .72rem; font-weight: 700;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; }
#quest-list { margin: 6px 0 0; padding-left: 16px; font-size: .8rem; color: var(--accent); }

/* Personen-Fenster */
#npc-panel { position: relative; }
.npc-head { display: flex; gap: 10px; align-items: center; }
#npc-portrait canvas { width: 64px; height: 64px; background: #2f4a2a; border: 2px solid var(--border); border-radius: 3px; }
#npc-sub { font-size: .8rem; }
#npc-info { font-size: .8rem; white-space: pre-line; margin-top: 4px; }
#npc-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
#npc-buttons button { padding: 5px 8px; }
#npc-goto { margin-top: 6px; }
.close { position: absolute; right: 6px; top: 4px; background: transparent; color: var(--muted);
  font-size: 1.2rem; padding: 0 6px; border: 0; }

/* Chat: klein */
#chat { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
#chat-log { height: 170px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding: 6px 4px 0 0;
  font-size: .82rem; mask-image: linear-gradient(transparent, #000 14px); }   /* oben angeschnittene Zeile blendet aus */
#chat-form { display: flex; gap: 4px; }
#chat-form button { padding: 4px 10px; }
.msg { white-space: pre-wrap; flex: 0 0 auto; overflow-wrap: anywhere; }   /* nicht stauchen: sonst überlappen Nachrichten */
.msg.spieler { color: var(--accent); }
.msg.spieler::before { content: "Du: "; font-weight: 700; }
.msg.spielleiter { color: var(--gm); }
.msg.welt { color: var(--world); font-style: italic; }
.msg.aktion { color: #e9d8b4; }
.msg.system { color: var(--muted); font-size: .78rem; }
.msg .dice { display: inline-block; margin-left: 6px; font-size: .74rem; color: var(--muted); }
.thinking { color: var(--muted); font-style: italic; }

details.panel summary { cursor: pointer; color: var(--muted); font-weight: 700; font-size: .85rem; }
#village-list { font-size: .78rem; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
#village-list .v-name { color: var(--accent); font-weight: 700; }
#event-list { margin: 4px 0 0; padding-left: 16px; font-size: .78rem; color: var(--muted); }

@media (max-width: 900px) {
  #game { flex-direction: column; height: auto; }
  #map { height: 70vh; }
  #side { width: 100%; flex-basis: auto; }
}

/* Weltkarte */
#open-map { margin-left: 6px; }
.wm-panel { position: relative; width: min(1400px, 96vw); height: min(900px, 94vh); display: flex; flex-direction: column; gap: 8px; }
.wm-head { display: flex; align-items: baseline; gap: 14px; padding-right: 30px; }
.wm-body { flex: 1; display: flex; gap: 10px; min-height: 0; }
#wm-canvas { flex: 1; min-width: 0; height: 100%; border: 2px solid var(--border); border-radius: 4px; cursor: crosshair; }
#wm-side { flex: 0 0 220px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
#wm-places { display: flex; flex-direction: column; gap: 6px; }
#wm-places button { text-align: left; }
#wm-info { font-size: .8rem; }

/* Steckbrief */
#npc-sheet { margin-top: 6px; font-size: .78rem; }
#npc-sheet .role { color: var(--accent); white-space: pre-line; margin-bottom: 4px; }
#npc-sheet h4 { margin: 4px 0 2px; font-size: .74rem; color: var(--muted); }
.sheet-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 86px 1fr 26px; gap: 4px; align-items: center; }
.bar { height: 7px; background: #16181d; border: 1px solid #3a3f48; position: relative; }
.bar span { position: absolute; left: 0; top: 0; bottom: 0; background: #6aa0d8; }
.bar.tal span { background: #e8c15a; }
.bar-val { text-align: right; color: var(--muted); }
#npc-sheet .tools { margin-top: 4px; color: var(--text); }

/* Hunger, Gegenstände, Fenster */
#health-row, #hunger-row, #thirst-row { margin-top: 4px; font-size: .78rem; }
.bar.hunger span { background: #d8a04a; }
.bar.health span { background: #d84a4a; }
.bar-row.low { color: #ff8a7a; animation: none; }
#item-actions { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: .8rem; }
#item-actions #item-info { flex: 1; color: var(--muted); }
.modal { position: relative; width: min(760px, 94vw); max-height: 90vh; overflow-y: auto; }
.modal.wide { width: min(1100px, 96vw); }
#recipe-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.recipe { background: #1d2026; border: 2px solid var(--border); border-radius: 4px; padding: 8px; display: flex; gap: 8px; }
.recipe .info { flex: 1; font-size: .8rem; }
.recipe .ok { color: #8fd18f; } .recipe .no { color: var(--error); }
.tech-village h3 { color: var(--accent); margin-top: 10px; }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.tech { border: 2px solid var(--border); border-radius: 4px; padding: 6px 8px; font-size: .78rem; background: #1d2026; }
.tech b { font-size: .86rem; }
.tech.bekannt { border-color: #4a8a4a; }
.tech.in-arbeit { border-color: var(--accent); }
.tech.gesperrt { opacity: .55; }
.tech .st { float: right; font-size: .72rem; color: var(--muted); }
.tech .bar { margin-top: 3px; }
.ideas { font-size: .8rem; color: var(--world); }

/* --- Lager, Bauen, Kontextmenü, Familien (v13) --- */
.store-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .store-cols { grid-template-columns: 1fr; } }
.store-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.store-row .nm { flex: 1; }
.store-row input { width: 64px; }
.store-row canvas { flex: none; }
#ctxmenu { position: absolute; z-index: 20; background: var(--panel); border: 2px solid var(--border); border-radius: 4px;
           padding: 4px; display: flex; flex-direction: column; min-width: 190px; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
#ctxmenu .ctx-head { font-weight: bold; padding: 4px 8px; color: var(--muted); }
#ctxmenu button { text-align: left; margin: 1px 0; }
#build-banner { position: absolute; left: 50%; top: 52px; transform: translateX(-50%); z-index: 15;
                background: rgba(30,22,14,.92); border: 2px solid #c8a050; color: #fff4d6; padding: 6px 12px; border-radius: 4px; }
.build-opt { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.build-opt .nm { flex: 1; }
label.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.fam-village h3 { margin: 12px 0 4px; }
.fam-home { border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; margin: 6px 0; }
.fam-home .who { cursor: pointer; text-decoration: underline dotted; margin-right: 10px; display: inline-block; }
label.check input { width: auto; }

/* --- Mehrspieler (v14) --- */
.tabs { display: flex; gap: 4px; }
.tab { flex: 1; background: #3a4150; color: var(--text); border-bottom-color: #262a33; }
.tab.active { background: var(--accent); color: #222; border-bottom-color: #a8862e; }
#chat-mode { background: #16181d; color: var(--text); border: 2px solid var(--border); border-radius: 3px; font: inherit; }
.msg.mitspieler { color: #f4f0e6; }
.msg.mitspieler b { color: #9ad0ff; }
.msg.info { color: var(--muted); font-style: italic; font-size: .8rem; }
.msg.wurf { color: #f0d048; }
#online ul { list-style: none; margin: 4px 0 0; padding: 0; max-height: 120px; overflow-y: auto;
  mask-image: linear-gradient(#000 calc(100% - 12px), transparent); }
#online li { padding: 1px 0; cursor: pointer; }
#online li::before { content: "● "; color: #6ad86a; }
#online li.bot { color: var(--muted); }
#online li.bot::before { color: #8aa0b8; }
#online li.me { color: var(--accent); }
#conn-banner { position: absolute; left: 50%; top: 90px; transform: translateX(-50%); z-index: 16;
               background: #7a2a20; color: #fff; padding: 6px 14px; border-radius: 4px; border: 2px solid #c04a3a; }

/* --- Durst, Krankheit (v16) --- */
.bar.thirst span { background: linear-gradient(90deg, #4aa0e0, #2a6ab0); }
#sick-row { color: #d8c060; font-size: .8rem; margin: 2px 0 4px; }

/* --- Wissensbaum (v16) --- */
.tech-tabs { flex-wrap: wrap; margin: 6px 0 8px; }
.tech-tabs .tab { flex: 0 0 auto; }
.tech-head { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; margin-bottom: 6px; }
.tech-legend { display: flex; gap: 10px; font-size: .75rem; margin: 4px 0 6px; flex-wrap: wrap; }
.tech-legend .lg { padding: 1px 8px; border-radius: 3px; border: 2px solid; }
.tree-wrap { overflow: auto; max-height: 58vh; background: #15171b; border: 2px solid var(--border); border-radius: 4px;
             padding: 6px; background-image: radial-gradient(#22262d 1px, transparent 1px); background-size: 16px 16px; }
.tree { position: relative; }
.tree svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.tree .edge { fill: none; stroke-width: 3; }
.tree .edge.done { stroke: #5aa04a; }
.tree .edge.half { stroke: #6a7a5a; stroke-dasharray: 6 4; }
.tree .edge.open { stroke: #3e434c; stroke-dasharray: 3 5; }
.tnode { position: absolute; width: 172px; height: 54px; border: 3px solid; border-radius: 6px; padding: 5px 8px;
         display: flex; flex-direction: column; justify-content: center; gap: 2px; cursor: help;
         box-shadow: 0 3px 0 rgba(0,0,0,.45); transition: transform .08s; }
.tnode:hover { transform: translateY(-2px); box-shadow: 0 6px 10px rgba(0,0,0,.5); z-index: 2; }
.tnode b { font-size: .86rem; line-height: 1.1; }
.tnode .tstat { font-size: .7rem; opacity: .85; }
.tnode .tprog { display: block; height: 5px; background: #2a2010; border-radius: 2px; overflow: hidden; }
.tnode .tprog span { display: block; height: 100%; background: #f0c84a; }
.bekannt { background: #1f3a22; border-color: #5aa04a; color: #d8f4cc; }
.in-arbeit { background: #3a3014; border-color: #f0c84a; color: #fff0c0; animation: glow 2s ease-in-out infinite; }
.moeglich { background: #1e2a3a; border-color: #6a9ad8; color: #d6e6fa; }
.gesperrt { background: #202226; border-color: #3e434c; color: #7c828c; }
.lg.bekannt, .lg.in-arbeit, .lg.moeglich, .lg.gesperrt { animation: none; }
@keyframes glow { 50% { box-shadow: 0 0 14px rgba(240,200,74,.55), 0 3px 0 rgba(0,0,0,.45); } }

/* Info-Fenster (Maus über Erfindung / Talent / Anlage) */
#info-tip { position: fixed; z-index: 50; max-width: 340px; background: #1b1d22; border: 2px solid #c8a050;
            border-radius: 5px; padding: 8px 10px; font-size: .8rem; line-height: 1.35; pointer-events: none;
            box-shadow: 0 6px 18px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 3px; }
#info-tip .tip-title { font-weight: 700; font-size: .92rem; color: var(--accent); }
#info-tip .tip-status { font-size: .74rem; padding: 0 6px; border-radius: 3px; border: 1px solid; align-self: flex-start; animation: none; }
#info-tip .tip-desc { font-style: italic; color: #d8d2c4; }
#info-tip .tip-hint { color: var(--muted); font-size: .74rem; }
#info-tip b { color: #e8dcc0; }
.has-tip { cursor: help; }
.has-tip:hover { background: rgba(255,255,255,.04); }
button.small { padding: 2px 8px; font-size: .74rem; margin-top: 4px; }
.tech-help summary { cursor: pointer; font-size: .85rem; margin: 2px 0 4px; }

/* --- Können, Ausdauer, Buffs, Kochen (v17) --- */
.bar.stamina span { background: linear-gradient(90deg, #8a7ab8, #b05ac0); }   /* Erschöpfung steigt */
#stamina-row { margin-top: 4px; font-size: .78rem; }
#buff-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.buff { font-size: .72rem; padding: 1px 6px; border-radius: 9px; background: #2e3a24; border: 1px solid #6aa04a; color: #d8f0c0; cursor: help; }
.buff.satt { background: #3a3020; border-color: #c8a050; color: #f4e0b0; }
.buff.erfrischt { background: #1e3040; border-color: #5aa0d8; color: #cfe6fa; }
.buff.warm { background: #402418; border-color: #d8703a; color: #fad8c0; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #c0392b; color: #fff; font-size: .72rem; margin-left: 3px; }
.skills-layout { display: grid; grid-template-columns: 250px 1fr; gap: 12px; min-height: 420px; }
@media (max-width: 760px) { .skills-layout { grid-template-columns: 1fr; } }
#skill-list { display: flex; flex-direction: column; gap: 3px; max-height: 62vh; overflow-y: auto; }
.sk-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; padding: 5px 8px; border: 2px solid var(--border);
           border-radius: 4px; cursor: pointer; background: #1d2026; }
.sk-item.active { border-color: var(--accent); background: #2a2618; }
.sk-item .lv { font-size: .72rem; color: var(--muted); }
.sk-item .bar { grid-column: 1 / 3; }
.sk-item .pts { color: #fff; background: #c0392b; border-radius: 8px; padding: 0 5px; font-size: .72rem; align-self: center; }
#skill-tree { background: #15171b; border: 2px solid var(--border); border-radius: 4px; padding: 10px; overflow: auto;
              background-image: radial-gradient(#22262d 1px, transparent 1px); background-size: 16px 16px; }
.sk-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sk-head h3 { color: var(--accent); margin: 0; }
.sk-rank { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; position: relative; }
.sk-rank .rn { width: 92px; font-size: .72rem; color: var(--muted); text-align: right; }
.sk-rank .opts { display: flex; gap: 10px; flex: 1; }
.sk-rank .or { font-size: .72rem; color: var(--muted); align-self: center; }
.sk-link { margin-left: 100px; height: 14px; border-left: 3px dotted #3e434c; width: 0; transform: translateX(80px); }
.sk-link.done { border-left: 3px solid #5aa04a; }
.perk { width: 190px; min-height: 52px; border: 3px solid; border-radius: 6px; padding: 5px 8px; cursor: help;
        display: flex; flex-direction: column; gap: 2px; box-shadow: 0 3px 0 rgba(0,0,0,.45); font-size: .78rem; }
.perk b { font-size: .84rem; }
.perk.gewaehlt { background: #1f3a22; border-color: #5aa04a; color: #d8f4cc; }
.perk.waehlbar { background: #3a3014; border-color: #f0c84a; color: #fff0c0; cursor: pointer; animation: glow 2s ease-in-out infinite; }
.perk.gesperrt { background: #202226; border-color: #3e434c; color: #7c828c; }
.perk .eff { font-size: .7rem; opacity: .9; }
.recipe .buffs { font-size: .74rem; color: #c8e0a8; }

.info { color: #9ad89a; min-height: 0; }

/* ======================================================================================================
   Handy und Tablet (v20) – Desktop bleibt unverändert. Umgeschaltet wird per Media Query, nicht per Browserkennung.
   ====================================================================================================== */
.mobile-only { display: none !important; }
#map { touch-action: none; }                        /* Karte: eigene Gesten (ziehen, Pinch, langes Drücken) */
html, body { overscroll-behavior: none; }

/* Touch-Geräte: große Tippflächen, keine Maus-Hinweise */
@media (pointer: coarse) {
  button, select, input, .tab, .sk-item, #ctxmenu button, #online li, .slot { min-height: 44px; }
  input, select, textarea { font-size: 16px; }      /* verhindert das Auto-Zoomen von iOS beim Tippen */
  #actionbar .hint, #tooltip { display: none !important; }
}

@media (max-width: 800px), (max-height: 500px) and (pointer: coarse) {
  :root { --tabbar: 58px; --actionbar: 56px; --kb: 0px; }
  .mobile-only { display: revert !important; }
  .mobile-only.hidden { display: none !important; }
  body { overflow: hidden; }
  #game { display: flex; flex-direction: column; gap: 0; padding: 0; height: 100dvh; width: 100vw; overflow: hidden; }
  #map-wrap { flex: 1 1 auto; gap: 0; min-height: 0; }

  /* Kopfleiste: schlank – Zeit, drei Mini-Balken, Menü */
  #topbar { flex-wrap: nowrap; gap: 8px; padding: 4px 8px; padding-top: max(4px, env(safe-area-inset-top));
            background: var(--panel); border-bottom: 1px solid var(--border); font-size: .8rem; min-height: 44px; }
  #topbar #realclock, #topbar #where, #topbar #ai-status, #topbar .zoom { display: none; }
  #clock { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
  #mbars { display: flex !important; flex-direction: column; gap: 3px; width: 72px; flex: 0 0 auto; }
  .mb { display: block; height: 6px; background: #16181d; border: 1px solid #3a3f48; border-radius: 2px; overflow: hidden; }
  .mb i { display: block; height: 100%; width: 0; }
  .mb.health i { background: #d84a4a; } .mb.hunger i { background: #d8a04a; } .mb.thirst i { background: #4aa0e0; } .mb.stamina i { background: #a06ac0; }
  #menu-btn { flex: 0 0 44px; padding: 0; font-size: 1.2rem; }

  /* Karte füllt alles */
  #map { border: 0; border-radius: 0; flex: 1 1 0; }
  #center-btn { position: absolute; right: 12px; bottom: calc(var(--actionbar) + 12px); z-index: 6; width: 52px; height: 52px;
                border-radius: 50%; font-size: 1.4rem; padding: 0; box-shadow: 0 3px 10px rgba(0,0,0,.5); }
  #build-banner { top: 52px; width: calc(100vw - 24px); font-size: .8rem; }
  #conn-banner { top: 56px; }

  /* Aktionen: feste Leiste, waagerecht wischbar (kein Seiten-Scrollen) */
  #actionbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 6px 8px; height: var(--actionbar);
               background: var(--panel); border-top: 1px solid var(--border); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #actionbar::-webkit-scrollbar { display: none; }
  #actionbar button { flex: 0 0 auto; min-height: 44px; white-space: nowrap; }
  #actionbar .hint { display: none; }

  /* Untere Tab-Leiste */
  #tabbar { display: flex !important; flex: 0 0 var(--tabbar); background: #1b1d22; border-top: 2px solid var(--border);
            padding-bottom: env(safe-area-inset-bottom); }
  #tabbar button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
                   background: transparent; color: var(--muted); border: 0; border-radius: 0; font-size: 1.15rem; padding: 2px 0;
                   min-height: 52px; position: relative; }
  #tabbar button span { font-size: .66rem; font-weight: 600; }
  #tabbar button.active { color: var(--accent); background: #26231a; box-shadow: inset 0 3px 0 var(--accent); }
  #tabbar .badge { position: absolute; top: 4px; right: calc(50% - 22px); }

  /* Seitenleiste wird zum ausfahrbaren Bereich über der Karte – immer nur ein Abschnitt */
  #side { position: fixed; left: 0; right: 0; width: auto; z-index: 8; gap: 0;
          bottom: calc(var(--tabbar) + var(--actionbar) + env(safe-area-inset-bottom) + var(--kb));
          max-height: min(62dvh, calc(100dvh - 120px)); overflow-y: auto; background: var(--bg);
          border-top: 2px solid var(--accent); box-shadow: 0 -8px 24px rgba(0,0,0,.55); display: none; }
  body.sheet-open #side { display: flex; }
  #right-col { display: contents; }
  .desktop-only { display: none !important; }
  #side > :not(#right-col), #right-col > * { display: none !important; border-radius: 0; border-left: 0; border-right: 0; }
  body[data-tab="inv"] #side > #char,
  body[data-tab="chat"] #side > #chat,
  body[data-tab="dorf"] #side > #villages, body[data-tab="dorf"] #side > #events,
  body[data-tab="online"] #right-col > #online, body[data-tab="dorf"] #right-col > #letters,
  body[data-tab="person"] #right-col > #npc-panel,
  body[data-tab="mehr"] #side > #more-sheet { display: block !important; }
  body[data-tab="chat"] #side { height: min(62dvh, calc(100dvh - 120px)); }
  body[data-tab="chat"] #side > #chat { display: flex !important; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  #chat-log { flex: 1 1 auto; height: auto; min-height: 120px; }
  #chat-form { position: sticky; bottom: 0; background: var(--panel); padding-top: 4px; }
  #chat-form input { min-height: 44px; }
  .more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
  .more-grid button { min-height: 48px; }
  #inv-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 66px)); justify-content: start; }

  /* Tastatur offen (Chat): Aktions- und Tab-Leiste weg, Eingabe direkt über der Tastatur */
  body.kb-open #actionbar, body.kb-open #tabbar { display: none !important; }
  body.kb-open #side { bottom: var(--kb); max-height: calc(100dvh - var(--kb) - 50px); height: calc(100dvh - var(--kb) - 50px); }

  /* Fenster (Können, Wissen, Lager, Kochen …) bildschirmfüllend */
  .overlay { padding: 0; align-items: stretch; }
  .modal, .modal.wide, .wm-panel { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0;
                                   border: 0; overflow-y: auto; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .modal .close, .wm-head .close { width: 44px; height: 44px; font-size: 1.6rem; top: 6px; right: 6px; }
  .skills-layout { grid-template-columns: 1fr; }
  #skill-list { flex-direction: row; overflow-x: auto; max-height: none; }
  .sk-item { flex: 0 0 160px; }
  .perk { width: 100%; }
  .sk-rank { flex-direction: column; align-items: stretch; gap: 4px; }
  .sk-rank .rn { width: auto; text-align: left; }
  .sk-rank .opts { flex-direction: column; }
  .sk-link { display: none; }
  .tree-wrap { max-height: none; }
  .store-cols { grid-template-columns: 1fr; }
  .store-row input { width: 64px; min-height: 44px; }
  #ctxmenu { min-width: 220px; max-width: calc(100vw - 16px); }
  #login-form { max-width: none; }
  #login { padding: 12px; }
  .perk .pdesc { display: block; font-size: .72rem; opacity: .85; font-style: italic; }
}
.perk .pdesc { display: none; }
/* Handy quer: niedrige Leisten, Tab-Beschriftung weg */
@media (max-height: 500px) and (pointer: coarse) {
  :root { --tabbar: 46px; --actionbar: 52px; }
  #tabbar button span { display: none; }
  #tabbar button { min-height: 44px; }
  #side { max-height: calc(100dvh - 60px); }
}
a { color: var(--accent); }
#actionbar button.feature-off { display: none !important; }   /* Wirtschaft ausgeschaltet: Knopf gibt es nicht */

/* Tod / Name der Figur */
#figure-form { width: min(460px, 94vw); display: flex; flex-direction: column; gap: 8px; }
#figure-form label { display: flex; flex-direction: column; gap: 4px; }
#figure-form .row { display: flex; gap: 8px; }
#figure { z-index: 60; background: rgba(8, 6, 10, .78); }
#char-name.renamable { cursor: pointer; text-decoration: underline dotted; }
#char-name.renamable::after { content: " ✎"; font-size: .8em; color: var(--muted); }

/* Dörfer: Verhältnis zueinander */
.v-rel { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.rel { font-size: .72rem; padding: 0 5px; border-radius: 3px; border: 1px solid #4a4f58; }
.rel.befreundet { color: #8ae07a; border-color: #4a8a3a; } .rel.freundlich { color: #b8e0a0; }
.rel.gespannt { color: #f0b860; border-color: #8a6a2a; } .rel.verfeindet { color: #ff7a6a; border-color: #8a3a2a; }

/* Talentbaum: Spezialisierungen nebeneinander */
.sk-branch-head { margin: 10px 0 6px; color: var(--accent); font-weight: 700; font-size: .86rem; border-top: 1px dashed var(--border); padding-top: 8px; }
.sk-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.sk-branch { border: 2px solid var(--border); border-radius: 6px; padding: 6px; background: #1b1d22; }
.sk-branch h4 { margin: 0 0 2px; color: #e9d8b4; }
.sk-branch > p { margin: 0 0 6px; font-size: .74rem; }
.sk-branch.chosen { border-color: var(--accent); background: #26231a; }
.sk-branch.closed { opacity: .45; filter: grayscale(.7); }
.sk-branch .sk-rank { flex-direction: column; align-items: stretch; gap: 3px; }
.sk-branch .sk-rank .rn { width: auto; text-align: left; }
.sk-branch .opts { flex-wrap: wrap; }

/* Steckbrief der eigenen Figur */
#profile .modal { width: min(920px, 96vw); }
.prof-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
#prof-portrait canvas { width: 128px; height: 128px; image-rendering: pixelated; background: radial-gradient(#3a5236, #1e2a1c);
                        border: 3px solid #5a4a32; border-radius: 6px; display: block; }
.prof-id { flex: 1; min-width: 0; }
.prof-id h2 { font-size: 1.4rem; }
#prof-desc { margin: 4px 0 8px; font-style: italic; color: #d8cfb8; }
#prof-status { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; max-width: 520px; font-size: .8rem; }
#prof-status .prof-note { grid-column: 1 / -1; }
.prof-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.prof-cols h3 { color: var(--accent); font-size: .95rem; margin: 6px 0; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.prof-attr { background: #1b1d22; border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; margin-bottom: 6px; font-size: .82rem; }
.prof-attr p { margin: 2px 0; }
.pa-head { display: flex; justify-content: space-between; font-size: .95rem; }
.pa-val { color: var(--accent); font-weight: 700; }
.pa-how { color: #b8d0a0; }
.pa-prog { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; font-size: .74rem; margin-top: 3px; }
.prof-skill { font-size: .85rem; padding: 3px 0; border-bottom: 1px dashed #30343c; }
.prof-skill .badge { margin-left: 6px; }
.small { font-size: .76rem; }
@media (max-width: 800px) { .prof-cols { grid-template-columns: 1fr; } #prof-status { grid-template-columns: 1fr; } }

/* ======================================================================================================
   Desktop: eingerahmte Karte über das ganze Fenster, Bedienung schwebt darüber (wie am Handy)
     oben links  Figur (aufklappbar: Gepäck; ℹ = Steckbrief)     oben Mitte  Zeit, Ort, Menüs
     oben rechts Minikarte, Online, Person                        unten links Aktionen (einklappbar)
     unten rechts Chat und Geschehen
   ====================================================================================================== */
@media (min-width: 801px) and (min-height: 501px), (min-width: 801px) and (pointer: fine) {
  :root { --frame: 10px; --pad: 10px; --float: rgba(24, 25, 30, .93); --edge: #5a4a32; }
  body { overflow: hidden; }
  #game { position: relative; display: block; padding: 0; width: 100vw; height: 100vh; overflow: hidden; background: #0d0e11; }
  #map-wrap { position: absolute; inset: 0; display: block; }
  #map { position: absolute; left: var(--frame); top: var(--frame); width: calc(100% - 2 * var(--frame));
         height: calc(100% - 2 * var(--frame)); border: 0; border-radius: 6px; }
  /* Rahmen: dunkles Holz mit Messingkante, innen leichte Vignette */
  #map-wrap::after { content: ""; position: absolute; inset: calc(var(--frame) - 6px); pointer-events: none; z-index: 2;
    border: 6px solid #3a2a18; border-radius: 10px;
    box-shadow: inset 0 0 0 2px #9a7840, inset 0 0 0 3px #1c140a, inset 0 0 60px rgba(0, 0, 0, .45), 0 0 0 1px #000; }
  .float, #char, #right-col > .panel, #chat, #actionbar, #topbar, #villages {
    background: var(--float); border: 2px solid var(--edge); border-radius: 6px; box-shadow: 0 4px 18px rgba(0, 0, 0, .5); }

  /* oben Mitte: Zeit und Menüs */
  #topbar { position: absolute; z-index: 4; top: calc(var(--frame) + var(--pad)); left: 50%; transform: translateX(-50%);
            width: max-content; max-width: calc(100vw - 2 * 300px - 6 * var(--pad)); justify-content: center; gap: 2px 12px; padding: 5px 10px;
            font-size: .8rem; }
  #topbar .zoom { flex-basis: 100%; margin: 0; justify-content: center; flex-wrap: wrap; gap: 4px; }
  #topbar .zoom button { padding: 2px 8px; font-size: .78rem; border-bottom-width: 2px; }
  #ai-status { display: none; }

  /* oben links: Figur */
  #side { display: contents; }
  #char { position: absolute; z-index: 4; top: calc(var(--frame) + var(--pad)); left: calc(var(--frame) + var(--pad));
          width: 290px; max-height: calc(100vh - 2 * var(--frame) - 3 * var(--pad) - var(--act-h, 120px)); overflow-y: auto; }
  #char-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
  #char-portrait { flex: 0 0 52px; height: 52px; cursor: pointer; }
  #char-portrait canvas { width: 52px; height: 52px; image-rendering: pixelated; background: #2c3a2a; border: 2px solid var(--edge);
                          border-radius: 4px; display: block; }
  .char-id { flex: 1 1 auto; min-width: 0; }
  .char-id h2 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #char-attrs { font-size: .72rem; }
  button.icon { padding: 2px 7px; font-size: .9rem; line-height: 1.2; border-bottom-width: 2px; }
  #char.collapsed #char-more { display: none; }
  #char.collapsed #char-toggle { opacity: .6; }
  .bar-row { font-size: .74rem; grid-template-columns: 78px 1fr 26px; }
  #inv-grid { grid-template-columns: repeat(6, 1fr); }

  /* oben rechts: Minikarte, Online, Person */
  #right-col { position: absolute; z-index: 4; top: calc(var(--frame) + var(--pad)); right: calc(var(--frame) + var(--pad));
               width: 260px; display: flex; flex-direction: column; gap: 8px;
               max-height: calc(100vh - 2 * var(--frame) - 3 * var(--pad) - var(--chat-h, 290px)); overflow-y: auto; }
  #minimap-panel { padding: 4px; }
  #minimap { display: block; width: 100%; height: 180px; cursor: pointer; border-radius: 3px; }
  #online ul { max-height: 96px; }
  #online li { font-size: .82rem; }
  #npc-panel { flex: 0 0 auto; }
  #npc-buttons button { font-size: .78rem; padding: 4px 7px; }

  /* Dörfer: Menü klappt unter der Kopfleiste auf */
  #villages { position: absolute; z-index: 5; top: calc(var(--frame) + var(--pad) + 62px); left: 50%; transform: translateX(-50%);
              width: min(460px, calc(100vw - 2 * 300px - 6 * var(--pad))); max-height: 60vh; overflow-y: auto; display: none; }
  body.show-villages #villages { display: block; }
  #villages summary { pointer-events: none; list-style: none; }
  #events { display: none; }

  /* unten rechts: Chat und Geschehen */
  #chat { position: absolute; z-index: 4; bottom: calc(var(--frame) + var(--pad)); right: calc(var(--frame) + var(--pad));
          width: 400px; height: var(--chat-h, 290px); padding: 6px 8px; gap: 4px; }
  #chat-head { display: flex; align-items: center; gap: 6px; }
  .chat-tabs { display: inline-flex; gap: 2px; flex: 1; }
  .chat-tabs button { background: transparent; color: var(--muted); border: 0; padding: 2px 8px; font-size: .76rem; border-radius: 3px; }
  .chat-tabs button.active { background: #3a3424; color: var(--accent); }
  #chat-log { flex: 1 1 auto; height: auto; min-height: 0; font-size: .8rem; gap: 3px; }
  #chat.collapsed { height: auto; }
  #chat.collapsed #chat-log { display: none; }
  #chat-log .msg { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: default; }
  #chat-log .msg.long { cursor: pointer; }
  #chat-log .msg.open { display: block; }
  #chat-log[data-filter="chat"] .msg:not(.mitspieler):not(.spieler):not(.spielleiter):not(.info) { display: none; }
  #chat-log[data-filter="welt"] .msg:not(.welt):not(.ereignis):not(.wurf):not(.aktion) { display: none; }
  .msg.ereignis { color: #c8b48a; font-size: .76rem; }
  .msg.ereignis::before { content: "◆ "; color: #8a7a5a; }

  /* unten links: Aktionen – feste Plätze, nichts springt; was gerade nicht geht, ist nur ausgegraut */
  #actionbar { position: absolute; z-index: 4; bottom: calc(var(--frame) + var(--pad)); left: calc(var(--frame) + var(--pad));
               width: 330px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; }
  #act-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; color: var(--muted);
              font-size: .76rem; font-weight: 700; padding: 0 2px; }
  #actionbar button:not(.icon) { font-size: .74rem; padding: 4px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                                 border-bottom-width: 2px; }
  #actionbar button:disabled { opacity: .32; cursor: not-allowed; filter: grayscale(.6); }
  #actionbar button.hidden { display: block !important; visibility: visible; }
  #actionbar button.ctx-off { display: none !important; }
  #actionbar button.feature-off { display: none !important; }
  #actionbar .hint { display: none; }
  #actionbar.collapsed > button { display: none !important; }
  #build-banner { top: auto; bottom: calc(var(--frame) + var(--pad) + 8px); }
}

#load-row { margin-top: 4px; font-size: .78rem; }
.bar.load span { background: #c8a050; }
.slot.drop { border-color: #6ac46a; }
.pet-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pet-buttons button { font-size: .78rem; padding: 4px 8px; }

.recipe-head { grid-column: 1 / -1; margin: 10px 0 4px; color: var(--accent); }

#equip-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin: 6px 0 2px; }
.eq-slot { aspect-ratio: 1; border: 2px solid #4a4030; border-radius: 4px; background: #1a1712; display: flex; align-items: center;
           justify-content: center; cursor: pointer; }
.eq-slot.empty { cursor: default; opacity: .55; font-size: .62rem; color: var(--muted); }
.look-row { display: flex; gap: 12px; align-items: flex-start; }
#look-preview canvas { width: 96px; height: 96px; image-rendering: pixelated; background: radial-gradient(#3a5236, #1e2a1c);
                       border: 2px solid #5a4a32; border-radius: 6px; }
.look-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; flex: 1; }
.look-fields label { font-size: .82rem; }
.look-fields select { width: 100%; }
.look-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.look-mini label { display: flex; flex-direction: column; font-size: .82rem; }

#minimap-panel { position: relative; }
#report-btn { position: absolute; top: 6px; left: 6px; z-index: 2; width: 32px; height: 32px; padding: 0; font-size: 18px;
  background: #2a2e36; border: 2px solid var(--border); border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
#report-btn:hover { background: var(--accent); }
#report-text { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; background: #1b1e24; color: inherit;
  border: 1px solid var(--border); border-radius: 6px; padding: 6px; }
.report-row { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 4px; }
#report-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.report { border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: #1f2229; }
.report .rh { font-size: .78rem; color: var(--muted); }
.report .rt { white-space: pre-wrap; margin-top: 2px; }
.report .rn { white-space: pre-wrap; margin-top: 4px; font-size: .85rem; color: #9fd08a; }
.report .st { font-weight: bold; margin-right: 6px; }
.report.offen .st { color: #e8c050; } .report.behoben .st { color: #7ad070; }
.report.unklar .st { color: #e09a50; } .report.abgelehnt .st { color: var(--muted); }
.report.behoben .rt { opacity: .7; }
.sub-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; border-bottom: 2px solid var(--border); padding-bottom: 6px; }
.sub-tabs button { background: #2a2e36; color: var(--muted); border-bottom-width: 2px; font-size: .8rem; padding: 4px 10px; }
.sub-tabs button.active { background: var(--accent); color: #222; }
.qty-in { width: 64px; margin-right: 6px; }

#letters-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; max-height: 260px; overflow-y: auto; }
.letter { background: #2e2818; border: 1px solid #6a5a32; border-radius: 4px; padding: 6px 8px; font-size: .78rem;
          box-shadow: inset 0 0 12px rgba(0,0,0,.25); }
.letter.new { border-color: var(--accent); }
.letter.mine { border-color: #6ac46a; }
.letter .from { color: var(--accent); font-weight: 700; }
.letter .why { font-style: italic; color: #d8cfb8; margin: 2px 0; }
.letter .row { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.letter .row button { font-size: .72rem; padding: 2px 8px; }

/* Berufe & Lehre (Wirtschaft) */
.sk-item.sk-berufe { border-style: dashed; }
.bf-area { display: grid; gap: 3px; margin-bottom: 8px; }
.bf-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bf-row .lv, .small { font-size: .78rem; }
.bf-jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 10px; }
.bf-job { display: grid; gap: 4px; padding: 6px 8px; border: 2px solid var(--border); border-radius: 4px; }
.bf-job.open { border-color: var(--accent); }
.bf-job.mine { border-color: #4caf50; }
.bf-job.soon { opacity: .55; }
.bf-job .no { color: #e57373; }
.bf-recipe.locked { opacity: .6; }
.bf-btns { display: flex; flex-direction: column; gap: 4px; }
.bf-done { opacity: .8; }
.bf-lager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bf-lager .bf-row { align-items: center; padding: 2px 0; border-bottom: 1px solid var(--border); }
.bf-lager button { padding: 2px 8px; }
@media (max-width: 560px) { .bf-lager { grid-template-columns: 1fr; } }
.recipe .bar, .bf-area .bar, .bf-job .bar { display: block; margin: 4px 0; }
.bf-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 6px 0 12px; }
.bf-field { display: grid; gap: 2px; }
.bf-field input, .bf-field select { min-width: 0; max-width: 100%; }
.bf-field input[type=number] { width: 80px; }
#brett-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
#brett-tabs .tab { padding: 4px 10px; }
#brett-tabs .tab.active { background: var(--accent); color: #111; }
@media (max-width: 560px) { .bf-form { flex-direction: column; align-items: stretch; } }
#actionbar button.far { opacity: .45; filter: grayscale(.6); }


/* ======================================================================================================
   Neue Bedienung (features.mobil_ui) und Beruf-Seite (features.berufe)
   ====================================================================================================== */
#side-back { display: none; }
body:not(.mobil-ui) .neu-only, body.mobil-ui .alt-only, body:not(.berufe-an) .berufe-only { display: none !important; }
body.mobil-ui #map { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.mobil-ui #ctxmenu button { min-height: 44px; font-size: 16px; text-align: left; }
body.mobil-ui #ctxmenu .ctx-head { font-size: 16px; }
#ctxmenu.sheet { position: fixed; left: 0; right: 0; top: auto !important; max-width: none; width: 100%; z-index: 40;
                 bottom: calc(var(--tabbar, 0px) + var(--actionbar, 0px) + env(safe-area-inset-bottom));
                 display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 14px; border-radius: 12px 12px 0 0;
                 border-top: 2px solid var(--accent); box-shadow: 0 -8px 24px rgba(0,0,0,.6); }
#ctxmenu.sheet.hidden { display: none; }
#ctxmenu.sheet button { min-height: 48px; width: 100%; }
@media (max-width: 800px), (max-height: 500px) and (pointer: coarse) {
  /* ganze Seiten statt kleiner Fenster: Inventar, Chat, Dörfer … über der Karte, Schnellleiste bleibt unten */
  body.mobil-ui.sheet-open #side { top: 0; max-height: none; height: auto;
                                   bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--kb)); border-top: 0; }
  body.mobil-ui.sheet-open #side > #side-back { display: block !important; position: sticky; top: 0; z-index: 2; width: 100%;
                                                min-height: 48px; font-size: 16px; text-align: left; border-radius: 0; }
  body.mobil-ui #tabbar button { font-size: 1.35rem; min-height: 56px; }
  body.mobil-ui #tabbar button span { font-size: .75rem; }
  body.mobil-ui #actionbar button { min-height: 48px; font-size: 15px; }
  #beruf .modal h2 .back { margin-right: 6px; min-height: 44px; font-size: 16px; }
  #beruf .modal > .close { display: none; }
  #beruf-body button.big { width: 100%; }
}
#beruf .modal { display: flex; flex-direction: column; gap: 8px; }
#beruf h2 { display: flex; align-items: center; gap: 6px; }
#beruf h3 { color: var(--accent); margin: 12px 0 4px; font-size: 1.05rem; }
#beruf h4 { color: #e9d8b4; margin: 10px 0 4px; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.bf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bf-chips button { min-height: 44px; font-size: 15px; }
.bf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.bf-card { display: flex; flex-direction: column; gap: 4px; background: #1b1d22; border: 2px solid var(--border);
           border-radius: 6px; padding: 8px; font-size: 15px; }
.bf-card p { margin: 0; }
.bf-card.mine { border-color: var(--accent); background: #26231a; }
.bf-card.open { border-color: #4a8a3a; }
.bf-card.soon { opacity: .55; }
.bf-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.bf-skill { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: #1b1d22;
            border: 1px solid var(--border); border-radius: 6px; padding: 8px; margin-bottom: 6px; font-size: 15px; }
.bf-skill .info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.bf-skill.mine { border-color: var(--accent); }
.bf-skill.open { border-color: #4a8a3a; }
.bf-skill.locked { opacity: .7; }
.bf-skill button { flex: 0 0 auto; }
button.big { min-height: 44px; font-size: 15px; }
.bf-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bf-form input { width: 90px; min-height: 44px; font-size: 16px; }
p.warn, #beruf-note { color: #f0b860; margin: 4px 0; }
.small.no, span.no { color: #ff8a7a; }
.small.ok, span.ok { color: #9ad07a; }

/* Steuerkreuz/Tastatur (Konsolen-Browser, Fernseher): deutlich sichtbar, welcher Knopf gewählt ist */
button:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 6px rgba(233, 196, 96, .25); }

/* Verwaltung (Admins/Moderatoren) */
body:not(.verwaltung-an) .verwaltung-only { display: none !important; }
#verwaltung .modal { display: flex; flex-direction: column; gap: 8px; }
#verwaltung h2 { display: flex; align-items: center; gap: 6px; }
.vw-search, .vw-mail { min-height: 44px; font-size: 16px; flex: 1 1 220px; }
.vw-amount { width: 80px; min-height: 44px; font-size: 16px; }
.vw-icon canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.vw-link-box { width: min(560px, 96vw); display: flex; flex-direction: column; gap: 8px; }
#vw-link-text { width: 100%; font-size: 15px; padding: 8px; background: #1b1d22; color: var(--fg, #eee); border: 2px solid var(--accent);
                border-radius: 6px; resize: none; word-break: break-all; }
#vw-link { z-index: 70; }

/* Bildschirm-Stick (Handy, neue Bedienung): links unten über der Karte, mit dem Daumen erreichbar */
#stick-base { display: none; position: absolute; left: 14px; bottom: calc(var(--actionbar, 56px) + 14px); width: 112px; height: 112px;
              border-radius: 50%; background: rgba(16, 18, 22, .38); border: 2px solid rgba(233, 196, 96, .55); z-index: 6;
              touch-action: none; -webkit-user-select: none; user-select: none; }
#stick-base.active { background: rgba(16, 18, 22, .55); border-color: var(--accent); }
#stick-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
              background: rgba(233, 196, 96, .85); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); pointer-events: none; }
@media (pointer: coarse) { body.mobil-ui #stick-base { display: block; } }
@media (max-height: 500px) and (pointer: coarse) { #stick-base { width: 96px; height: 96px; } }

#actionbar button.job-on { box-shadow: inset 0 0 0 2px #9ad07a; }
