html, body {
    font-family: 'Segoe UI', sans-serif;
    background: #1E1E2E;
    color: #F8F8F2;
    margin: 0;
}

:root {
    /* OS-reported safe-area insets (status bar, camera cutout, gesture/nav bar).
       Populated on Android/iOS when the WebView uses viewport-fit=cover and the
       window lays out into the cutout. Fall back to 0 where unsupported. */
    --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);
}

*, *::before, *::after {
    box-sizing: border-box;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #1E1E2E;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.shell {
    padding: 1.5rem;
    padding-left: calc(1.5rem + var(--safe-left));
    padding-right: calc(1.5rem + var(--safe-right));
    padding-bottom: calc(1.5rem + var(--safe-bottom));
    width: 100%;
    max-width: 100%;
}

.top-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr minmax(0, 2fr) 1fr;
    align-items: center;
    gap: 0.75rem;
    margin: calc(-1.5rem - var(--safe-top)) calc(-1.5rem - var(--safe-right)) 1rem calc(-1.5rem - var(--safe-left));
    padding: calc(0.4rem + var(--safe-top)) calc(1.5rem + var(--safe-right)) 0.4rem calc(1.5rem + var(--safe-left));
    background: #181825;
    border-bottom: 1px solid rgba(137, 180, 250, 0.25);
    min-height: 3rem;
    box-sizing: border-box;
}

.shell > header {
    position: sticky;
    top: calc(3rem + var(--safe-top));
    z-index: 19;
    margin: 0 -1.5rem 1rem;
    padding: 0.5rem 1.5rem 0;
    background: #1E1E2E;
}

.current-action-bar {
    grid-column: 2;
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.header-stats {
    grid-column: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-stat {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.header-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c7086;
}

.header-stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f8f8f2;
    white-space: nowrap;
}

.current-action-bar.is-idle {
    color: #6c7086;
}

.top-header .connection-status {
    grid-column: 3;
    justify-self: end;
}

.current-action-icon {
    font-size: 1rem;
    line-height: 1;
}

.current-action-text {
    font-weight: 600;
    white-space: nowrap;
}

.current-action-bar-track {
    flex: 1;
    min-width: 3rem;
    max-width: 16rem;
    height: 0.45rem;
    border-radius: 0.5rem;
    background: rgba(137, 180, 250, 0.2);
    overflow: hidden;
}

.current-action-bar-fill {
    display: block;
    height: 100%;
    background: #89b4fa;
    transition: width 0.4s ease;
}

.current-action-detail {
    color: #bac2de;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

header h1 {
    margin-bottom: 0.25rem;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    background: rgba(248, 248, 242, 0.08);
}

.connection-status .connection-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #6c7086;
}

.connection-status .clock-stat {
    padding-left: 0.5rem;
    margin-left: 0.4rem;
    border-left: 1px solid rgba(248, 248, 242, 0.18);
    font-variant-numeric: tabular-nums;
    color: #bac2de;
    white-space: nowrap;
}

.connection-status.is-connected .connection-dot {
    background: #a6e3a1;
    box-shadow: 0 0 0.4rem #a6e3a1;
}

.connection-status.is-connecting .connection-dot {
    background: #f9e2af;
    animation: connection-pulse 1s ease-in-out infinite;
}

.connection-status.is-disconnected .connection-dot {
    background: #f38ba8;
}

@keyframes connection-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 1.5rem;
    text-align: center;
}

.auth-loading .spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 0.3rem solid rgba(248, 248, 242, 0.2);
    border-top-color: #F8F8F2;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

.character-create {
    max-width: 24rem;
    margin: 2rem auto;
}

.character-create-intro {
    color: #bac2de;
    margin-bottom: 1.5rem;
}

.character-create .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.character-create input {
    padding: 0.5rem 0.6rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(248, 248, 242, 0.2);
    background: rgba(248, 248, 242, 0.06);
    color: #F8F8F2;
}

.character-create button,
.auth-loading button {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 0.4rem;
    background: #89b4fa;
    color: #1E1E2E;
    font-weight: 600;
    cursor: pointer;
}

.character-create button:disabled {
    opacity: 0.6;
    cursor: default;
}

.character-create-error {
    color: #f38ba8;
    margin-top: 0.75rem;
}

