@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700&family=Nunito:wght@400;600&display=swap');

/* =====================================================
   RESET / BASE
===================================================== */

:root {
    --hud-bottom-height: 88px; /* ggf. anpassen */
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 12px;
    --space-lg: 16px;
    --control-height: 40px;
    --control-height-sm: 32px;
    --control-radius: 10px;
    --glass-blur: 12px;
    --glass-inset: inset 0 1px 0 var(--border-soft-3);
    --border-width: 1px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --city-perspective-min-scale: 0.95;
    --city-perspective-max-scale: 2.25;
    --city-perspective-curve: 1.1;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: "Nunito", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

.ui-title {
    font-family: "Baloo 2", cursive;
}

.ui-text {
    font-family: "Nunito", sans-serif;
}

/* Helpers */
.muted { opacity: 0.75; }
.small-note { font-size: 0.85rem; margin-top: 6px; }

body {
/*  background-image: url("/assets/images/background.png"); */
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
}
@media (orientation: portrait) {
  body {
    background-size: auto 100vh;
  }
}
@media (orientation: landscape) {
  body {
    background-size: 100vw auto;
  }
}



/* =====================================================
   APP LAYOUT
===================================================== */

#game-wrapper {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
}

body.sd-has-global-header #game-wrapper {
    height: calc(100dvh - 44px);
    min-height: calc(100dvh - 44px);
}

@media (max-width: 760px) {
    body.sd-has-global-header #game-wrapper {
        height: calc(100dvh - 46px);
        min-height: calc(100dvh - 46px);
    }
}

#game-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    padding-bottom: calc(var(--hud-bottom-height) + 32px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 560px) {
    #game-content {
        padding-bottom: calc(var(--hud-bottom-height) + 96px + env(safe-area-inset-bottom, 0px));
    }
}

/* =====================================================
   GLASS SYSTEM
===================================================== */

:is(
    .card,
    .dialog-box,
    .market-filters-wrap,
    .switch-track,
    .message-card,
    .messages-card,
    .thread-row,
    .message-bubble,
    .profile-pic,
    #hud-bottom,
    #hudResources .hud-res-row,
    .site-footer,
    .header-btn,
    .header-home-btn,
    .header-profile-btn,
    .header-profile-frame,
    .info-btn,
    .google-btn,
    .hud-currency
) {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--shadow-soft), var(--glass-inset);
    background-clip: padding-box;
}

/* =====================================================
   CARD LAYOUT
===================================================== */

.card {
    background: var(--card-glass-bg, var(--bg-card));
    border: var(--border-width) solid var(--card-glass-border, var(--frame-color));
    box-shadow: var(--card-glass-shadow, var(--shadow-soft)), var(--glass-inset);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: var(--space-md);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:hover {
    background: var(--card-glass-hover-bg, var(--card-glass-bg, var(--bg-card)));
    border-color: var(--card-glass-hover-border, var(--card-glass-border, var(--frame-color)));
    box-shadow: var(--card-glass-hover-shadow, var(--card-glass-shadow, var(--shadow-soft))), var(--glass-inset);
}

h1, h2, h3, h4, .dialog-title, .card h2, .card h3, .card h4 {
    font-family: "Baloo 2", cursive;
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    width: 100%;
}

.card-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.tab-card-heading {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.tab-wiki-btn {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    padding: 0;
}

.tab-wiki-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.tab-wiki-btn img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
}

.collapse-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    border-radius: 10px;
    padding: 6px 8px;
}

.collapse-header:hover {
    background: var(--collapse-hover-bg);
}

.collapse-indicator {
    margin-left: auto;
    font-weight: 700;
    color: var(--text-muted);
}

.collapse-content.is-collapsed {
    display: none;
}

/* =====================================================
   TRADER / MARKET
===================================================== */

.market-filters-wrap {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: 10px;
    border: var(--border-width) solid var(--border-soft-2);
    background: var(--bg-panel);
}

.market-filters-title {
    font-weight: bold;
    margin-bottom: var(--space-sm);
}

.market-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    align-items: end;
}

.market-header {
    margin-bottom: var(--space-md);
}

/* =====================================================
   TRADER SWITCH / MARKET LIST
===================================================== */

.trader-switch {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.trader-switch.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.switch-track {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: min(420px, 100%);
    height: 46px;
    background: var(--btn-gray);
    border: var(--border-width) solid var(--border-soft-2);
    border-radius: 999px;
    overflow: hidden;
}

.switch-thumb {
    position: absolute;
    inset: 2px;
    width: calc(50% - 2px);
    background: var(--btn-green);
    border-radius: 999px;
    transform: translateX(0);
    transition: transform 160ms ease;
}

.trader-switch[data-active="market"] .switch-thumb {
    transform: translateX(100%);
}

.trader-switch[data-active="quests"] .switch-thumb {
    transform: translateX(100%);
}

.trader-switch[data-active="settings"] .switch-thumb {
    transform: translateX(100%);
}

.trader-switch[data-active="register"] .switch-thumb {
    transform: translateX(100%);
}

#guildSwitch .switch-track {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: min(980px, 100%);
}

#guildSwitch .switch-thumb {
    width: calc(20% - 2px);
}

#guildSwitch[data-active="hq"] .switch-thumb {
    transform: translateX(100%);
}

#guildSwitch[data-active="titles"] .switch-thumb {
    transform: translateX(200%);
}

#guildSwitch[data-active="chat"] .switch-thumb {
    transform: translateX(300%);
}

#guildSwitch[data-active="event"] .switch-thumb {
    transform: translateX(400%);
}

#guildSwitch .switch-btn {
    font-size: 0.88rem;
}

@media (max-width: 480px) {
    #guildSwitch .switch-btn {
        font-size: 0.72rem;
    }
    #guildSwitch .switch-track {
        height: 40px;
    }
}

#guildPageSwitch .switch-track {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(860px, 100%);
}

#guildPageSwitch .switch-thumb {
    width: calc((100% / 4) - 2px);
}

#guildPageSwitch[data-active="quests"] .switch-thumb {
    transform: translateX(100%);
}

#guildPageSwitch[data-active="members"] .switch-thumb {
    transform: translateX(200%);
}

#guildPageSwitch[data-active="storage"] .switch-thumb {
    transform: translateX(300%);
}

#guildPageSwitch .switch-btn {
    font-size: 0.9rem;
}

.switch-btn {
    position: relative;
    z-index: 1;
    border: none;
    background: none;
    color: var(--text-strong);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.switch-btn.is-active {
    color: var(--text-inverse);
}

.auth-switch {
    margin-bottom: var(--space-md);
}

.auth-switch .switch-track {
    width: min(360px, 100%);
}

.auth-switch-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
}

.switch-tab-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 6px;
    border-radius: 999px;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    vertical-align: middle;
}

.switch-tab-badge.hidden {
    display: none;
}

.switch-btn.is-disabled,
.switch-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.market-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: var(--space-md);
    justify-content: start;
}

.market-section {
    margin-top: var(--space-md);
}

.market-section-title {
    font-weight: 700;
    margin-bottom: var(--space-sm);
    font-family: "Baloo 2", cursive;
}

.market-offer {
    width: 300px;
    max-width: 100%;
    position: relative;
}

.market-offer .row {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    overflow-wrap: anywhere;
    word-break: break-word;
    padding-right: 110px;
}

@media (max-width: 400px) {
    .market-offer .row {
        padding-right: 0;
    }
    .market-offer-avatar {
        position: static;
        width: 80px;
        height: 80px;
        margin-bottom: var(--space-sm);
    }
}

.market-offer .actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-sm);
}

.market-offer-avatar {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    border: var(--border-width) solid var(--border-soft);
    background: var(--bg-soft);
}

.market-seller-link {
    appearance: none;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

/* =====================================================
   MESSAGES
===================================================== */

.messages-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
    justify-content: space-between;
}

.messages-tabs,
.messages-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.messages-tabs-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-content: space-between;
    flex-wrap: wrap;
}

