:root {
    --primary: #4a90e2;
    --primary-dark: #2f6fb8;
    --primary-soft: #d8ecff;
    --background: #f0f4f8;
    --surface: #ffffff;
    --surface-blue: #f7fbff;
    --border: #d9e5f2;
    --text: #333333;
    --muted: #66788a;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --success: #2fbf71;
    --coin: #d89922;
    --shadow: 0 16px 40px rgba(42, 84, 132, 0.12);
    --shadow-soft: 0 8px 24px rgba(42, 84, 132, 0.10);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Inter, "Noto Sans KR", "Segoe UI", Arial, sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.login-page {
    display: grid;
    min-height: 100vh;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.login-hero {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    overflow: hidden;
    padding: 48px;
    background:
            radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.28), transparent 30%),
            linear-gradient(145deg, #4a90e2 0%, #76b9f2 60%, #9dd6f5 100%);
    color: #ffffff;
    text-align: center;
}

.brand-mark {
    display: grid;
    width: 64px;
    height: 64px;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-weight: 800;
}

.hero-copy {
    max-width: 520px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.login-hero .eyebrow {
    color: rgba(255, 255, 255, 0.82);
}

.hero-copy h1,
.login-card h2 {
    margin: 0;
    line-height: 1.18;
}

.hero-copy h1 {
    font-size: 4rem;
    font-weight: 850;
}

.hero-copy p:last-child {
    margin: 18px auto 0;
    max-width: 440px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.05rem;
    line-height: 1.7;
}

.pixel-illustration {
    position: relative;
    width: min(380px, 76vw);
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: var(--radius);
    background: #cceaff;
    box-shadow: 0 22px 46px rgba(18, 69, 120, 0.22);
}

.pixel-sky {
    position: absolute;
    inset: 0 0 32%;
    background:
            linear-gradient(90deg, transparent 0 18%, rgba(255, 255, 255, 0.85) 18% 33%, transparent 33% 100%),
            linear-gradient(#cceaff, #eef9ff);
    background-size: 180px 54px, auto;
    image-rendering: pixelated;
}

.pixel-ground {
    position: absolute;
    inset: auto 0 0;
    height: 34%;
    background:
            linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0 12px, transparent 12px 24px),
            linear-gradient(#8fd1a5, #50a977);
    background-size: 24px 24px, auto;
}

.pixel-character {
    position: absolute;
    left: 50%;
    bottom: 31%;
    width: 86px;
    height: 126px;
    transform: translateX(-50%);
    image-rendering: pixelated;
}

.pixel-character span {
    position: absolute;
    display: block;
    border-radius: 2px;
}

.pixel-head {
    left: 25px;
    top: 0;
    width: 36px;
    height: 36px;
    background: #ffd8a8;
    box-shadow: inset 0 -8px 0 #e7b47f;
}

.pixel-body {
    left: 18px;
    top: 38px;
    width: 50px;
    height: 54px;
    background: #2f6fb8;
    box-shadow: inset 0 -12px 0 #1f4e84;
}

.pixel-arm {
    top: 44px;
    width: 14px;
    height: 42px;
    background: #ffd8a8;
}

.pixel-arm.left {
    left: 2px;
}

.pixel-arm.right {
    right: 2px;
}

.pixel-leg {
    top: 92px;
    width: 20px;
    height: 34px;
    background: #293d66;
}

.pixel-leg.left {
    left: 20px;
}

.pixel-leg.right {
    right: 20px;
}

.login-panel {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 40px 24px;
}

.login-card {
    display: grid;
    width: min(100%, 430px);
    gap: 18px;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-card h2 {
    font-size: 2rem;
}

.form-helper {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.field {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

.field input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-blue);
    color: var(--text);
    outline: none;
    padding: 0 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.16);
}

.primary-button,
.ghost-button {
    min-height: 48px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-weight: 800;
    white-space: nowrap;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(74, 144, 226, 0.26);
}

.ghost-button {
    background: #eef6ff;
    color: var(--primary-dark);
}

.primary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active {
    transform: translateY(0);
}

@media (max-width: 860px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero,
    .login-panel {
        min-height: auto;
    }

    .login-hero {
        padding: 36px 20px;
    }

    .hero-copy h1 {
        font-size: 2.5rem;
    }

    .login-panel {
        padding: 26px 18px 40px;
    }
}

.dashboard-page {
    min-height: 100vh;
    background:
            linear-gradient(180deg, rgba(216, 236, 255, 0.88), rgba(240, 244, 248, 0.96) 280px),
            var(--background);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: max-content minmax(200px, 1fr) max-content;
    gap: 24px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(217, 229, 242, 0.88);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 26px rgba(42, 84, 132, 0.08);
    backdrop-filter: blur(14px);
}

.user-summary {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.user-summary strong,
.user-summary span {
    display: block;
}

.user-summary strong {
    font-size: 1rem;
}

.user-summary span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.88rem;
}

.avatar-placeholder {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border: 2px solid #ffffff;
    border-radius: var(--radius);
    background:
            linear-gradient(135deg, #76b9f2, #2f6fb8);
    color: #ffffff;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(74, 144, 226, 0.24);
}

.status-panel {
    display: grid;
    gap: 10px;
}

.status-line {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.status-label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.status-label strong {
    color: var(--text);
}

.meter {
    height: 13px;
    overflow: hidden;
    border-radius: 999px;
    background: #d9e5f2;
}

.meter-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width 360ms ease, filter 200ms ease;
}

.meter-fill.pulse {
    filter: brightness(1.12) saturate(1.18);
}

.hp-fill {
    background: linear-gradient(90deg, #e74c3c, #ff7d6f);
}

.xp-fill {
    background: linear-gradient(90deg, #f1c40f, #ffe082);
}

.wallet-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
}

.wallet-item {
    display: inline-flex;
    min-width: 48px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    font-weight: 800;
}

.wallet-item.bump,
.reward-cost.bump {
    animation: bump 260ms ease;
}

.gem-icon {
    display: inline-block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: linear-gradient(135deg, #4a90e2, #8ce6ff);
    box-shadow: inset -3px -3px 0 rgba(255, 255, 255, 0.36);
    transform: rotate(45deg);
    margin: 0 4px; /* Give it some horizontal breathing room because of 45deg rotation */
}

.coin-icon {
    display: inline-block;
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border: 2px solid #f7d46b;
    border-radius: 50%;
    background: var(--coin);
    box-shadow: inset -3px -3px 0 rgba(102, 66, 0, 0.18);
}

.coin-icon.small {
    width: 14px;
    height: 14px;
}

.dashboard-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.dashboard-nav a {
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.dashboard-nav a:hover {
    color: var(--primary);
}

.dashboard-main {
    width: min(100%, 1500px);
    margin: 0 auto;
    padding: 24px;
}

.profile-inventory-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
}

.profile-card,
.inventory-panel {
    display: grid;
    gap: 16px;
    align-content: start;
    border: 1px solid rgba(217, 229, 242, 0.92);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
}

.profile-card {
    padding: 16px;
}

.inventory-panel {
    padding: 16px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-heading .eyebrow {
    margin-bottom: 4px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.25rem;
}

.level-chip {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    border-radius: var(--radius);
    background: #eaf5ee;
    color: #1d7a49;
    padding: 0 10px;
    font-size: 0.85rem;
    font-weight: 900;
}

.pixel-stage {
    position: relative;
    display: grid;
    min-height: 228px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
            linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0 12px, transparent 12px 24px),
            linear-gradient(180deg, #cbeeff 0 56%, #80c792 56% 100%);
    background-size: 24px 24px, auto;
    image-rendering: pixelated;
}

.pixel-stage::before {
    content: "";
    position: absolute;
    inset: 16px 24px auto;
    height: 40px;
    background:
            linear-gradient(90deg, transparent 0 18%, rgba(255, 255, 255, 0.86) 18% 35%, transparent 35% 100%),
            linear-gradient(90deg, transparent 0 62%, rgba(255, 255, 255, 0.74) 62% 78%, transparent 78% 100%);
    background-size: 150px 40px, 210px 40px;
}

.paperdoll {
    position: relative;
    width: 138px;
    height: 174px;
    transform: scale(1.08);
    image-rendering: pixelated;
}

.paperdoll span {
    position: absolute;
    display: block;
}

.doll-shadow {
    left: 25px;
    bottom: 3px;
    width: 88px;
    height: 18px;
    border-radius: 50%;
    background: rgba(34, 70, 55, 0.22);
}

.doll-head {
    left: 48px;
    top: 24px;
    z-index: 4;
    width: 42px;
    height: 42px;
    border-radius: 3px;
    background: #ffd4a3;
    box-shadow:
            inset 0 -9px 0 #e7ad78,
            9px 14px 0 -6px #333333,
            25px 14px 0 -6px #333333;
}

.doll-hair {
    left: 43px;
    top: 18px;
    z-index: 5;
    width: 52px;
    height: 22px;
    border-radius: 3px 3px 0 0;
    background: #4a3429;
    box-shadow:
            0 13px 0 -6px #4a3429,
            34px 9px 0 -8px #4a3429;
}

.doll-body {
    left: 41px;
    top: 68px;
    z-index: 3;
    width: 56px;
    height: 58px;
    border-radius: 3px;
    background: #4a90e2;
    box-shadow:
            inset 0 -14px 0 #2f6fb8,
            inset 10px 0 0 rgba(255, 255, 255, 0.16);
}

.doll-arm {
    top: 75px;
    z-index: 2;
    width: 18px;
    height: 52px;
    border-radius: 3px;
    background: #ffd4a3;
    box-shadow: inset 0 -10px 0 #e7ad78;
}

.doll-arm.left {
    left: 22px;
}

.doll-arm.right {
    right: 22px;
}

.doll-leg {
    top: 124px;
    z-index: 2;
    width: 22px;
    height: 40px;
    border-radius: 2px;
    background: #253a66;
    box-shadow: inset 0 -9px 0 #172747;
}

.doll-leg.left {
    left: 43px;
}

.doll-leg.right {
    right: 43px;
}

.paperdoll-layer {
    z-index: 6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.paperdoll-layer[class*="equipped-"] {
    opacity: 1;
}

.gear-head.equipped-sky-hood {
    left: 40px;
    top: 14px;
    width: 58px;
    height: 34px;
    border-radius: 4px 4px 2px 2px;
    background: #2d8cd9;
    box-shadow:
            inset 0 -9px 0 #1e68a8,
            8px 25px 0 -9px #1e68a8,
            42px 25px 0 -9px #1e68a8;
}

.gear-head.equipped-sky-hood::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 6px;
    width: 14px;
    height: 7px;
    background: rgba(255, 255, 255, 0.42);
}

.gear-armor.equipped-traveler-tunic {
    left: 37px;
    top: 64px;
    width: 64px;
    height: 66px;
    border-radius: 4px;
    background: #2fbf71;
    box-shadow:
            inset 0 -16px 0 #1e8d54,
            inset 12px 0 0 rgba(255, 255, 255, 0.22),
            19px 2px 0 -8px #d9f7e7;
}

.gear-weapon.equipped-wood-sword {
    left: 10px;
    top: 50px;
    width: 18px;
    height: 86px;
    border-radius: 2px;
    background: #8f5a2b;
    box-shadow:
            0 -12px 0 -4px #c79a61,
            0 18px 0 -5px #5f3a1c,
            20px 17px 0 -7px #d5a35e;
    transform: rotate(-24deg);
    transform-origin: 50% 80%;
}

.gear-accessory.equipped-student-badge {
    left: 82px;
    top: 77px;
    width: 18px;
    height: 18px;
    border: 3px solid #f1c40f;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: inset 0 -4px 0 #d89922;
}

.equipment-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.equipment-slot {
    min-height: 54px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-blue);
    padding: 9px 10px;
}

.equipment-slot span,
.equipment-slot strong {
    display: block;
}

.equipment-slot span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.equipment-slot strong {
    margin-top: 3px;
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: 10px;
}

.inventory-cell {
    display: flex;
    min-height: 72px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--text);
    padding: 10px;
    text-align: left;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.inventory-cell:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
}

.inventory-cell.equipped {
    border-color: #2fbf71;
    background: #eefaf3;
}

.inventory-cell.consumable {
    background: #fff8e0;
}

.inventory-cell strong,
.inventory-cell small {
    display: block;
}

.inventory-cell strong {
    font-size: 0.9rem;
}

.inventory-cell small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.item-sprite {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid #c3d4e5;
    border-radius: 6px;
    background: #eff7ff;
    image-rendering: pixelated;
}

.item-sprite::before,
.item-sprite::after {
    content: "";
    position: absolute;
    display: block;
}

.icon-wood-sword::before {
    left: 17px;
    top: 5px;
    width: 6px;
    height: 26px;
    border-radius: 1px;
    background: #8f5a2b;
    box-shadow:
            0 -4px 0 #c79a61,
            -8px 17px 0 -2px #d5a35e,
            8px 17px 0 -2px #d5a35e;
    transform: rotate(35deg);
}

.icon-sky-hood::before {
    left: 9px;
    top: 8px;
    width: 20px;
    height: 18px;
    border-radius: 5px 5px 3px 3px;
    background: #2d8cd9;
    box-shadow:
            inset 0 -6px 0 #1e68a8,
            5px 3px 0 -2px rgba(255, 255, 255, 0.46);
}

.icon-traveler-tunic::before {
    left: 9px;
    top: 8px;
    width: 20px;
    height: 24px;
    border-radius: 3px;
    background: #2fbf71;
    box-shadow:
            inset 0 -7px 0 #1e8d54,
            -6px 6px 0 -2px #2fbf71,
            6px 6px 0 -2px #2fbf71;
}

.icon-student-badge::before {
    left: 10px;
    top: 10px;
    width: 18px;
    height: 18px;
    border: 3px solid #f1c40f;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: inset 0 -4px 0 #d89922;
}

.icon-rest-ticket::before {
    left: 7px;
    top: 10px;
    width: 24px;
    height: 16px;
    border-radius: 2px;
    background: #26394f;
    box-shadow:
            inset 0 -4px 0 #162438,
            5px 5px 0 -2px #88d8ff;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(230px, 1fr));
    gap: 16px;
    align-items: start;
}

.kanban-column {
    display: grid;
    gap: 14px;
    min-height: calc(100vh - 128px);
    align-content: start;
    padding: 14px;
    border: 1px solid rgba(217, 229, 242, 0.92);
    border-radius: var(--radius);
    background: rgba(247, 251, 255, 0.84);
}

.column-header {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.column-header .eyebrow {
    margin-bottom: 4px;
}

.column-header h2 {
    margin: 0;
    font-size: 1.22rem;
}

.column-count {
    display: grid;
    min-width: 30px;
    height: 30px;
    place-items: center;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 900;
}

.quick-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
}

.quick-add input {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--text);
    outline: none;
    padding: 0 12px;
}

.quick-add input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.14);
}

.quick-add button,
.tab-button,
.habit-action {
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 900;
    transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.quick-add button {
    background: var(--primary);
    color: #ffffff;
}

.quick-add button:hover,
.habit-action:hover,
.tab-button:hover,
.reward-item:hover {
    transform: translateY(-1px);
}

.task-list {
    display: grid;
    gap: 10px;
}

.task-item {
    width: 100%;
    min-height: 56px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    color: var(--text);
}

.habit-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 9px;
    align-items: center;
    padding: 9px;
}

.habit-item p {
    margin: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.habit-action {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #ffffff;
    font-size: 1.1rem;
}

.habit-action.positive {
    background: var(--success);
}

.habit-action.negative {
    background: var(--danger);
}

.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    line-height: 1.5;
    transition: background 180ms ease, opacity 180ms ease;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    accent-color: var(--primary);
}

.check-item span {
    overflow-wrap: anywhere;
}

.check-item.completed {
    background: #eef7f2;
    opacity: 0.72;
}

.check-item.completed span {
    color: var(--muted);
    text-decoration: line-through;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tab-button {
    min-height: 38px;
    border-color: var(--border);
    background: #ffffff;
    color: var(--muted);
}

.tab-button.active {
    background: var(--primary);
    color: #ffffff;
}

.todo-list {
    display: none;
}

.todo-list.active {
    display: grid;
}

.empty-state {
    margin: 0;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    line-height: 1.6;
    text-align: center;
}

.reward-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px;
    text-align: left;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.reward-item strong,
.reward-item small {
    display: block;
}

.reward-item strong {
    font-size: 0.98rem;
}

.reward-item small {
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.45;
}

.reward-item.completed {
    background: #eef7f2;
    opacity: 0.72;
}

.reward-item.completed:hover {
    transform: none;
}

.reward-item.completed strong,
.reward-item.completed small,
.reward-item.completed .reward-cost {
    color: var(--muted);
    text-decoration: line-through;
}

.reward-item.completed .item-sprite {
    filter: grayscale(0.65) blur(0.35px);
}

.reward-cost {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: #8a5b0d;
    font-weight: 900;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    max-width: min(340px, calc(100vw - 44px));
    padding: 13px 16px;
    border-radius: var(--radius);
    background: #26394f;
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(38, 57, 79, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.friend-open-btn {
    min-height: 36px;
    padding: 0 12px;
}

.friends-modal-box {
    display: grid;
    gap: 16px;
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 20px;
    border: 1px solid rgba(217, 229, 242, 0.96);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: modalSlideUp 0.22s ease;
}

.friends-modal-header,
.friend-list-header,
.friend-profile-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.friends-modal-header h2,
.friend-profile-heading h2 {
    margin: 0;
}

.icon-close-btn,
.friend-back-btn {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    font-weight: 900;
}

.icon-close-btn {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
}

.friend-back-btn {
    justify-self: start;
    padding: 8px 12px;
}

.friend-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.friend-search-form input {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 12px;
    font: inherit;
}

.friend-search-form button,
.friend-action-btn {
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font-weight: 900;
}

.friend-search-form button {
    min-height: 42px;
    padding: 0 16px;
}

.friends-view {
    display: grid;
    gap: 14px;
}

.friend-list {
    display: grid;
    gap: 10px;
}

.friend-list-header span {
    display: grid;
    min-width: 30px;
    height: 30px;
    place-items: center;
    border-radius: var(--radius);
    background: #edf6ff;
    color: var(--primary-dark);
    font-weight: 900;
}

.friend-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
}

.friend-item strong,
.friend-item small {
    display: block;
}

.friend-item small {
    margin-top: 4px;
    color: var(--muted);
}

.friend-action-btn {
    min-height: 34px;
    padding: 0 10px;
}

.friend-action-btn.secondary {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--muted);
}

.friend-profile-heading {
    justify-content: flex-start;
}

.friend-profile-heading span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 800;
}

.friend-stage {
    min-height: 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.friend-equipment-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.friend-profile-modal-box {
    width: min(520px, calc(100vw - 32px));
}

@keyframes bump {
    0% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1);
    }
}

@media (max-width: 1180px) {
    .topbar {
        grid-template-columns: 1fr;
    }

    .wallet-nav {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .board-grid {
        grid-template-columns: repeat(2, minmax(260px, 1fr));
    }

    .profile-inventory-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .dashboard-main {
        padding: 16px;
    }

    .topbar {
        padding: 14px 16px;
    }

    .status-line {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .dashboard-nav {
        width: 100%;
        justify-content: space-between;
    }

    .board-grid {
        grid-template-columns: 1fr;
    }

    .kanban-column {
        min-height: auto;
    }

    .friend-item {
        grid-template-columns: 1fr;
    }

    .friend-action-btn {
        width: 100%;
    }

    .friend-equipment-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-copy h1 {
        font-size: 2.15rem;
    }
}

/* ── Level Up Modal ─────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    animation: modalFadeIn 0.2s ease;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-box {
    background: var(--surface);
    border: 3px solid var(--warning);
    border-radius: 16px;
    padding: 2.5rem 2.25rem 2rem;
    text-align: center;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 0 48px rgba(241, 196, 15, 0.35), var(--shadow);
    animation: modalSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-stars {
    font-size: 1.4rem;
    color: var(--warning);
    letter-spacing: 0.6rem;
    margin-bottom: 0.6rem;
}

.modal-title {
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    color: var(--warning);
    text-shadow: 0 0 24px rgba(241, 196, 15, 0.55);
    margin: 0 0 0.4rem;
    line-height: 1;
}

.modal-level {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 0.5rem;
}

.modal-subtitle {
    color: var(--muted);
    margin: 0 0 1.75rem;
    font-size: 0.95rem;
}

.modal-close-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.6rem 2.25rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.modal-close-btn:hover {
    background: var(--primary-dark);
}

.modal-close-btn:active {
    transform: scale(0.96);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(32px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 랭킹 모달 전용 스타일 */
.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranking-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.ranking-item.current-user {
    background: rgba(var(--primary-rgb), 0.05);
    border-left: 4px solid var(--primary);
}

.rank-number {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-muted);
    text-align: center;
}

.rank-1 .rank-number { color: #FFD700; font-size: 1.6rem; }
.rank-2 .rank-number { color: #C0C0C0; font-size: 1.4rem; }
.rank-3 .rank-number { color: #CD7F32; font-size: 1.2rem; }

.ranker-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranker-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.rank-1 .ranker-avatar { background: linear-gradient(135deg, #FFDF00, #DAA520); }
.rank-2 .ranker-avatar { background: linear-gradient(135deg, #E0E0E0, #9E9E9E); }
.rank-3 .ranker-avatar { background: linear-gradient(135deg, #E9967A, #8B4513); }

.ranker-details {
    display: flex;
    flex-direction: column;
}

.ranker-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.me-badge {
    font-size: 0.65rem;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}

.ranker-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.ranker-stats {
    text-align: right;
}

.ranker-level {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

.ranker-xp {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}