.game-view {
    width: 100%;
    max-width: 100%;
    margin: 1rem auto;
}

.character-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.character-header h2 {
    margin: 0;
}

.character-level {
    color: #f9e2af;
    font-weight: 600;
}

.character-status {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    background: rgba(248, 248, 242, 0.08);
}

.character-status.is-online {
    color: #a6e3a1;
}

.character-status.is-offline {
    color: #6c7086;
}

.character-health {
    margin: 1rem 0 1.5rem;
}

.health-bar {
    height: 0.9rem;
    border-radius: 0.5rem;
    background: rgba(243, 139, 168, 0.2);
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: #a6e3a1;
    transition: width 0.3s ease;
}

.health-text {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #bac2de;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c7086;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Current action */
.action-panel {
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    margin-bottom: 1.5rem;
}

.game-event-panel {
    border: 1px solid rgba(249, 226, 175, 0.25);
}

.bonus-card {
    border: 1px solid rgba(166, 227, 161, 0.25);
    background: rgba(166, 227, 161, 0.07);
}

.bonus-value {
    color: #a6e3a1;
}

.game-event-description {
    margin: 0 0 1rem;
    color: #bac2de;
}

.game-event-rewards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.75rem;
}

.action-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

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

.action-runs {
    font-size: 0.85rem;
    color: #bac2de;
}

.action-bar {
    height: 0.7rem;
    border-radius: 0.5rem;
    background: rgba(137, 180, 250, 0.2);
    overflow: hidden;
}

.action-fill {
    height: 100%;
    background: #89b4fa;
    transition: width 0.3s ease;
}

.action-progress {
    margin-bottom: 0.5rem;
}

.action-bar-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c7086;
}

.action-bar-interval {
    background: rgba(250, 179, 135, 0.2);
}

.action-fill-interval {
    background: #fab387;
    transition: width 0.2s linear;
}

.action-time {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #bac2de;
}

.action-idle {
    margin: 0 0 0.5rem;
    color: #6c7086;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.action-button {
    padding: 0.5rem 0.9rem;
    border: none;
    border-radius: 0.5rem;
    background: #89b4fa;
    color: #11111b;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.action-button:hover {
    opacity: 0.85;
}

.action-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.action-error {
    margin-top: 0.6rem;
    color: #f38ba8;
    font-size: 0.85rem;
}

/* Skills */
.skills-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.skill-row {
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
}

.skill-row-button {
    display: block;
    width: 100%;
    border: none;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.skill-row-button:hover {
    background: rgba(248, 248, 242, 0.12);
}

.skill-header-card {
    margin-bottom: 0.75rem;
}

.skill-actions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skill-action-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skill-action-products {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #a6e3a1;
}

.skill-action-requirements {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #6c7086;
}

.skill-action-req-label {
    font-weight: 600;
}

.skill-action-req {
    padding: 0.1rem 0.4rem;
    border-radius: 0.4rem;
    background: rgba(248, 248, 242, 0.08);
}

.skill-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.35rem;
}

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

.skill-level {
    font-size: 0.85rem;
    color: #a6e3a1;
}

.skill-bar {
    height: 0.6rem;
    border-radius: 0.5rem;
    background: rgba(166, 227, 161, 0.2);
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    background: #a6e3a1;
    transition: width 0.3s ease;
}

.skill-xp {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: #6c7086;
}

/* Navigation */
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    justify-content: center;
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.55rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    color: #bac2de;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-icon {
    font-size: 1.15rem;
    line-height: 1;
}

