:root {
    --bg: #0f1722;
    --bg-soft: #172130;
    --panel: rgba(255, 255, 255, 0.08);
    --panel-strong: rgba(255, 255, 255, 0.13);
    --border: rgba(255, 255, 255, 0.11);
    --text: #f4f7fb;
    --muted: #b3c0cf;
    --accent: #efb552;
    --accent-strong: #f0a52b;
    --wood: #8d6236;
    --stone: #8c97a6;
    --iron: #6d8099;
    --success: #87dd98;
    --danger: #ffb1a7;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(240, 165, 43, 0.16), transparent 28%),
        radial-gradient(circle at 90% 10%, rgba(95, 122, 163, 0.23), transparent 24%),
        linear-gradient(160deg, #0b1118 0%, #0e1824 38%, #101b28 100%);
}

img {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
}

.page-shell {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 50px;
}

.hero,
.overview-card,
.building-card,
.log-panel,
.noscript-box {
    border: 1px solid var(--border);
    background: linear-gradient(150deg, var(--panel), rgba(255, 255, 255, 0.04));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 430px);
    gap: 30px;
    padding: clamp(24px, 4vw, 44px);
    border-radius: var(--radius-xl);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 800;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 16px;
    font-size: clamp(2.8rem, 7vw, 5rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

h2 {
    margin-bottom: 10px;
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    letter-spacing: -0.04em;
}

h3 {
    margin-bottom: 0;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
}

.lead,
.section-text,
.overview-card p,
.building-description,
.unlock-box p,
.event-log,
.noscript-box,
.hero-badges span {
    color: var(--muted);
}

.lead {
    max-width: 760px;
    line-height: 1.72;
    font-size: 1.04rem;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-badges span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.93rem;
}

.resource-board {
    display: grid;
    gap: 14px;
}

.resource-card {
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: linear-gradient(150deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
}

.resource-card.wood {
    background: linear-gradient(150deg, rgba(141, 98, 54, 0.24), rgba(255,255,255,0.04));
}

.resource-card.stone {
    background: linear-gradient(150deg, rgba(140, 151, 166, 0.28), rgba(255,255,255,0.04));
}

.resource-card.iron {
    background: linear-gradient(150deg, rgba(109, 128, 153, 0.26), rgba(255,255,255,0.04));
}

.resource-label,
.card-label,
.mini-label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.resource-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-top: 20px;
}

.overview-card {
    padding: 22px;
    border-radius: var(--radius-lg);
}

.overview-card strong {
    display: block;
    margin-bottom: 10px;
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    line-height: 1.05;
}

.stage-card {
    position: relative;
    overflow: hidden;
}

.stage-card::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -80px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(240, 165, 43, 0.1);
}

.section-header {
    display: grid;
    grid-template-columns: minmax(0, 360px) 1fr;
    gap: 24px;
    align-items: end;
    margin-top: 34px;
    margin-bottom: 16px;
}

.section-header.compact {
    margin-top: 0;
    margin-bottom: 14px;
}

.section-text {
    max-width: 680px;
    line-height: 1.7;
    margin-bottom: 8px;
}

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

.building-card {
    display: grid;
    grid-template-columns: minmax(180px, 240px) 1fr;
    gap: 22px;
    padding: 18px;
    border-radius: var(--radius-lg);
}

.loading-card {
    display: block;
    padding: 26px;
}

.building-image-wrap {
    position: relative;
    align-self: start;
}

.building-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.12);
}

.status-badge {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-badge.open {
    background: rgba(135, 221, 152, 0.18);
    color: #d6f8dd;
    border: 1px solid rgba(135, 221, 152, 0.35);
}

.status-badge.locked {
    background: rgba(255, 177, 167, 0.18);
    color: #ffd5ce;
    border: 1px solid rgba(255, 177, 167, 0.35);
}

.building-headline {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: start;
}

.level-pill {
    white-space: nowrap;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-weight: 700;
}

.building-description {
    line-height: 1.65;
    margin: 12px 0 16px;
}

.cost-box,
.unlock-box {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 14px;
}

.cost-box strong {
    display: block;
    font-size: 1.08rem;
    line-height: 1.4;
}

.progress-wrap {
    margin-bottom: 14px;
}

.progress-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.94rem;
    color: var(--muted);
}

.progress-topline strong {
    color: var(--text);
}

.progress-bar {
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-strong), #f7cd7f);
}

.building-effect,
.building-next {
    margin-bottom: 10px;
    line-height: 1.55;
}

.building-effect {
    color: #e7edf6;
}

.building-next {
    color: var(--muted);
}

.requirements-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.req-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.req-line.ok {
    color: #d5f6db;
    background: rgba(135, 221, 152, 0.12);
}

.upgrade-button {
    width: 100%;
    margin-top: 8px;
    border: 0;
    border-radius: 16px;
    padding: 16px 18px;
    font-weight: 850;
    color: #231507;
    background: linear-gradient(135deg, #f7d484, var(--accent));
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.upgrade-button:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.03);
}

.upgrade-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.is-locked .upgrade-button {
    background: linear-gradient(135deg, #adb8c7, #8a97a8);
    color: #0d1622;
}

.log-panel {
    margin-top: 24px;
    padding: 22px;
    border-radius: var(--radius-lg);
}

.event-log {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.event-log li {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.noscript-box {
    margin-top: 20px;
    padding: 18px 20px;
    border-radius: 16px;
}

@media (max-width: 1080px) {
    .hero,
    .building-card,
    .section-header {
        grid-template-columns: 1fr;
    }

    .overview-grid,
    .building-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100%, calc(100% - 18px));
        padding-top: 18px;
    }

    .hero,
    .overview-card,
    .building-card,
    .log-panel {
        border-radius: 22px;
    }

    h1 {
        font-size: clamp(2.4rem, 13vw, 4rem);
    }

    .building-card {
        padding: 14px;
    }

    .building-headline {
        flex-direction: column;
    }
}


.shop-panel,
.payment-message {
    margin-top: 20px;
    border: 1px solid var(--border);
    background: linear-gradient(150deg, var(--panel), rgba(255, 255, 255, 0.04));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    border-radius: var(--radius-lg);
}

.shop-panel {
    display: grid;
    grid-template-columns: 1fr minmax(240px, 320px);
    gap: 22px;
    align-items: center;
    padding: 24px;
}

.shop-button {
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 18px 20px;
    font-weight: 850;
    color: #231507;
    background: linear-gradient(135deg, #f7d484, var(--accent));
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.shop-button:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.03);
}

.shop-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.payment-message {
    padding: 18px 22px;
    font-weight: 750;
}

.payment-message.success {
    color: #d8f9df;
    border-color: rgba(135, 221, 152, 0.35);
    background: rgba(30, 120, 70, 0.24);
}

.payment-message.error {
    color: #ffd5ce;
    border-color: rgba(255, 177, 167, 0.35);
    background: rgba(140, 40, 35, 0.20);
}

@media (max-width: 1080px) {
    .shop-panel {
        grid-template-columns: 1fr;
    }
}
