:root {
    --bg: #050814;
    --panel: #0b1223e8;
    --panel-solid: #0b1223;
    --panel-border: #273757;
    --text: #f5f7ff;
    --muted: #93a4c7;
    --cyan: #4dd9ff;
    --blue: #2477e8;
    --amber: #ffbd42;
    --orange: #ff782c;
    --red: #ff4d3d;
    --green: #62e6ad;
    --shadow: #02040bdd;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 50% -20%, #23335b 0, transparent 38%),
        linear-gradient(160deg, #060a16, #02040a 70%);
    font-family: "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
    overflow-x: hidden;
}

button {
    color: inherit;
    font: inherit;
}

.app-shell {
    width: min(100%, 1680px);
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-rows: 82px 1fr 72px;
    background: linear-gradient(90deg, #050916aa, transparent 22%, transparent 78%, #050916aa);
}

.topbar {
    position: relative;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding: 12px clamp(18px, 3vw, 42px);
    background: linear-gradient(180deg, #111a31f5, #070c19e8);
    border-bottom: 1px solid #334668;
    box-shadow: 0 12px 30px #02040b99;
}

.brand,
.top-resources,
.player-card,
.monster-title,
.recommend-block,
.map-toolbar,
.map-legend,
.panel-card header,
.mastery-row {
    display: flex;
    align-items: center;
}

.brand {
    gap: 12px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 2px solid var(--amber);
    border-radius: 14px 14px 18px 18px;
    color: var(--amber);
    background: linear-gradient(145deg, #263b69, #0b1429);
    font-size: 1.55rem;
    font-weight: 1000;
    box-shadow: inset 0 0 16px #4dd9ff22, 0 0 18px #ffbd4222;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    letter-spacing: .18em;
    font-size: 1.12rem;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .61rem;
    letter-spacing: .13em;
}

.campaign-title {
    min-width: min(440px, 38vw);
    text-align: center;
}

.campaign-title > span {
    color: var(--amber);
    font-size: .66rem;
    letter-spacing: .23em;
}

.campaign-title > strong {
    display: block;
    margin: 2px 0 8px;
    font-size: clamp(1rem, 1.5vw, 1.35rem);
    letter-spacing: .16em;
}

.campaign-progress {
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: #263450;
}

.campaign-progress i {
    display: block;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--amber));
    box-shadow: 0 0 14px var(--cyan);
    transition: width .45s ease;
}

.top-resources {
    justify-content: flex-end;
    gap: 12px;
}

.top-resources > div {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 104px;
    padding: 10px 14px;
    border: 1px solid #34476b;
    border-radius: 10px;
    background: #0a1122cc;
}

.resource-gem {
    color: var(--cyan);
    text-shadow: 0 0 12px var(--cyan);
}

.icon-button,
.map-focus-button {
    border: 1px solid #3b4f74;
    background: #0c1529;
    cursor: pointer;
}

.icon-button {
    width: 42px;
    height: 42px;
    border-radius: 11px;
}

.lobby-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(220px, 270px) minmax(430px, 1fr) minmax(280px, 340px);
    gap: 14px;
    padding: 14px;
}

.side-panel,
.map-section {
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    background: linear-gradient(160deg, #101a30ef, #070c19ef);
    box-shadow: 0 22px 42px var(--shadow), inset 0 1px #ffffff0d;
}

.left-panel {
    padding: 16px;
}

.player-card {
    gap: 12px;
    padding: 4px 2px 18px;
    border-bottom: 1px solid #2b3b59;
}

.player-avatar {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    background: radial-gradient(circle at 35% 30%, #334f87, #111a30 70%);
    color: var(--cyan);
    font-weight: 900;
    box-shadow: 0 0 18px #4dd9ff33;
}

.player-card small,
.player-card strong,
.player-card span {
    display: block;
}

.player-card small,
.info-block small,
.recommend-block small,
.reward-block small {
    color: var(--amber);
    font-size: .63rem;
    letter-spacing: .15em;
}

.player-card span {
    margin-top: 3px;
    color: var(--muted);
    font-size: .78rem;
}

.panel-card {
    margin-top: 14px;
    padding: 15px;
    border: 1px solid #293a5a;
    border-radius: 14px;
    background: linear-gradient(150deg, #111b31cc, #080e1dcc);
}

.panel-card header,
.mastery-row {
    justify-content: space-between;
}

.panel-card header span {
    color: var(--muted);
    font-size: .78rem;
}

.panel-card header b {
    color: var(--amber);
    font-size: .66rem;
    letter-spacing: .13em;
}

.objective-card > strong {
    display: block;
    margin-top: 15px;
    font-size: 1.03rem;
}

.objective-card p {
    min-height: 62px;
    margin: 7px 0 14px;
    color: var(--muted);
    font-size: .81rem;
    line-height: 1.55;
}

.objective-reward {
    padding: 10px;
    border-radius: 10px;
    background: #060b17aa;
}

.objective-reward span,
.objective-reward b {
    display: block;
}

.objective-reward span {
    color: var(--muted);
    font-size: .67rem;
}

.objective-reward b {
    margin-top: 3px;
    color: var(--cyan);
}

.mastery-row {
    margin-top: 14px;
    color: var(--muted);
    font-size: .8rem;
}

.mastery-row strong {
    color: var(--text);
}

.secondary-button,
.text-button {
    width: 100%;
    cursor: pointer;
}

.secondary-button {
    margin-top: 16px;
    padding: 10px;
    border: 1px solid #40608d;
    border-radius: 9px;
    background: #142443;
    color: var(--cyan);
    font-size: .72rem;
    letter-spacing: .05em;
}

.text-button {
    padding: 8px;
    border: 0;
    background: none;
    color: #6f82a8;
    font-size: .7rem;
}

.map-section {
    position: relative;
    display: grid;
    grid-template-rows: 46px minmax(0, 1fr) 42px;
    background: #050916;
}

.map-toolbar,
.map-legend {
    position: relative;
    z-index: 10;
    justify-content: space-between;
    padding: 0 14px;
    background: #080f20e8;
}

.map-toolbar {
    border-bottom: 1px solid #2d3e5d;
    font-size: .76rem;
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 10px var(--amber);
}

.map-focus-button {
    padding: 7px 11px;
    border-radius: 8px;
    color: var(--muted);
    font-size: .7rem;
}

.map-scroller {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: #516687 #080e1d;
    scrollbar-width: thin;
    background: #030610;
}

.map-canvas {
    position: relative;
    width: min(100%, 690px);
    aspect-ratio: 2 / 3;
    min-height: 980px;
    margin: 0 auto;
    overflow: hidden;
    background: url("assets/backgrounds/lobby-volcano-map.png") center / cover no-repeat;
    isolation: isolate;
}

.map-canvas::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(90deg, #02040a77, transparent 16%, transparent 84%, #02040a77);
    pointer-events: none;
}

.route-lines,
.stage-nodes {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.route-lines {
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.route-base,
.route-progress {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.route-base {
    stroke: #09101eee;
    stroke-width: 9;
    filter: drop-shadow(0 3px 4px #000);
}

.route-progress {
    stroke: var(--amber);
    stroke-width: 3;
    filter: drop-shadow(0 0 6px #ff9b2f);
    transition: all .55s ease;
}

.stage-nodes {
    z-index: 3;
}

.stage-node {
    position: absolute;
    width: 70px;
    height: 70px;
    padding: 0;
    translate: -50% -50%;
    border: 3px solid #45516a;
    border-radius: 50%;
    background: radial-gradient(circle, #18233b 0 55%, #070b15 57%);
    box-shadow: 0 5px 15px #000c, inset 0 0 0 4px #090d18;
    cursor: pointer;
    transition: scale .18s ease, filter .18s ease, border-color .18s ease;
}

.stage-node:hover,
.stage-node:focus-visible,
.stage-node.selected {
    z-index: 5;
    scale: 1.12;
    outline: none;
}

.stage-node img {
    width: 88%;
    height: 88%;
    object-fit: contain;
    filter: drop-shadow(0 4px 4px #000b);
}

.stage-node .node-number {
    position: absolute;
    left: 50%;
    bottom: -13px;
    min-width: 34px;
    padding: 2px 6px;
    translate: -50% 0;
    border-radius: 7px;
    background: #060a14;
    border: 1px solid currentColor;
    color: inherit;
    font-size: .65rem;
    font-weight: 900;
}

.stage-node .node-stars {
    position: absolute;
    top: -16px;
    left: 50%;
    translate: -50% 0;
    color: var(--amber);
    font-size: .62rem;
    white-space: nowrap;
    text-shadow: 0 2px 3px #000;
}

.stage-node.cleared {
    color: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 18px #4dd9ff66, inset 0 0 0 4px #071526;
}

.stage-node.available {
    color: var(--amber);
    border-color: var(--amber);
    box-shadow: 0 0 24px #ffbd4288, inset 0 0 0 4px #241607;
    animation: available-pulse 1.8s ease-in-out infinite;
}

.stage-node.locked {
    color: #66728b;
    filter: grayscale(1) brightness(.45);
}

.stage-node.boss {
    width: 88px;
    height: 88px;
    border-color: var(--red);
}

.stage-node.boss.available,
.stage-node.boss.cleared {
    box-shadow: 0 0 34px #ff4d3d99, inset 0 0 0 5px #2a0909;
}

@keyframes available-pulse {
    50% { box-shadow: 0 0 34px #ffbd42bb, inset 0 0 0 4px #241607; }
}

.map-caption {
    position: absolute;
    z-index: 2;
    left: 50%;
    translate: -50% 0;
    color: #d6e7ff;
    font-size: .68rem;
    letter-spacing: .2em;
    text-shadow: 0 2px 4px #000;
}

.map-caption-bottom { bottom: 1.5%; }
.map-caption-top { top: 1.2%; color: #ff8971; }

.map-legend {
    justify-content: center;
    gap: 18px;
    border-top: 1px solid #2d3e5d;
    color: var(--muted);
    font-size: .68rem;
}

.map-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.cleared { background: var(--cyan); }
.legend-dot.available { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.legend-dot.locked { background: #59657a; }

.stage-panel {
    position: relative;
    padding: 18px;
    overflow-y: auto;
}

.stage-heading span {
    color: var(--amber);
    font-size: .67rem;
    letter-spacing: .15em;
}

.stage-heading h1 {
    margin: 4px 0 14px;
    font-size: 1.35rem;
}

.monster-portrait {
    position: relative;
    height: clamp(190px, 27vh, 260px);
    overflow: hidden;
    border: 1px solid #34476a;
    border-radius: 15px;
    background:
        radial-gradient(circle at 50% 75%, #4dd9ff1e, transparent 44%),
        linear-gradient(180deg, #0d1830, #060a14);
}

.monster-portrait::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 7%;
    height: 20px;
    border-radius: 50%;
    background: #02040aa8;
    filter: blur(7px);
}

.monster-portrait img {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 16px 11px #000a);
    transition: opacity .2s ease, scale .2s ease, filter .2s ease;
}

.monster-portrait.locked img {
    filter: grayscale(1) brightness(.25) drop-shadow(0 16px 11px #000a);
}

.portrait-glow {
    position: absolute;
    inset: 35% 24% 2%;
    border-radius: 50%;
    background: #4dd9ff2c;
    filter: blur(24px);
}

.state-badge {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 10px;
    padding: 5px 8px;
    border: 1px solid currentColor;
    border-radius: 7px;
    background: #050814dd;
    font-size: .61rem;
    font-weight: 900;
    letter-spacing: .08em;
}

.state-badge.available { color: var(--amber); }
.state-badge.cleared { color: var(--cyan); }
.state-badge.locked { color: #8390a9; }

.monster-title {
    justify-content: space-between;
    padding: 13px 2px;
    border-bottom: 1px solid #2b3c5a;
}

.monster-title small,
.monster-title strong {
    display: block;
}

.monster-title small {
    color: var(--muted);
    font-size: .62rem;
    letter-spacing: .14em;
}

.monster-title strong {
    margin-top: 2px;
    font-size: 1.04rem;
}

.stage-stars {
    color: var(--amber);
    letter-spacing: .1em;
}

.info-block,
.reward-block {
    margin-top: 13px;
    padding: 12px;
    border-radius: 11px;
    background: #060b17aa;
}

.info-block p {
    margin: 6px 0 0;
    color: #c6d0e4;
    font-size: .8rem;
    line-height: 1.5;
}

.recommend-block {
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #2f466a;
    border-radius: 11px;
    background: linear-gradient(90deg, #0a1428, #101b30);
}

.recommend-block strong,
.reward-block strong,
.reward-block span {
    display: block;
}

.recommend-block strong {
    margin-top: 3px;
}

.recommend-block img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.reward-block strong {
    margin-top: 4px;
    color: var(--cyan);
}

.reward-block span {
    margin-top: 5px;
    color: var(--muted);
    font-size: .7rem;
}

.hunt-button {
    width: 100%;
    margin-top: 14px;
    padding: 13px 16px;
    border: 1px solid #ffce69;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffb43b, #d85a1c);
    color: #1a0b03;
    box-shadow: 0 8px 24px #ff782c44, inset 0 1px #fff2b5;
    cursor: pointer;
    font-weight: 1000;
}

.hunt-button span,
.hunt-button small {
    display: block;
}

.hunt-button span {
    letter-spacing: .17em;
}

.hunt-button small {
    margin-top: 2px;
    font-size: .68rem;
}

.hunt-button:disabled {
    border-color: #50596a;
    background: #2a303c;
    color: #7e899c;
    box-shadow: none;
    cursor: not-allowed;
}

.bottom-nav {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: stretch;
    justify-content: center;
    border-top: 1px solid #334668;
    background: linear-gradient(180deg, #0b1223f5, #050814);
}

.bottom-nav button {
    min-width: 140px;
    padding: 8px 20px;
    border: 0;
    border-left: 1px solid #263653;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: .74rem;
}

.bottom-nav button:last-child {
    border-right: 1px solid #263653;
}

.bottom-nav button span {
    display: block;
    margin-bottom: 4px;
    font-size: 1rem;
}

.bottom-nav button.active {
    color: var(--amber);
    background: linear-gradient(180deg, #ffbd4218, transparent);
    box-shadow: inset 0 3px var(--amber);
}

.toast {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: 92px;
    max-width: min(420px, 86vw);
    padding: 12px 18px;
    translate: -50% 30px;
    border: 1px solid #52698e;
    border-radius: 11px;
    background: #091122ee;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 15px 30px #000a;
    transition: opacity .2s ease, translate .2s ease;
}

.toast.show {
    opacity: 1;
    translate: -50% 0;
}

@media (max-width: 1120px) {
    .lobby-layout {
        grid-template-columns: minmax(420px, 1fr) minmax(270px, 330px);
    }

    .left-panel {
        display: none;
    }
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-rows: 68px auto 64px;
    }

    .topbar {
        grid-template-columns: 1fr auto;
        padding: 9px 12px;
    }

    .brand small,
    .top-resources > div {
        display: none;
    }

    .campaign-title {
        order: 3;
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        margin-top: -8px;
    }

    .campaign-title > span,
    .campaign-title > strong {
        display: none;
    }

    .lobby-layout {
        display: block;
        padding: 8px;
    }

    .map-section {
        height: 64vh;
    }

    .map-canvas {
        min-height: 900px;
    }

    .stage-panel {
        margin-top: 8px;
    }

    .monster-portrait {
        height: 220px;
    }

    .bottom-nav button {
        min-width: 0;
        flex: 1;
        padding: 7px 3px;
        font-size: .63rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