.messages-new-chat {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

.btn-plus {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    line-height: 1;
    padding: 0;
    background: var(--btn-green-strong);
    color: #ffffff;
    min-width: 56px;
    text-transform: none;
    letter-spacing: 0;
}

button.btn.btn-small.btn-plus {
    border-radius: 999px !important;
    width: 56px;
    min-width: 56px;
    height: 56px;
}

.btn-plus-icon {
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1;
    display: block;
}

.chat-search-results {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.chat-search-item {
    white-space: nowrap;
}

.messages-tab.is-active {
    font-weight: 700;
}

.messages-tab-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 6px;
    border-radius: 999px;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    vertical-align: middle;
}

.messages-tab-badge.hidden {
    display: none;
}

.messages-list {
    display: grid;
    gap: var(--space-md);
}

.message-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    border: var(--border-width) solid var(--frame-color);
}

.message-card.is-unread {
    border-width: 3px;
}

.message-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.message-unread {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid var(--frame-color);
}

.message-meta {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.message-preview,
.message-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.messages-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--space-md);
}

.messages-center-column {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: var(--space-md);
}

.messages-card {
    background: var(--bg-card);
}

.messages-card hr {
    width: 100%;
    border: 0;
    border-top: 2px solid var(--frame-color);
    opacity: 0.6;
    margin: 6px 0;
}

.messages-chats-card,
.messages-chat-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-height: 320px;
}

.messages-options-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.messages-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.messages-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

#messagesView {
    flex: 1;
    overflow: hidden;
}

#chatTitle {
    font-weight: 700;
}

.chat-title-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    max-width: 64px;
    max-height: 64px;
    border-radius: 12px;
    object-fit: cover;
    border: var(--border-width) solid var(--frame-color);
    display: block;
}

.messages-chat-actions {
    display: inline-flex;
    gap: var(--space-sm);
}

.messages-compose {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.messages-compose input {
    flex: 1;
}

.thread-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: var(--space-sm);
    align-items: center;
    text-align: left;
    border: var(--border-width) solid var(--frame-color);
    border-radius: 12px;
    padding: 8px;
    background: var(--bg-soft);
    cursor: pointer;
}

.thread-row.is-active {
    border-width: 3px;
}

.thread-row.has-unread {
    border-width: 3px;
}

.thread-name {
    font-weight: 700;
}

.thread-name-btn {
    appearance: none;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-align: left;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.thread-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.thread-top {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    align-items: center;
}

.thread-preview {
    display: none;
}

.thread-badge {
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: var(--border-width) solid var(--frame-color);
}

.thread-delete {
    border: var(--border-width) solid var(--btn-red);
    background: var(--btn-red);
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    line-height: 1;
    font-weight: 1000;
    cursor: pointer;
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    height: 100%;
    max-height: none;
    overflow-y: auto;
    padding-right: 4px;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 12px;
    border-radius: 12px;
    border: var(--border-width) solid var(--frame-color);
    background: var(--bg-soft);
}

.message-bubble.mine {
    align-self: flex-end;
}

.message-bubble.theirs {
    align-self: flex-start;
}

.message-time {
    font-size: 0.75rem;
    margin-top: 6px;
}

.message-bubble-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.message-report-btn {
    min-height: 28px;
    padding: 4px 10px;
}

@media (max-width: 560px) {
    .messages-layout {
        grid-template-columns: 1fr;
    }

    .messages-center-column {
        grid-template-rows: auto auto;
    }

    .messages-compose {
        flex-direction: row;
        align-items: center;
    }

    .messages-compose input {
        min-width: 0;
    }

    .messages-compose .btn-send {
        flex: 0 0 auto;
    }
}

/* =====================================================
   QUEST CARDS
===================================================== */

.quest-card {
    font-size: 1rem;
    line-height: 1.45;
    padding: 12px;
    cursor: pointer;
    background: var(--quest-card-bg, var(--card-bg));
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.quest-card * {
    cursor: inherit;
}

.quest-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
    background: var(--quest-card-hover-bg, var(--collapse-hover-bg));
}

.quest-card.is-active {
    opacity: 0.85;
}

.quest-claim-all-btn {
    margin-bottom: 14px;
}

.quest-type-heading {
    margin: 10px 0 8px;
    font-size: 1.05rem;
}

.quest-status-claimable {
    color: #c0392b;
}

.quest-status-completed {
    color: #1e8449;
}

/* =====================================================
   NPC TRADER OFFERS
===================================================== */

.npc-offers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-md);
}

.offer-card .offer-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.npc-offer-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

.offer-card .offer-detail {
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.offer-actions {
    margin-top: var(--space-md);
}

/* =====================================================
   FORMS / INPUTS
===================================================== */

.centered-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 40px 14px 0;
    text-align: center;
}

.auth-entry-container {
    max-width: 560px;
    padding-bottom: 22px;
}

.auth-entry-intro {
    margin: 0 0 14px;
}

.auth-faq-card {
    margin-top: 14px;
    text-align: left;
}

.auth-faq-card h2 {
    margin-top: 0;
    margin-bottom: 8px;
}

.auth-faq-item {
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-surface) 82%, transparent);
    padding: 8px 10px;
    margin-bottom: 8px;
}

.auth-faq-item:last-child {
    margin-bottom: 0;
}

.auth-faq-item > summary {
    cursor: pointer;
    font-weight: 700;
}

.auth-faq-item > p {
    margin: 8px 0 2px;
    color: var(--text-muted);
}

.form-card { text-align: left; }

.form-group { margin-bottom: var(--space-md); }

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: var(--space-xs);
}

.form-group input {
    width: 100%;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 0.95rem;
    color: var(--text-main);
}

.google-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background: var(--bg-surface);
    color: var(--text-strong);
    text-decoration: none;
    font-weight: 600;
}

.google-btn:hover {
    background: var(--bg-surface-hover);
}

input,
select,
textarea {
    background: var(--field-bg);
    border: var(--border-width) solid var(--border-soft-2);
    color: inherit;
    border-radius: var(--control-radius);
    padding: 8px 12px;
    line-height: 1.2;
}

input,
select {
    height: var(--control-height);
}

textarea {
    height: var(--control-height);
    min-height: var(--control-height);
}

/* =====================================================
   BUTTONS (Layout only)
===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--control-height);
    gap: 10px;
    border-radius: 999px;
    border: var(--btn-border-size) solid var(--btn-border-color);
    cursor: pointer;
    user-select: none;
    min-width: var(--btn-min-width);
    padding: 14px 28px;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--btn-text);
    background-color: var(--btn-fill);
    background-image: var(--btn-bg-image);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: var(--btn-shadow);
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease,
        color 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--btn-shadow-hover);
    filter: brightness(1.05);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: var(--btn-shadow-active);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--btn-focus-shadow);
}

.btn:disabled {
    cursor: not-allowed;
    user-select: none;
    pointer-events: none;
    background-color: var(--btn-disabled-fill);
    background-image: var(--btn-disabled-bg-image, none);
    color: var(--btn-disabled-text);
    border-color: var(--btn-disabled-border);
    box-shadow: var(--btn-disabled-shadow);
    filter: saturate(0.4);
}

.btn[aria-disabled="true"] {
    cursor: not-allowed;
    user-select: none;
    pointer-events: none;
    background-color: var(--btn-disabled-fill);
    background-image: var(--btn-disabled-bg-image, none);
    color: var(--btn-disabled-text);
    border-color: var(--btn-disabled-border);
    box-shadow: var(--btn-disabled-shadow);
    filter: saturate(0.4);
}

.btn-small {
    padding: 0 12px;
    height: var(--control-height-sm);
    font-size: 0.85rem;
    border-radius: 999px;
    min-width: 0;
    text-transform: none;
    letter-spacing: 0.01em;
}

.btn-danger {
    background-color: var(--btn-danger-fill);
    background-image: var(--btn-danger-bg-image);
    color: var(--btn-danger-text);
    border-color: var(--btn-danger-border);
}

.btn-send {
    width: var(--control-height);
    min-width: var(--control-height);
    height: var(--control-height);
    padding: 0;
    border-radius: 999px;
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: none;
    letter-spacing: 0;
}

.btn-send {
    background-color: var(--btn-send-fill);
    background-image: none;
    color: var(--btn-send-text);
    border-color: var(--btn-send-border);
    box-shadow: var(--btn-send-shadow);
}

.btn.btn-plus {
    width: 56px;
    height: 56px;
    min-width: 56px;
    padding: 0;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
    background-color: var(--btn-send-fill);
    background-image: none;
    color: var(--btn-send-text);
    border-color: var(--btn-send-border);
    box-shadow: var(--btn-send-shadow);
}

.btn.is-loading,
.btn[aria-busy="true"] {
    pointer-events: none;
    position: relative;
    color: var(--btn-loading-text);
    background-color: var(--btn-loading-fill);
    background-image: var(--btn-loading-bg-image);
    background-size: var(--btn-loading-size);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    animation: var(--btn-loading-anim);
    box-shadow: var(--btn-loading-shadow);
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
    filter: none;
    opacity: 1;
    border-width: var(--btn-loading-border-size, var(--btn-border-size));
}

@keyframes pill-gradient-move {
    0%   { background-position:   0% 50%, 0% 50%; }
    100% { background-position: 200% 50%, 0% 50%; }
}

@keyframes neon-spin {
    to {
        background-image:
            linear-gradient(var(--btn-dark-base), var(--btn-dark-base)),
            conic-gradient(
                from 360deg,
                var(--btn-loading-neon-1),
                var(--btn-loading-neon-2),
                var(--btn-loading-neon-3),
                var(--btn-loading-neon-4),
                var(--btn-loading-neon-1)
            );
    }
}

/* =====================================================
   PROFILE
===================================================== */