/* Labels are hidden on small screens (icon-only) and shown alongside icons on wider screens */
.nav-label {
    display: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

@media (min-width: 1024px) {
    .nav-links .nav-link {
        gap: 0.4rem;
        padding: 0.4rem 0.75rem;
    }

    .nav-label {
        display: inline;
    }
}

@media (max-width: 575px) {
    .page-submenu-label {
        display: none;
    }
}

.nav-link:hover {
    background: rgba(137, 180, 250, 0.2);
}

.nav-link.active {
    background: #89b4fa;
    color: #11111b;
}

/* In-page submenu (tab bar shown on grouped pages) */
.page-submenu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.page-submenu .nav-link {
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
}

.page-submenu .nav-link .nav-icon {
    font-size: 1rem;
}

.page-submenu-label {
    font-size: 0.9rem;
}

/* Inventory */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.inventory-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.inventory-card:hover,
.inventory-card:focus-visible {
    background: rgba(248, 248, 242, 0.12);
    border-color: rgba(137, 180, 250, 0.6);
    outline: none;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.equipment-slot {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid rgba(248, 248, 242, 0.08);
}

.equipment-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.equipment-slot-name {
    font-weight: 600;
}

.equipment-slot-item {
    opacity: 0.8;
}

.equipment-slot-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.equipment-select {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    background: rgba(248, 248, 242, 0.08);
    color: inherit;
    border: 1px solid rgba(248, 248, 242, 0.15);
    font: inherit;
}

.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.knowledge-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid rgba(248, 248, 242, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.knowledge-card.knowledge-unlocked {
    border-color: rgba(166, 227, 161, 0.5);
    background: rgba(166, 227, 161, 0.08);
}

.knowledge-card.knowledge-locked {
    opacity: 0.6;
    filter: grayscale(0.4);
}

.knowledge-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.knowledge-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.knowledge-description {
    opacity: 0.8;
    font-size: 0.9rem;
}

.knowledge-unlocked-at {
    opacity: 0.6;
    font-size: 0.75rem;
}

.monster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.monster-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid rgba(248, 248, 242, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.monster-card.monster-discovered {
    border-color: rgba(243, 139, 168, 0.5);
    background: rgba(243, 139, 168, 0.08);
}

.monster-card.monster-locked {
    opacity: 0.6;
    filter: grayscale(0.4);
}

.monster-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.monster-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

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

.monster-description {
    opacity: 0.8;
    font-size: 0.9rem;
}

.monster-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.75;
}

.monster-stat {
    padding: 0.1rem 0.4rem;
    border-radius: 0.35rem;
    background: rgba(248, 248, 242, 0.08);
}

.combat-active {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid rgba(243, 139, 168, 0.4);
}

.action-bar-combat {
    background: rgba(243, 139, 168, 0.18);
}

.action-fill-combat {
    background: linear-gradient(90deg, #f38ba8, #eb6f92);
}

.market-create {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid rgba(248, 248, 242, 0.08);
}

.market-create h3 {
    margin: 0 0 0.5rem;
}

.market-create-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.market-create-form select,
.market-create-form input,
.market-buy input {
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    background: rgba(248, 248, 242, 0.08);
    color: inherit;
    border: 1px solid rgba(248, 248, 242, 0.15);
    font: inherit;
}

.market-create-form input[type="number"],
.market-buy input[type="number"] {
    width: 6rem;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.market-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid rgba(248, 248, 242, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.market-card:hover {
    background: rgba(248, 248, 242, 0.12);
    border-color: rgba(137, 180, 250, 0.6);
}

.market-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.market-item-name {
    font-weight: 600;
}

.market-seller {
    opacity: 0.8;
    font-size: 0.9rem;
}

.market-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.75;
}

.market-stat {
    padding: 0.1rem 0.4rem;
    border-radius: 0.35rem;
    background: rgba(248, 248, 242, 0.08);
}

.market-own {
    font-size: 0.8rem;
    opacity: 0.7;
    font-style: italic;
}

.market-buy {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.25rem;
}

.item-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(17, 17, 27, 0.75);
    backdrop-filter: blur(3px);
}

.item-modal {
    position: relative;
    max-width: 24rem;
    width: 100%;
    padding: 1.75rem;
    border-radius: 0.75rem;
    background: #1e1e2e;
    border: 1px solid rgba(248, 248, 242, 0.1);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
}

.item-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #bac2de;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.item-modal-close:hover {
    color: #f8f8f2;
}

.item-modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    color: #f8f8f2;
}

.item-rarity {
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(248, 248, 242, 0.1);
    color: #cdd6f4;
}

.item-rarity-common { color: #cdd6f4; }
.item-rarity-uncommon { color: #a6e3a1; }
.item-rarity-rare { color: #89b4fa; }
.item-rarity-epic { color: #cba6f7; }
.item-rarity-legendary { color: #f9e2af; }

.item-modal-description {
    margin: 0 0 1.25rem;
    color: #bac2de;
    line-height: 1.5;
}

.item-modal-stats {
    display: flex;
    gap: 1.5rem;
    margin: 0;
}

.item-modal-stats div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-modal-stats dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7f849c;
}

.item-modal-stats dd {
    margin: 0;
    font-size: 1.1rem;
    color: #f8f8f2;
}

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

.inventory-quantity {
    font-size: 1.25rem;
    color: #a6e3a1;
}

.offline-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(17, 17, 27, 0.92);
    backdrop-filter: blur(4px);
}

.offline-card {
    max-width: 26rem;
    width: 100%;
    text-align: center;
    padding: 2.5rem 2rem;
    border-radius: 0.75rem;
    background: #1e1e2e;
    border: 1px solid rgba(248, 248, 242, 0.1);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5);
}

.offline-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.offline-title {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
    color: #f8f8f2;
}

.offline-message {
    margin: 0 0 1.75rem;
    color: #bac2de;
    line-height: 1.5;
}

.offline-checking {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: #9399b2;
    font-size: 0.9rem;
}

.offline-checking .spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 0.2rem solid rgba(248, 248, 242, 0.2);
    border-top-color: #f8f8f2;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

.progress-toasts {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.progress-toast {
    min-width: 10rem;
    max-width: 18rem;
    padding: 0.55rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #11111b;
    background: #cdd6f4;
    border-left: 0.25rem solid #6c7086;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.45);
    animation: toast-in 0.25s ease-out;
}

.progress-toast.toast-xp {
    background: rgba(137, 180, 250, 0.95);
    border-left-color: #89b4fa;
}

.progress-toast.toast-gold {
    background: rgba(249, 226, 175, 0.95);
    border-left-color: #f9e2af;
}

.progress-toast.toast-item {
    background: rgba(166, 227, 161, 0.95);
    border-left-color: #a6e3a1;
}

.progress-toast.toast-knowledge {
    background: rgba(203, 166, 247, 0.95);
    border-left-color: #cba6f7;
}

.progress-toast.toast-monster {
    background: rgba(250, 179, 135, 0.95);
    border-left-color: #fab387;
}

.progress-toast.toast-action {
    background: rgba(148, 226, 213, 0.95);
    border-left-color: #94e2d5;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(1rem);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Error popup toasts ───────────────────────────────────────────────────── */

.error-toasts {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.error-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 16rem;
    max-width: 28rem;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #11111b;
    background: rgba(243, 139, 168, 0.95);
    border-left: 4px solid #f38ba8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: all;
    animation: toast-in 0.25s ease-out;
}

.error-toast-message {
    flex: 1;
}

.error-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #11111b;
    font-size: 0.9rem;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.error-toast-close:hover {
    opacity: 1;
}

/* ── Notification toasts ─────────────────────────────────────────────────── */

.notification-toasts {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1150;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.notification-toast {
    min-width: 14rem;
    max-width: 20rem;
    padding: 0.6rem 0.9rem;
    border-radius: 0.5rem;
    color: #cdd6f4;
    background: rgba(30, 30, 46, 0.97);
    border-left: 0.25rem solid #89b4fa;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.45);
    animation: toast-in 0.25s ease-out;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.notification-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.notification-toast-title {
    font-weight: 700;
    font-size: 0.9rem;
}

.notification-toast-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #89b4fa;
}

.notification-toast-message {
    font-size: 0.85rem;
    color: #bac2de;
}

/* ── Nav unread badge ────────────────────────────────────────────────────── */

.nav-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.3rem;
    border-radius: 0.6rem;
    background: #f38ba8;
    color: #11111b;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}


.notification-actions {
    display: flex;
    gap: 0.5rem;
}

.notification-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.notification-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.06);
    border: 1px solid rgba(248, 248, 242, 0.08);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.notification-card.notification-unread {
    border-color: rgba(139, 233, 253, 0.5);
    background: rgba(139, 233, 253, 0.08);
}

.notification-card.notification-read {
    opacity: 0.65;
}

.notification-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.notification-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.notification-title {
    font-weight: 600;
}

.notification-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1em 0.45em;
    border-radius: 0.25em;
    background: rgba(248, 248, 242, 0.1);
    color: rgba(248, 248, 242, 0.75);
    white-space: nowrap;
}

.notification-category-action    { background: rgba(80, 250, 123, 0.15);  color: rgb(80, 250, 123); }
.notification-category-combat     { background: rgba(255, 85, 85, 0.15);   color: rgb(255, 85, 85); }
.notification-category-raid-boss  { background: rgba(255, 121, 198, 0.15); color: rgb(255, 121, 198); }
.notification-category-hunt       { background: rgba(255, 184, 108, 0.15); color: rgb(255, 184, 108); }
.notification-category-dungeon    { background: rgba(189, 147, 249, 0.15); color: rgb(189, 147, 249); }

.notification-message {
    font-size: 0.9rem;
}

.notification-time {
    font-size: 0.75rem;
    opacity: 0.6;
}

.notification-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: rgb(139, 233, 253);
    margin-top: 0.35rem;
    flex-shrink: 0;
}


/* ── Daily Reward ────────────────────────────────────────────────────────── */
.daily-reward-panel {
    background: rgba(30, 30, 46, 0.7);
    border: 1px solid rgba(203, 166, 247, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.daily-streak-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.daily-streak-label {
    color: #a6adc8;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.daily-streak-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #cba6f7;
}

.daily-streak-badge {
    background: rgba(243, 139, 168, 0.2);
    border: 1px solid rgba(243, 139, 168, 0.4);
    color: #f38ba8;
    border-radius: 1rem;
    padding: 0.15rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.daily-streak-track {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.daily-streak-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(166, 173, 200, 0.2);
    gap: 0.2rem;
    font-size: 0.75rem;
    transition: transform 0.1s;
}

.streak-day-number {
    font-weight: 700;
    font-size: 0.8rem;
}

.streak-day-icon {
    font-size: 0.85rem;
}

.streak-day-claimed {
    background: rgba(166, 227, 161, 0.15);
    border-color: rgba(166, 227, 161, 0.4);
    color: #a6e3a1;
}

.streak-day-pending {
    background: rgba(30, 30, 46, 0.4);
    color: #585b70;
}

.streak-day-bonus {
    background: rgba(250, 179, 135, 0.15);
    border-color: rgba(250, 179, 135, 0.5);
    color: #fab387;
}

.streak-day-bonus.streak-day-claimed {
    background: rgba(250, 179, 135, 0.3);
}

.daily-reward-preview h3 {
    color: #cdd6f4;
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.reward-card-bonus {
    border-color: rgba(250, 179, 135, 0.5) !important;
    background: rgba(250, 179, 135, 0.08) !important;
}

.reward-card-bonus .stat-value {
    color: #fab387;
}

.daily-claim-btn {
    width: 100%;
    font-size: 1rem;
    padding: 0.75rem;
}

.daily-reward-claimed {
    background: rgba(166, 227, 161, 0.12);
    border: 1px solid rgba(166, 227, 161, 0.3);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: #a6e3a1;
    font-size: 0.9rem;
    text-align: center;
}

.daily-reward-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: #a6adc8;
    font-size: 0.9rem;
}

.daily-timer-value {
    color: #89dceb;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ── Raid boss health bars ─────────────────────────────────────── */
.phase-badge {
    font-weight: 600;
    color: #cba6f7;
}

.raid-health-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.75rem 0;
}

.raid-health-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #a6adc8;
}

.raid-health-bar {
    height: 12px;
    background: #313244;
    border-radius: 6px;
    overflow: hidden;
}

.raid-health-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.raid-health-fill.boss-health {
    background: linear-gradient(90deg, #f38ba8, #eba0ac);
}

.raid-health-fill.player-health {
    background: linear-gradient(90deg, #a6e3a1, #94e2d5);
}

/* ── Medals ─────────────────────────────────────────────────────── */

.medal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.medal-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(248, 248, 242, 0.06);
}

.medal-card.medal-unlocked {
    border-color: rgba(249, 226, 175, 0.5);
    background: rgba(249, 226, 175, 0.08);
}

.medal-card.medal-locked {
    opacity: 0.6;
    filter: grayscale(0.4);
}

.medal-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.medal-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

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

.medal-description {
    opacity: 0.8;
    font-size: 0.9rem;
}

.medal-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.medal-progress-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.medal-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #f9e2af, #fab387);
    transition: width 0.4s ease;
}

.medal-progress-label {
    font-size: 0.72rem;
    opacity: 0.65;
    white-space: nowrap;
}

/* Login / register game-style screen */
.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: calc(1.5rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1.5rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
    color: #f4ead5;
}

.auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at center, rgba(10, 12, 24, 0.15) 0%, rgba(5, 6, 14, 0.85) 100%),
        linear-gradient(180deg, rgba(5, 6, 14, 0.3) 0%, rgba(5, 6, 14, 0.75) 100%),
        url('../images/Loading.jpg') center / cover no-repeat;
    animation: auth-backdrop-drift 30s ease-in-out infinite alternate;
}

@keyframes auth-backdrop-drift {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

.auth-content {
    width: 100%;
    max-width: 420px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    animation: auth-rise 0.6s ease-out both;
}

@keyframes auth-rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-logo {
    width: clamp(96px, 28vw, 160px);
    height: auto;
    filter: drop-shadow(0 0 18px rgba(255, 196, 92, 0.55));
}

.auth-title {
    margin: 0.5rem 0 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.9rem, 7vw, 2.75rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #fff3c4 0%, #e8b14a 55%, #a8661c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.auth-subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.6em;
    text-transform: uppercase;
    color: #d9c7a0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.auth-panel {
    width: 100%;
    padding: 1.5rem;
    border: 1px solid rgba(232, 177, 74, 0.55);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(28, 22, 16, 0.88) 0%, rgba(14, 11, 9, 0.92) 100%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 12px 40px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 230, 170, 0.15);
    backdrop-filter: blur(4px);
}

.auth-panel-title {
    margin: 0 0 1rem;
    text-align: center;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.25rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e8b14a;
}

.auth-panel label {
    color: #d9c7a0;
}

.auth-panel .ui-input {
    background: rgba(0, 0, 0, 0.45);
    border-color: rgba(232, 177, 74, 0.35);
    color: #f4ead5;
}

.auth-panel .ui-input:focus {
    border-color: #e8b14a;
    box-shadow: 0 0 0 2px rgba(232, 177, 74, 0.3);
    outline: none;
}

.auth-panel hr {
    border: 0;
    border-top: 1px solid rgba(232, 177, 74, 0.25);
    margin: 1rem 0;
}

.auth-submit {
    width: 100%;
    padding-block: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #f0c060 0%, #b8771f 100%);
    border: 1px solid #7a4a10;
    color: #2a1a06;
    box-shadow: 0 4px 14px rgba(232, 177, 74, 0.35);
}

.auth-submit:hover {
    filter: brightness(1.1);
}

.auth-footer {
    text-align: center;
    color: #d9c7a0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.auth-footer a {
    color: #f0c060;
    font-weight: 600;
}

/* Combat header: always-visible combat summary shown during combat-based actions. */
.combat-header {
    margin: 0 0 1rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid rgba(243, 139, 168, 0.35);
    border-radius: 0.6rem;
    background: #181825;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.combat-header-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.combat-header-name {
    font-weight: 700;
}

.combat-header-subtitle {
    color: #bac2de;
    font-size: 0.85rem;
}

.combat-header-time {
    margin-left: auto;
    color: #bac2de;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.combat-header-bars {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
}

.combat-header-versus {
    color: #6c7086;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.combat-header-label {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
    font-variant-numeric: tabular-nums;
}

.combat-header-track {
    height: 0.6rem;
    border-radius: 0.5rem;
    background: rgba(248, 248, 242, 0.1);
    overflow: hidden;
}

.combat-header-fill {
    display: block;
    height: 100%;
    transition: width 0.4s ease;
}

.combat-header-fill.is-player {
    background: #a6e3a1;
}

.combat-header-fill.is-enemy {
    background: #f38ba8;
}

.combat-header-fill.is-progress {
    background: #89b4fa;
}

.combat-header-progress {
    font-size: 0.8rem;
    color: #bac2de;
    font-variant-numeric: tabular-nums;
}

.combat-header-log {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.combat-header-log li.is-dealt {
    color: #f9e2af;
}

.combat-header-log li.is-taken {
    color: #f38ba8;
}

.combat-header-log li:not(:first-child) {
    opacity: 0.65;
}

@media (max-width: 600px) {
    .combat-header-bars {
        grid-template-columns: 1fr;
    }

    .combat-header-versus {
        display: none;
    }
}