.profile-card h2 {
    margin-bottom: var(--space-sm);
}

.profile-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-md) var(--space-lg);
    align-items: start;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.profile-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.profile-name {
    font-size: 1.6rem;
    font-weight: 700;
}

.profile-name-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-name-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.profile-name-row .profile-name {
    font-size: 1.9rem;
}

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: var(--border-width) solid var(--border-soft);
    background: var(--btn-gray);
    color: var(--text-strong);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.btn-icon:active {
    transform: translateY(1px);
}

.profile-meta {
    margin-top: 4px;
}

.profile-badge-grid {
    margin-top: 0;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 10px;
}

.profile-badge-card {
    position: relative;
    width: 134px;
    min-width: 134px;
    max-width: 134px;
    height: 27px;
    min-height: 27px;
    max-height: 27px;
    border-radius: 10px;
    overflow: hidden;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

#profileBadgeCityLevel {
    height: 31px;
    min-height: 31px;
    max-height: 31px;
}

.profile-badge-card.profile-badge-city-level {
    height: 31px;
    min-height: 31px;
    max-height: 31px;
}

.profile-badge-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: none;
}

.profile-badge-value {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.1;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
    padding: 0 8px;
    text-align: center;
    word-break: break-word;
    white-space: nowrap;
}

.profile-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    border: var(--border-width) solid var(--border-soft-2);
    background: var(--bg-soft);
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-strong);
    width: fit-content;
}

.profile-public-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
}

.profile-public-main {
    display: grid;
    gap: 8px;
}

.profile-public-image {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-public-badges {
    display: grid;
    gap: 8px;
    justify-items: center;
}

@media (max-width: 760px) {
    .profile-public-grid {
        grid-template-columns: 1fr;
    }

    .profile-public-badges {
        justify-items: start;
    }
}

.profile-title-badge-btn {
    font: inherit;
    cursor: pointer;
}

.profile-title-badge.is-legacy {
    border-color: rgba(221, 177, 66, 0.7);
    background: rgba(221, 177, 66, 0.14);
}

.profile-pic {
    width: 150px;
    height: 150px;
    border-radius: 16px;
    border: var(--border-width) dashed var(--border-soft);
    background: var(--bg-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
}

.profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-pic.has-image img {
    display: block;
}

.profile-pic.has-image .profile-pic-placeholder {
    display: none;
}

.profile-settings {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.profile-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
}

.profile-actions-row .btn {
    white-space: nowrap;
    padding: 8px 14px;
    line-height: 1;
    height: 40px;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    max-width: 320px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-sm);
    margin-top: 0;
}

.profile-card > .profile-info {
    grid-column: 1;
}

.profile-card > .profile-badge-grid {
    grid-column: 2;
}

.profile-card > .profile-stats {
    grid-column: 1 / -1;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-soft);
    border: var(--border-width) solid var(--border-soft-2);
}

.profile-settings {
    display: grid;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.profile-settings-section {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-soft);
    border: var(--border-width) solid var(--border-soft-2);
}

.profile-settings-section > .btn {
    justify-self: start;
    width: auto;
}

.profile-adventure-log {
    display: grid;
    gap: 6px;
    height: 380px;
    overflow-y: auto;
    margin-top: 6px;
    padding-right: 4px;
}

.profile-adventure-row {
    display: grid;
    grid-template-columns: minmax(100px, 140px) minmax(100px, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-soft);
    border: var(--border-width) solid var(--border-soft-2);
    font-size: 0.92rem;
}

@media (max-width: 480px) {
    .profile-adventure-row {
        grid-template-columns: 1fr auto;
        font-size: 0.85rem;
    }
    .profile-adventure-row > :first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 920px) {
    .profile-card {
        grid-template-columns: 1fr;
    }

    .profile-card > .profile-info,
    .profile-card > .profile-badge-grid,
    .profile-card > .profile-stats {
        grid-column: 1;
    }

    .profile-badge-grid {
        margin-top: var(--space-xs);
        justify-items: start;
    }
}

.profile-adventure-row .status-ok {
    color: #1d7a36;
    font-weight: 600;
}

.profile-adventure-row .status-fail {
    color: #a83232;
    font-weight: 600;
}

.profile-title-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.profile-title-item {
    display: grid;
    gap: 6px;
    padding: 10px;
    border-radius: 10px;
    background: var(--bg-soft);
    border: var(--border-width) solid var(--border-soft-2);
}

.profile-title-item.is-locked {
    opacity: 0.72;
}

.profile-title-item.is-active {
    border-color: var(--accent-border);
    background: rgba(221, 177, 66, 0.14);
}

.profile-title-item.is-legacy {
    box-shadow: inset 0 0 0 1px rgba(221, 177, 66, 0.35);
}

.profile-title-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.profile-title-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: var(--border-width) solid var(--border-soft-2);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.profile-title-state.is-active {
    color: #1d7a36;
    border-color: rgba(29, 122, 54, 0.45);
    background: rgba(29, 122, 54, 0.12);
}

.profile-title-state.is-unlocked {
    color: #8a5d00;
    border-color: rgba(138, 93, 0, 0.45);
    background: rgba(203, 155, 45, 0.16);
}

.profile-title-actions {
    display: flex;
    justify-content: flex-end;
}

/* =====================================================
   GAME HEADER (Logo + currencies)
===================================================== */

.game-header {
    min-height: calc(92px + var(--safe-top));
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: calc(var(--safe-top) + 6px) max(12px, var(--safe-right)) 6px max(12px, var(--safe-left));
    gap: 12px;
    overflow: visible;
    background: var(--glass-header-gradient);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: calc(var(--border-width) * 2) solid var(--frame-color);
}

@media (max-width: 400px) {
    .game-header {
        min-height: calc(74px + var(--safe-top));
        gap: 8px;
        padding: calc(var(--safe-top) + 4px) max(8px, var(--safe-right)) 4px max(8px, var(--safe-left));
    }
    .header-logo {
        height: 56px;
    }
    .header-home-btn,
    .header-profile-btn {
        width: 44px;
        height: 44px;
    }
}

.header-left {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-center {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.header-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.header-right {
    grid-column: 3;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 6px;
}

.header-home-btn,
.header-profile-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(44px, 11vw, 56px);
    height: clamp(44px, 11vw, 56px);
    padding: 4px;
    border: var(--border-width) solid var(--frame-color);
    border-radius: 999px;
    background: var(--bg-panel);
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}

#headerHudBadge {
    top: -2px;
    right: -2px;
}

.header-home-btn:hover,
.header-profile-btn:hover {
    filter: brightness(1.06);
    border-color: var(--border-soft-2);
}

.header-home-btn:active,
.header-profile-btn:active {
    transform: translateY(1px);
}

.header-home-btn img {
    width: 82%;
    height: 82%;
    object-fit: contain;
    display: block;
}

.header-profile-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 999px;
    border: var(--border-width) solid var(--border-soft-2);
    background: rgba(0, 0, 0, 0.22);
}

.header-profile-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Logo wird groß geliefert -> sauber skalieren, NICHT beschneiden */
.header-logo {
    height: clamp(58px, 14vw, 96px);
    width: auto;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.header-currency {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 14px;
}

.header-currency img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    image-rendering: pixelated;
}

/* =====================================================
   CITY SCREEN (Index)
===================================================== */

#city-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

#city-image {
    width: 100%;
    max-width: 400px;
    max-height: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    border: var(--border-width) solid var(--frame-color);
    border-radius: 15px;
    box-shadow: var(--shadow-strong);
}

.home-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.home-summary-header h2 {
    margin: 0;
}

.offline-summary-rows {
    display: grid;
    gap: 8px;
}

.offline-summary-row {
    border: var(--border-width) solid var(--border-soft-2);
    border-radius: 10px;
    background: var(--bg-soft);
    padding: 8px 10px;
}

.offline-summary-row > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}

.offline-summary-row > summary::-webkit-details-marker {
    display: none;
}

.offline-summary-row > summary::after {
    content: "▾";
    opacity: 0.85;
    font-size: 0.9rem;
}

.offline-summary-row:not([open]) > summary::after {
    content: "▸";
}

.offline-summary-body {
    margin-top: 6px;
}

.offline-summary-list {
    margin: 6px 0 0 18px;
}

.city-preview-wrapper {
    width: 100%;
}

.buildings-list-card.is-collapsed {
    display: none;
}

.buildings-city-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.buildings-view-switch {
    display: inline-flex;
    gap: 6px;
}

.buildings-view-switch .btn.active {
    box-shadow: 0 0 0 1px rgba(83, 255, 153, 0.6), 0 0 10px rgba(83, 255, 153, 0.2);
}

.buildings-city-zoom {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.buildings-city-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.buildings-city-map-overlay {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    z-index: 1200;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 0;
    background: var(--card-bg);
    border: 1px solid var(--frame-color);
    border-left: 0;
    border-right: 0;
    backdrop-filter: blur(6px);
}

.buildings-city-map-overlay .buildings-city-zoom .btn {
    min-width: 34px;
}

.buildings-city-view-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.city-map-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.city-map-nav .btn {
    min-width: 34px;
    line-height: 1;
}

.city-map-nav.hidden {
    display: none !important;
}

.buildings-city-map.is-collapsed {
    display: none;
}

.buildings-city-map .city-preview-map {
    max-width: 100%;
}

.buildings-city-map-viewport {
    width: 100%;
    max-height: 62vh;
    overflow: auto;
    overscroll-behavior: contain;
    position: relative;
}

.buildings-city-map .city-preview-map {
    --city-map-zoom: 1;
    width: calc(100% * var(--city-map-zoom));
    max-width: none;
    min-width: 100%;
    flex: 0 0 auto;
}

/* Slot-Basisgröße via 11cqw (container-relative) – identisch in Admin und Game */

.buildings-sections.is-collapsed {
    display: none;
}

body.buildings-city-fullscreen #game-content {
    padding: 0;
    overflow: hidden;
}

body.buildings-city-fullscreen .buildings-city-map.is-fullscreen {
    position: fixed;
    top: var(--game-header-offset, 92px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    background: rgba(5, 12, 18, 0.94);
}

body.buildings-city-fullscreen .buildings-city-map.is-fullscreen .buildings-city-map-viewport {
    max-height: 100%;
    height: 100%;
    width: 100%;
    overflow: auto;
    position: relative;
}

body.buildings-city-fullscreen .buildings-city-map.is-fullscreen .city-preview-map {
    min-width: 0;
    max-width: none;
    margin: 0 auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex: 0 0 auto;
}

@media (orientation: landscape) {
    body.buildings-city-fullscreen .buildings-city-map.is-fullscreen .city-preview-map {
        width: calc(100% * var(--city-map-zoom, 1));
        height: auto;
    }
}

@media (orientation: portrait) {
    body.buildings-city-fullscreen .buildings-city-map.is-fullscreen .city-preview-map {
        width: calc((100dvh - var(--game-header-offset, 92px)) * var(--city-map-aspect, 1.7778) * var(--city-map-zoom, 1));
        height: auto;
    }
}

body.buildings-city-fullscreen .buildings-city-map.is-fullscreen .buildings-city-map-overlay {
    top: 0;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 8px 12px;
}

body.buildings-city-fullscreen .buildings-city-map.is-fullscreen .city-preview-bg {
    width: 100%;
    height: auto;
    min-width: 0;
}

body.buildings-city-fullscreen .buildings-city-map.is-fullscreen .city-preview-note {
    position: absolute;
    left: 12px;
    bottom: 8px;
    margin: 0;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.45);
}

.city-preview-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.city-preview-note {
    margin-bottom: 10px;
}

.buildings-city-map .city-preview-note {
    display: none !important;
}

.city-slot-live {
    margin-bottom: 8px;
    opacity: 0.92;
}

.city-preview-map {
    container-type: inline-size;
    position: relative;
    z-index: 0;
    isolation: isolate;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    border: var(--border-width) solid var(--frame-color);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-strong);
    background: rgba(0, 0, 0, 0.2);
}

.city-preview-map.is-move-mode {
    cursor: crosshair;
}

.city-preview-map.show-grid::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(
            to right,
            rgba(255, 255, 255, 0.16) 0,
            rgba(255, 255, 255, 0.16) 1px,
            transparent 1px,
            transparent 5%
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.16) 0,
            rgba(255, 255, 255, 0.16) 1px,
            transparent 1px,
            transparent 5%
        );
    z-index: 1;
}

.city-preview-bg {
    width: 100%;
    display: block;
    object-fit: cover;
}

.city-preview-slot {
    position: absolute;
    --slot-scale: 1;
    --slot-scale-hover: calc(var(--slot-scale) * 1.05);
    transform: translate(-50%, -50%) scale(var(--slot-scale));
    width: clamp(44px, 11cqw, 100px);
    height: clamp(44px, 11cqw, 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.12s ease;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    z-index: 2;
}

.city-preview-slot:hover {
    transform: translate(-50%, -50%) scale(var(--slot-scale-hover));
    box-shadow: none;
    background: transparent;
}

.city-preview-map.is-move-mode .city-preview-slot {
    cursor: crosshair;
}

.city-preview-map.is-assign-mode .city-preview-slot {
    cursor: cell;
}

.city-preview-map.is-assign-mode .city-preview-slot.is-empty {
    box-shadow: 0 0 0 1px rgba(83, 200, 255, 0.6), 0 0 10px rgba(83, 180, 255, 0.2);
}

.city-preview-slot.is-picked {
    box-shadow: 0 0 0 2px rgba(255, 225, 120, 0.95), 0 0 18px rgba(255, 210, 60, 0.42);
    background: transparent;
}

.city-preview-slot.is-unbuilt {
    opacity: 0.38;
}

.city-preview-slot.is-unbuilt img {
    filter: saturate(0.75);
}

.city-preview-slot.is-reserve {
    box-shadow: 0 0 0 1px rgba(255, 191, 96, 0.72), 0 0 10px rgba(255, 156, 44, 0.22);
}

.city-preview-map.is-move-mode .city-preview-slot.is-reserve {
    cursor: not-allowed;
}

.city-preview-map.city-anim-enabled .city-preview-slot.is-active {
    animation: city-slot-pulse 4.2s ease-in-out infinite;
}

.city-preview-map.city-anim-enabled .city-preview-slot.has-smoke::before,
.city-preview-map.city-anim-enabled .city-preview-slot.has-smoke::after {
    content: "";
    position: absolute;
    bottom: 16%;
    left: 50%;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(circle at 35% 35%, rgba(245, 245, 245, 0.85), rgba(160, 160, 160, 0.2) 70%, transparent 100%);
    animation: city-smoke-rise 3.2s ease-out infinite;
}

.city-preview-map.city-anim-enabled .city-preview-slot.has-smoke::after {
    width: 11px;
    height: 11px;
    margin-left: 4px;
    animation-delay: 1.6s;
}

.city-preview-slot.is-empty {
    background: rgba(0, 0, 0, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

.city-preview-slot img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    pointer-events: none;
}

.city-preview-slot-level {
    position: absolute;
    right: -5px;
    top: -5px;
    min-width: 18px;
    height: 18px;
    border-radius: 12px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--badge-text);
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    box-shadow: var(--badge-shadow);
    pointer-events: none;
}

.city-preview-slot-empty {
    font-size: 22px;
    line-height: 1;
    opacity: 0.8;
}

.city-preview-slot-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(200, 40, 40, 0.88);
    color: #fff;
    border: none;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.city-preview-slot:not(.is-picked) .city-preview-slot-remove {
    display: none;
}

.city-slot-selected-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.city-preview-slot-label {
    position: absolute;
    left: 50%;
    bottom: calc(84% + 1px);
    /* Counter-scale: font stays constant size regardless of building scale */
    transform: translateX(-50%) scale(calc(1 / (var(--slot-scale, 1) * var(--city-zoom, 1))));
    transform-origin: bottom center;
    max-width: 130px;
    padding: 2px 5px;
    border-radius: 6px;
    font-size: 10px;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    color: #f4f8ff;
    background: rgba(5, 9, 12, 0.7);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.city-preview-slot-label > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.city-preview-slot-label-time {
    color: #ffd9a6;
    font-size: 9px;
    opacity: 0.92;
}

.city-preview-slot-upgrade {
    position: absolute;
    left: 50%;
    top: calc(84% + 2px);
    transform: translateX(-50%) scale(calc(1 / (var(--slot-scale, 1) * var(--city-zoom, 1))));
    transform-origin: top center;
    max-width: 130px;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ffd9a6;
    background: rgba(40, 16, 2, 0.78);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.city-slot-upgrade-badge {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4cdb7a;
    pointer-events: none;
    margin-right: 3px;
    animation: city-badge-glow 2s ease-in-out infinite;
}

@keyframes city-badge-glow {
    0%, 100% { box-shadow: 0 0 3px rgba(76, 219, 122, 0.4); }
    50% { box-shadow: 0 0 7px rgba(76, 219, 122, 0.85); }
}

@keyframes city-slot-pulse {
    0%, 100% { filter: none; }
    50% { filter: drop-shadow(0 0 6px rgba(83, 255, 153, 0.35)); }
}

@keyframes city-smoke-rise {
    0% { transform: translate(-50%, 0) scale(0.65); opacity: 0; }
    20% { opacity: 0.45; }
    100% { transform: translate(-50%, -22px) scale(1.3); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .city-preview-map.city-anim-enabled .city-preview-slot.is-active,
    .city-preview-map.city-anim-enabled .city-preview-slot.has-smoke::before,
    .city-preview-map.city-anim-enabled .city-preview-slot.has-smoke::after {
        animation: none !important;
    }
    .city-slot-upgrade-badge {
        animation: none;
    }
}

@media (max-width: 760px) {
    :root {
        --city-perspective-max-scale: 2.70;
    }
    .city-preview-slot {
        border-radius: 10px;
    }
}

/* =====================================================
   HUD BOTTOM
===================================================== */

#hud-bottom {
    --hud-btn-size: clamp(38px, 10.2vw, 64px);
    --hud-gap: clamp(6px, 1.8vw, 18px);
    --hud-pad-x: clamp(8px, 3vw, 18px);
    --hud-pad-y: clamp(6px, 2vw, 10px);
    position: fixed;
    bottom: max(12px, var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    min-height: calc(var(--hud-btn-size) + (var(--hud-pad-y) * 2));
    padding: var(--hud-pad-y) var(--hud-pad-x);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--hud-gap);
    width: min(
        calc(100vw - max(16px, var(--safe-left)) - max(16px, var(--safe-right))),
        calc((var(--hud-btn-size) * 6) + (var(--hud-gap) * 5) + (var(--hud-pad-x) * 2))
    );

    border-radius: 15px;
    z-index: 20000;
    isolation: isolate;

    /* Optik */
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--border-width) solid var(--frame-color);
    box-shadow: var(--shadow-strong);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

#hud-bottom.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 400px) {
    .hud-badge {
        min-width: 16px;
        height: 16px;
        font-size: 9px;
    }
    .hud-badge--dot {
        min-width: 16px;
        height: 16px;
    }
}


.hud-btn {
    position: relative;
    width: var(--hud-btn-size);
    height: var(--hud-btn-size);
    flex: 0 0 var(--hud-btn-size);
    aspect-ratio: 1;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
}

.hud-btn.is-disabled,
.hud-btn:disabled {
    opacity: 0.45;
    filter: grayscale(0.3);
}

.hud-btn-bg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.hud-btn-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(var(--hud-btn-size) * 0.53);
    height: calc(var(--hud-btn-size) * 0.53);
    transform: translate(-50%, -50%);
    display: block;
    object-fit: contain;
}

/* Badge */
.hud-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: var(--badge-bg);
    color: var(--badge-text);
    border: 2px solid var(--badge-border);
    box-shadow: var(--badge-shadow);
    pointer-events: none;
}
.hud-badge.hidden { display: none; }
.hud-badge--dot {
    min-width: 20px;
    height: 20px;
    padding: 0;
    font-size: 0;
    border-width: 2px;
}

/* =====================================================
   HUD STATUS (optional)
===================================================== */

#hud-status {
    font-size: 11px;
    line-height: 1.4;
    text-align: right;
    user-select: none;
}

#hud-status .ok { font-weight: bold; }
#hud-status .err { font-weight: bold; }

/* =====================================================
   FOOTER (LEGAL)
===================================================== */

.site-footer {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    line-height: 1.2;
    border-radius: 10px;
    background: var(--bg-soft-3);
    border: 1px solid var(--frame-color);
    box-shadow: var(--shadow-soft);
    z-index: 45;
    margin-top: var(--space-md);
}

.footer-link {
    border: none;
    background: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.footer-link:focus-visible {
    outline: 2px solid var(--frame-color);
    outline-offset: 2px;
}

.footer-sep {
    opacity: 0.6;
}

.footer-note {
    opacity: 0.85;
}

@media (min-width: 561px) {
    .site-footer {
        position: fixed;
        bottom: max(6px, env(safe-area-inset-bottom, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        margin-top: 0;
    }
}

@media (max-width: 560px) {
    .site-footer {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .footer-note {
        width: 100%;
    }
}

/* =====================================================
   DIALOG BASE (Structure only)
===================================================== */

.dialog-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;

    background: var(--bg-overlay);
    backdrop-filter: blur(6px);

    z-index: 1000;
}

.dialog-box {
    width: 80%;
    max-width: 360px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--dialog-glass-bg, var(--card-glass-bg, var(--bg-panel)));
    border: var(--border-width) solid var(--dialog-glass-border, var(--card-glass-border, var(--frame-color)));
    box-shadow: var(--dialog-glass-shadow, var(--card-glass-shadow, var(--shadow-soft))), var(--glass-inset);
}

.dialog-box.dialog-box-wide {
    width: min(94vw, 980px);
    max-width: 980px;
}

.dialog-content {
    padding: 12px 20px 14px;
    text-align: left;
}

.dialog-buttons {
    margin-top: 8px;
    padding: 10px 16px 16px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.dialog-buttons .dialog-btn {
    min-width: 120px;
}

.dialog-content {
    padding: 18px;
    text-align: left;
}

.dialog-content h2,
.dialog-content h3 {
    margin: 0 0 var(--space-md);
    text-align: center;
}

.dialog-content hr {
    margin: var(--space-md) 0;
    opacity: 0.4;
}

.dialog-title {
    margin: 0;
    padding: 16px 20px 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.dialog-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.techwiki-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 4px;
}

.techwiki-section h4 {
    margin: 0 0 8px;
}

.techwiki-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.techwiki-node {
    border: var(--border-width) solid var(--border-soft);
    border-radius: 10px;
    padding: 10px;
    background: var(--bg-panel);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.techwiki-node:hover {
    border-color: var(--frame-color);
}

.techwiki-node.is-selected {
    border-color: #f4c95d;
    box-shadow: 0 0 0 1px rgba(244, 201, 93, 0.45), 0 0 12px rgba(244, 201, 93, 0.2);
    background: rgba(244, 201, 93, 0.08);
}

.techwiki-node.is-unlock {
    border-color: #3de078;
    box-shadow: 0 0 0 1px rgba(61, 224, 120, 0.35);
    background: rgba(61, 224, 120, 0.1);
}

.techwiki-node.is-prereq {
    border-color: #59a9ff;
    box-shadow: 0 0 0 1px rgba(89, 169, 255, 0.35);
    background: rgba(89, 169, 255, 0.1);
}

.techwiki-node-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.techwiki-node-line {
    font-size: 0.9rem;
    margin-top: 2px;
}

.techwiki-legend {
    margin-top: 6px;
    padding-top: 8px;
    border-top: var(--border-width) solid var(--border-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
}

.techwiki-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.techwiki-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: var(--border-width) solid var(--border-soft);
    display: inline-block;
}

.techwiki-legend-swatch.is-selected {
    background: rgba(244, 201, 93, 0.35);
    border-color: #f4c95d;
}

.techwiki-legend-swatch.is-unlock {
    background: rgba(61, 224, 120, 0.35);
    border-color: #3de078;
}

.techwiki-legend-swatch.is-prereq {
    background: rgba(89, 169, 255, 0.35);
    border-color: #59a9ff;
}

/* =====================================================
   BUILDINGS TOOLBAR / GRID (Layout only)
===================================================== */

.buildings-toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.buildings-categories {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.buildings-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.select-small {
    padding: 0 8px;
    font-size: 0.85rem;
    height: var(--control-height-sm);
    border-radius: var(--control-radius);
}

.checkbox-small {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.buildings-search input {
    width: 100%;
    max-width: 220px;
}

.buildings-grid {
    display: grid;
    gap: var(--space-xs);
}

.buildings-grid .card,
.research-grid .card {
    margin-bottom: 0;
}

.buildings-sections {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.building-section-desc {
    margin: 0 0 var(--space-sm);
}

.building-section-grid {
    display: grid;
    gap: var(--space-sm);
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.building-section-grid > .building-card {
    height: 100%;
    display: flex;
}

@media (max-width: 720px) {
    .building-section-grid {
        grid-template-columns: 1fr;
    }
}

/* cards from modules often use these */
.building-card .building-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 1 1 auto;
    min-height: 100%;
}

.building-card .building-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.building-card .building-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.building-level {
    font-weight: 700;
    font-size: 1.1rem;
}

.building-card.available {
    background: var(--bg-soft-2);
}

.building-card.locked {
    opacity: 0.75;
}

.building-card .building-cost {
    font-weight: 600;
}

/* ------------------ */

.building-grid {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    align-items: start;
}

.building-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.building-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.building-icon.placeholder {
    opacity: 0.2;
}

.building-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
}

.building-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.building-card .building-actions {
    margin-top: auto;
    padding-top: 6px;
}

.building-actions .upgrade-btn {
    flex: 0 0 auto;
    min-width: 190px;
    width: auto;
    min-height: 46px;
    padding-inline: 14px;
    white-space: nowrap;
}

.building-actions .upgrade-cancel-btn {
    flex: 0 0 auto;
    min-width: 100px;
    width: 100px;
}

/* =====================================================
   ADVENTURES
===================================================== */

.adventure-areas-grid {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.adventure-slot-banner-wrapper {
    grid-column: 1 / -1;
}

.adventure-card {
    display: flex;
    flex-direction: column;
}

.adventure-card .adventure-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.adventure-level {
    margin-top: 4px;
}

.adventure-logo {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    margin: var(--space-sm) 0;
    object-fit: cover;
    align-self: flex-start;
}

.adventure-desc {
    margin-bottom: var(--space-sm);
}

.adventure-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.adventure-actions .btn {
    min-width: 0;
}

.adventure-actions .adventure-start,
.adventure-actions .adventure-claim {
    flex: 1 1 210px;
}

.adventure-actions .adventure-cancel {
    flex: 0 0 auto;
}

@media (max-width: 520px) {
    .building-card .building-grid {
        grid-template-columns: 1fr;
    }

    .building-actions .upgrade-btn,
    .building-actions .upgrade-cancel-btn {
        flex: 0 0 auto;
        width: auto;
        min-width: 160px;
    }

    .adventure-actions .adventure-cancel {
        flex: 1 1 100%;
    }
}

/* Research cards use a single-column layout to avoid cramped right column */
.research-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xs);
}

.research-grid .building-actions {
    display: flex;
    justify-content: flex-end;
}

/* =====================================================
   RESEARCH: TECH-TREE UI
===================================================== */

/* Akademie-Status */
.research-fp-badge {
    font-size: 0.85rem;
    color: var(--accent-color, #4a90e2);
    font-weight: 600;
    margin-left: 4px;
    white-space: nowrap;
}
.research-academy-status {
    padding: var(--space-xs) 0 0;
    font-size: 0.9rem;
}
.research-academy-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.research-slot-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color, #ccc);
    border: 1px solid var(--frame-color, #aaa);
}
.research-slot-dot.active {
    background: var(--accent-color, #4a90e2);
    border-color: var(--accent-color, #4a90e2);
}

/* Upgrade-Slot-Banner (buildings.js) */
.upgrade-slot-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    padding: var(--space-xs) 0;
    margin-bottom: var(--space-xs);
}
.slot-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.slot-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color, #ccc);
    border: 1px solid var(--frame-color, #aaa);
}
.slot-dot.slot-dot-active {
    background: var(--accent-color, #4a90e2);
    border-color: var(--accent-color, #4a90e2);
}

/* Branch-Tabs */
.research-branch-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.research-branch-tabs .tab-btn {
    padding: 4px 12px;
    font-size: 0.85rem;
    border-radius: 20px;
    border: 1px solid var(--border-color, #ccc);
    background: var(--input-bg, #fff);
    color: var(--text-color, #333);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.research-branch-tabs .tab-btn.active,
.research-branch-tabs .tab-btn:hover {
    background: var(--accent-color, #4a90e2);
    color: #fff;
    border-color: var(--accent-color, #4a90e2);
}

/* Bonus-Panel */
.research-bonus-panel {
    font-size: 0.875rem;
}
.research-bonus-list {
    padding: var(--space-xs) 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 4px;
    align-items: center;
}

/* Branch-Badge auf Karte */
.research-branch-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
    opacity: 0.85;
}
.research-branch-production { background: #d4edda; color: #155724; }
.research-branch-bonus      { background: #fff3cd; color: #856404; }
.research-branch-unlock     { background: #cce5ff; color: #004085; }

/* Kosten-Zeile */
.research-cost-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.88rem;
}
.cost-insufficient {
    color: var(--danger-color, #c0392b);
}

/* Voraussetzungen */
.research-prereq-row {
    font-size: 0.85rem;
}
.prereq-ok   { color: var(--success-color, #27ae60); }
.prereq-missing { color: var(--danger-color, #c0392b); }

/* Nächste Stufe */
.research-next-level {
    font-size: 0.82rem;
    font-style: italic;
}

/* Status-Label */
.research-status {
    font-size: 0.83rem;
}

/* Titel-Zeile mit Badge */
.research-title-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

/* =====================================================
   RESEARCH TECH-TREE
===================================================== */

/* Outer scroll wrapper */
.research-tree-outer {
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

/* Tree row: horizontal on desktop, vertical on mobile */
.research-tree-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    min-width: max-content;
}

/* Single tier column */
.research-tier {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    max-width: 220px;
    padding: 8px;
    flex-shrink: 0;
}

/* Arrow between tiers */
.research-tier-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    flex-shrink: 0;
    color: var(--frame-color);
    font-size: 1.2rem;
    padding-top: 4px;
}
.research-tier-arrow::after {
    content: "›";
}

/* Tier visibility states */
.research-tier[data-vis="completed"] {
    opacity: 0.5;
}
.research-tier[data-vis="next"] {
    opacity: 0.7;
}
.research-tier[data-vis="far"] {
    opacity: 0.4;
}

/* Individual tier item card */
.research-tier-item {
    background: var(--card-bg);
    border: var(--border-width) solid var(--frame-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    box-shadow: var(--shadow-soft);
    transition: opacity 0.2s, transform 0.2s;
    position: relative;
}

.research-tier-item.state-running {
    border-left: 3px solid var(--accent-color, #4a90e2);
}

.research-tier-item.state-completed {
    opacity: 0.45;
    transform: scale(0.94);
}
.research-tier-item.state-completed .upgrade-btn {
    pointer-events: none;
}

.research-tier-item.state-locked {
    opacity: 0.55;
    filter: grayscale(0.35);
}
.research-tier-item.state-locked-far {
    opacity: 0.3;
    filter: grayscale(0.7);
}

.research-tier-item.state-excluded {
    opacity: 0.28;
    pointer-events: none;
}
.research-tier-item.state-excluded::after {
    content: "✗";
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 1rem;
    color: var(--danger-color, #c00);
}

/* Item header */
.research-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 4px;
}
.research-item-name {
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.3;
}
.research-item-level {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.research-item-levelname,
.research-item-next {
    font-size: 0.78rem;
    margin-bottom: 2px;
}

.research-item-desc {
    font-size: 0.81rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.35;
}

.research-item-costs {
    font-size: 0.8rem;
    margin-bottom: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.research-item-actions {
    margin-top: 4px;
}
.research-item-actions .btn {
    width: 100%;
    font-size: 0.82rem;
    padding: 4px 8px;
}

/* Mobile: vertical layout */
@media (max-width: 767px) {
    .research-tree-outer {
        overflow-x: visible;
    }
    .research-tree-container {
        flex-direction: column;
        min-width: unset;
    }
    .research-tier {
        min-width: unset;
        max-width: unset;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 0;
    }
    .research-tier-item {
        flex: 1 1 calc(50% - 4px);
        min-width: 140px;
    }
    .research-tier-arrow {
        width: unset;
        height: 18px;
        padding: 0;
        justify-content: flex-start;
        padding-left: 12px;
    }
    .research-tier-arrow::after {
        content: "↓";
    }
}

/* =====================================================
   RESOURCE LIST (optional areas)
===================================================== */

#hudResources .hud-res-row {
    display: flex;
  /*  justify-content: space-between; */
  /*  gap: 10px; */
    padding: 4px 0;
    border-radius: 18px;
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--border-width) solid var(--frame-color);
    box-shadow: var(--shadow-strong);
}

/* =====================================================
   AUTH PAGES (Login / Register)
===================================================== */

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

/* großes Logo sauber begrenzen */
.logo {
    max-width: 180px;   /* 🔑 deutlich kleiner */
    width: 100%;
    height: auto;
}

/* Titel etwas Luft */
.page-title {
    text-align: center;
    margin-bottom: 16px;
}

/* Login/Register Card optisch ruhiger */
.form-card {
    margin-top: 8px;
}

/* Button mittig */
.form-card .btn {
    margin: 16px auto 0;
    width: 100%;
    max-width: 220px;
}

.profile-block-list {
    display: grid;
    gap: var(--space-sm);
}

.profile-block-row {
    border: var(--border-width) solid var(--frame-color);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    background: var(--bg-soft);
}

.form-info {
    margin-top: 12px;
    color: var(--text-main);
}

.form-info a {
    color: var(--accent);
    font-weight: 600;
}

.form-info a:hover {
    color: var(--text-strong);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}

.header-btn {
    background: var(--bg-soft);
    border: var(--border-width) solid var(--border-soft);
    color: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.45rem 0.7rem;
    opacity: 0.95;
    border-radius: 10px;
    backdrop-filter: blur(var(--glass-blur));
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.header-btn:hover {
    opacity: 1;
}

.header-btn-danger {
    background-color: var(--btn-danger-fill);
    background-image: var(--btn-danger-bg-image);
    color: var(--btn-danger-text);
    border-color: var(--btn-danger-border);
    box-shadow: var(--btn-danger-shadow);
    font-weight: 700;
}

.header-btn-danger:hover {
    box-shadow: var(--btn-danger-shadow-hover);
    filter: brightness(1.04);
}

.header-btn-danger:active {
    transform: translateY(1px);
    box-shadow: var(--btn-danger-shadow-active);
}

.header-btn-danger:focus-visible {
    outline: none;
    box-shadow: var(--btn-danger-focus-shadow);
}


/* =========================================================
   STORAGE – Vermögen & Lager
========================================================= */

.storage-table-head,
.storage-row.storage-table {
    display: grid;
    grid-template-columns: 54px minmax(120px, 1fr) 120px;
    align-items: center;
    gap: 12px;
}

.asset-list .storage-row.storage-table {
    grid-template-columns: 54px minmax(120px, 1fr) 120px;
}

@media (max-width: 400px) {
    .storage-table-head,
    .storage-row.storage-table,
    .asset-list .storage-row.storage-table {
        grid-template-columns: 40px minmax(80px, 1fr) auto;
        gap: 8px;
    }
    .storage-icon {
        width: 32px;
        height: 32px;
    }
}

.storage-table-head {
    font-weight: 600;
    opacity: 0.75;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-soft-2);
    padding-left: 4px;
}

.storage-row {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-soft-3);
}

.storage-row:last-child {
    border-bottom: none;
}

.storage-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.storage-name {
    font-weight: 600;
}

.asset-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.info-btn {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1px solid var(--info-btn-border);
    background: var(--info-btn-bg);
    color: var(--info-btn-text);
    font-size: 12px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.info-btn:active {
    transform: translateY(1px);
}

.storage-desc {
    font-size: 0.85em;
    opacity: 0.75;
    line-height: 1.3;
}

.storage-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* linksbündig */
    font-weight: 600;
    white-space: nowrap;
    min-width: 0;
}

.storage-amount span {
    min-height: 1.1em;   /* reserviert Platz */
    font-size: 0.8em;
    opacity: 0.7;
}

/* Vermögen */
.asset-list {
    display: grid;
    gap: 6px;
}

.asset-row {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

/* =========================================================
   GUILD
========================================================= */

.guild-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.guild-logo {
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
}

.guild-logo-lg {
    width: 128px;
    height: 128px;
}

.guild-logo-sm {
    width: 64px;
    height: 64px;
}

.guild-logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
}

.guild-members-block {
    margin-top: 10px;
}

.guild-event-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-left: 3px solid var(--accent, #88a);
    border-radius: 4px;
    background: var(--bg-subtle, rgba(0, 0, 0, 0.04));
}

.guild-tools-row {
    margin-top: 8px;
}

.guild-tag-editor {
    margin-top: 10px;
}

.guild-tag-editor input {
    max-width: 180px;
    text-transform: uppercase;
}

.guild-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    vertical-align: middle;
}

.guild-members-list {
    max-height: 220px;
    overflow: auto;
    margin-top: 6px;
    border-top: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
}

.guild-member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guild-member-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.guild-role-select {
    min-width: 150px;
}

.guild-link-btn {
    appearance: none;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    padding: 0;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
}

.guild-link-btn:hover {
    color: var(--text-strong);
}

.guild-public-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.guild-public-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.guild-public-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.guild-public-main > div {
    min-width: 0;
}

.guild-public-main .muted {
    word-break: break-word;
}

.guild-public-actions {
    flex: 0 0 auto;
    display: grid;
    gap: 8px;
    justify-items: end;
}

.guild-hq-donate-form {
    margin-top: 12px;
}

.guild-hq-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.guild-hq-image {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
}

.guild-hq-donate-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

.guild-hq-donate-row label {
    flex: 1 1 180px;
}

.guild-hq-donate-row .guild-hq-anonymous {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-bottom: 6px;
}

.guild-hq-donations {
    margin-top: 10px;
}

.guild-hq-donation-list {
    max-height: 220px;
    overflow: auto;
    border-top: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
    margin-top: 6px;
}

.guild-hq-donation-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 6px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guild-storage-list {
    display: grid;
    gap: 6px;
}

.guild-storage-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guild-storage-row:last-child {
    border-bottom: none;
}

.guild-storage-cell {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
}

.guild-storage-cell--resource {
    gap: 8px;
}

.guild-storage-cell--amount {
    justify-content: flex-end;
    white-space: nowrap;
}

.resource-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    vertical-align: middle;
}

.guild-title-actions,
.guild-event-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.guild-title-actions label,
.guild-event-actions label {
    flex: 1 1 280px;
}

.guild-titles-list {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.guild-title-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
    border-radius: 10px;
    padding: 10px;
}

.guild-title-row.is-unlocked {
    border-color: rgba(82, 230, 150, 0.5);
}

.guild-chat-list {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.2));
    border-radius: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.guild-chat-row {
    padding: 7px 8px;
    border-radius: 8px;
    margin-bottom: 6px;
}

.guild-chat-row-chat {
    background: rgba(255, 255, 255, 0.04);
}

.guild-chat-row-system {
    background: rgba(110, 180, 255, 0.12);
    border: 1px solid rgba(110, 180, 255, 0.35);
}

.guild-chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.guild-chat-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.guild-chat-form {
    margin-top: 10px;
}

.guild-chat-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 72px;
}

.guild-invites-card {
    margin-top: 10px;
}

.guild-invite-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guild-invite-row:last-child {
    border-bottom: none;
}

.guild-invite-actions {
    display: inline-flex;
    gap: 6px;
}

.guild-invite-manage {
    display: grid;
    gap: 8px;
}

.guild-join-lock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.guild-dialog-wrap {
    display: grid;
    gap: 10px;
}

.guild-settings-grid {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    gap: 10px 12px;
    align-items: start;
}

.guild-settings-label {
    font-weight: 700;
    line-height: 1.35;
    align-self: center;
}

.guild-settings-label-top {
    align-self: start;
    padding-top: 4px;
}

.guild-settings-control {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.guild-settings-control input,
.guild-settings-control textarea,
.guild-settings-control select {
    width: min(560px, 92%);
}

.guild-settings-control #guildSettingsDescription {
    min-height: 96px;
    height: auto;
}

@media (max-width: 760px) {
    .guild-settings-grid {
        grid-template-columns: 1fr;
    }

    .guild-settings-label,
    .guild-settings-label-top {
        align-self: start;
        padding-top: 0;
    }

    .guild-settings-control input,
    .guild-settings-control textarea,
    .guild-settings-control select {
        width: 100%;
    }
}

/* =========================================================
   GLOBAL CHAT OVERLAY
========================================================= */

.global-chat-shell {
    position: fixed;
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: calc(94px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    pointer-events: none;
}

.global-chat-fab {
    border: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    line-height: 0;
    pointer-events: auto;
}

.global-chat-fab-icon {
    display: block;
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.global-chat-fab:focus-visible {
    outline: 2px solid rgba(83, 255, 153, 0.8);
    outline-offset: 2px;
}

.global-chat-panel {
    width: min(360px, calc(100vw - 24px));
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: var(--border-width) solid var(--frame-color);
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--shadow-strong);
    pointer-events: auto;
}

.global-chat-panel[hidden] {
    display: none !important;
}

.global-chat-fab[hidden] {
    display: none !important;
}

.global-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#globalChatSwitch {
    margin-bottom: 0;
}

#globalChatSwitch .switch-track {
    width: 100%;
    height: 40px;
}

#globalChatSwitch .switch-btn {
    font-size: 0.85rem;
}

#globalChatSwitch[data-active="guild"] .switch-thumb {
    transform: translateX(100%);
}

.global-chat-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
    display: grid;
    gap: 8px;
}

.global-chat-row {
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
}

.global-chat-row-system {
    border-color: rgba(110, 180, 255, 0.35);
    background: rgba(110, 180, 255, 0.12);
}

.global-chat-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.global-chat-user-btn {
    appearance: none;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.global-chat-body {
    margin-top: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

.global-chat-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.global-chat-form input {
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 760px) {
    .guild-public-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .guild-public-actions {
        width: 100%;
    }

    .guild-public-actions .btn {
        width: 100%;
    }

    .guild-title-row {
        flex-direction: column;
    }

    .guild-hq-donation-row {
        grid-template-columns: 1fr;
    }

    .guild-hq-header {
        flex-direction: column;
    }

    .guild-public-actions {
        width: 100%;
        justify-items: stretch;
    }

    .guild-member-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .guild-member-actions {
        width: 100%;
    }

    .guild-role-select {
        flex: 1 1 auto;
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .global-chat-shell {
        right: 10px;
        left: 10px;
        bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    }

    .global-chat-fab {
        margin-left: auto;
    }

    .global-chat-panel {
        width: 100%;
    }
}

/* =====================================================
   COMMUNITY HUB
===================================================== */

.community-layout {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(260px, 1.2fr) minmax(300px, 1.8fr);
    gap: 12px;
    align-items: start;
}

.community-mobile-nav {
    display: none;
}

.community-mobile-tab {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(8, 14, 20, 0.45);
    color: inherit;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
}

.community-mobile-tab.is-active {
    border-color: rgba(83, 255, 153, 0.76);
    box-shadow: 0 0 0 1px rgba(83, 255, 153, 0.35), 0 0 10px rgba(83, 255, 153, 0.2);
}

.community-col {
    min-height: 480px;
}

.community-topic-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.community-topic-toolbar .input {
    min-width: 180px;
    max-width: 280px;
}

.community-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.community-item {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(8, 14, 20, 0.45);
    border-radius: 12px;
    color: inherit;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.community-item:hover {
    border-color: rgba(83, 255, 153, 0.4);
}

.community-item.is-active {
    border-color: rgba(83, 255, 153, 0.76);
    box-shadow: 0 0 0 1px rgba(83, 255, 153, 0.45), 0 0 12px rgba(83, 255, 153, 0.2);
}

.community-posts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 62vh;
    overflow: auto;
    padding-right: 4px;
}

.community-post {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(8, 14, 20, 0.48);
    padding: 10px 12px;
}

.community-post-head,
.community-post-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.community-post-body {
    margin: 8px 0 10px;
    line-height: 1.45;
    word-break: break-word;
}

.community-topic-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.community-post-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.community-pagination {
    display: flex;
    justify-content: center;
    margin: 4px 0 10px;
}

.community-poll {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(8, 14, 20, 0.42);
    margin-bottom: 10px;
}

.community-poll h3 {
    margin: 0 0 4px 0;
}

.community-poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.community-poll-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px 10px;
}

.community-poll-option.is-own {
    border-color: rgba(83, 255, 153, 0.45);
    box-shadow: 0 0 0 1px rgba(83, 255, 153, 0.2);
}

@media (max-width: 1100px) {
    .community-mobile-nav {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 10px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .community-layout {
        grid-template-columns: 1fr;
    }

    .community-col {
        min-height: 0;
    }

    .community-col.is-mobile-hidden {
        display: none;
    }

    .community-posts {
        max-height: none;
    }

    .community-topic-toolbar {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .community-topic-toolbar .input {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }
}

/* =====================================================
   BOSS EVENT
===================================================== */

.boss-card { display: flex; flex-direction: column; gap: 12px; }

.boss-hp-bar-container {
    background: var(--bg-alt, #2a2a2a);
    border-radius: 6px;
    height: 20px;
    overflow: hidden;
    border: 1px solid var(--frame-color, #444);
}

.boss-hp-bar {
    height: 100%;
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    transition: width 0.5s ease;
}

.boss-hp-label { font-size: 0.85rem; color: var(--muted-color, #888); }

.boss-my-stats {
    font-size: 0.9rem;
    padding: 6px 10px;
    background: var(--bg-alt, #2a2a2a);
    border-radius: 4px;
    color: var(--text-strong, #f2f2f2);
    border: var(--border-width) solid var(--border-soft-2, rgba(255, 255, 255, 0.15));
}

.boss-stats-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-strong, #f2f2f2);
}

.boss-stats-table th,
.boss-stats-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-soft-2, rgba(255, 255, 255, 0.14));
    text-align: left;
    vertical-align: top;
}

.boss-stats-table th {
    font-weight: 700;
    color: var(--text-muted, #d0d0d0);
}

.boss-actions { margin-top: 8px; }

.boss-defeated-banner { text-align: center; padding: 2rem 1rem; }

/* Boss-Event Card in Adventures/Events-Tab */
.boss-event-link-card {
    margin-bottom: 0;
}
.boss-event-link-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}
.boss-event-icon { font-size: 1.5em; flex-shrink: 0; }
.boss-event-info { flex: 1; min-width: 0; }
.boss-event-arrow { font-size: 1.3em; color: var(--muted-color, #888); flex-shrink: 0; }
.boss-event-hp-bar-mini-container {
    height: 4px;
    background: var(--bg-alt, #2a2a2a);
    border-radius: 2px;
    margin: 4px 0;
    overflow: hidden;
}
.boss-event-hp-bar-mini {
    height: 100%;
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Boss-Event Bild-Card */
.boss-image-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: var(--space-md);
    border-radius: 14px;
    line-height: 0;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.boss-event-image {
    max-width: 100%;
    max-height: 40vh;
    width: auto;
    height: auto;
    display: block;
}

@media (orientation: portrait) {
    .boss-image-card {
        width: 100%;
    }
    .boss-event-image {
        width: 100%;
        max-height: 42vh;
        height: 42vh;
        object-fit: cover;
    }
}

/* ── Dungeon-Portal Overlay ───────────────────────────────────────── */
#dungeon-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #000;
}

#dungeon-overlay iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

#dungeon-overlay-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 100000;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 6px;
    font-size: 18px;
    padding: 4px 10px;
    cursor: pointer;
    line-height: 1;
}

#dungeon-overlay-close:hover {
    background: rgba(255, 255, 255, .15);
}

@media (orientation: portrait) {
    #dungeon-overlay {
        overflow: hidden;
    }
    #dungeon-overlay iframe {
        width: 100vh;
        height: 100vw;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
    }
}
