@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Instrument+Serif&display=swap');

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

:root {
    --bg:       #131315;
    --surface:  #1a1a1c;
    --border:   #2a2a2c;
    --border-l: #333336;
    --text:     #ffffff;
    --text-2:   #a0a0a5;
    --text-3:   #606066;
    --accent:   #d4ff00;
    --sans:     'Inter', system-ui, -apple-system, sans-serif;
    --serif:    'Instrument Serif', Georgia, serif;
}

html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: var(--bg); color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== TOPBAR ===== */
#topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 52px;
    background: rgba(12,12,12,.85); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; z-index: 100;
    font-size: 13px;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }

.brand {
    font-family: var(--serif); font-size: 17px;
    color: var(--text); letter-spacing: -0.3px;
}

.season-badge {
    font-size: 10px; font-weight: 600; letter-spacing: .5px;
    background: var(--border-l); color: var(--text-2);
    padding: 2px 7px; border-radius: 3px;
}

.topbar-center { display: flex; align-items: center; }

.countdown { display: flex; align-items: center; gap: 4px; }
.countdown-label {
    font-size: 10px; font-weight: 600; color: var(--text-3);
    letter-spacing: 1.5px; margin-right: 10px;
}

.countdown-timer {
    display: flex; align-items: baseline; gap: 2px;
    font-variant-numeric: tabular-nums;
}

.countdown-timer span {
    font-size: 15px; font-weight: 600; color: var(--text);
}

.countdown-timer small {
    font-size: 10px; color: var(--text-3); margin-right: 6px; font-weight: 500;
}

.topbar-right { display: flex; align-items: center; gap: 6px; }

.stat { display: flex; align-items: center; gap: 6px; }
.stat-label { font-size: 11px; color: var(--text-3); font-weight: 500; }
.stat-value { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-divider { width: 1px; height: 16px; background: var(--border); margin: 0 10px; }

/* ===== CANVAS ===== */
#mainCanvas { display: block; cursor: grab; position: fixed; top: 0; left: 0; }
#mainCanvas.grabbing { cursor: grabbing; }

/* ===== MINIMAP ===== */
#minimap-container {
    position: fixed; bottom: 20px; right: 20px;
    border: 1px solid var(--border); background: var(--surface);
    border-radius: 6px; z-index: 50;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
#minimapCanvas { display: block; border-radius: 5px; }

/* ===== SELECTION PANEL ===== */
#selection-panel {
    position: fixed; bottom: 20px; left: 20px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; width: 260px; z-index: 50;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    animation: panelUp .25s cubic-bezier(.16,1,.3,1);
}
@keyframes panelUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.panel-row { padding: 14px 18px; }
.panel-row--top {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border);
}

.panel-coords { font-size: 13px; font-weight: 600; color: var(--text); margin-right: 8px; }

.zone-badge {
    font-size: 9px; font-weight: 600; letter-spacing: .8px;
    padding: 2px 6px; border-radius: 3px;
    vertical-align: middle;
}
.zone-badge.premium  { background: #2a2510; color: #e6c84a; }
.zone-badge.prime    { background: #0f1f1f; color: #5ac8c8; }
.zone-badge.standard { background: #1a1a25; color: #7878a8; }
.zone-badge.exterior { background: var(--border); color: var(--text-3); }

.icon-btn {
    background: none; border: none; color: var(--text-3);
    font-size: 22px; line-height: 1; cursor: pointer;
    transition: color .15s;
}
.icon-btn:hover { color: var(--text); }

.panel-row--price { padding-top: 10px; padding-bottom: 6px; }
.price-value {
    font-family: var(--serif); font-size: 36px; color: var(--text);
    letter-spacing: -1px;
}

.cta-btn {
    display: block; width: calc(100% - 36px); margin: 0 18px 16px;
    padding: 12px 0; background: var(--text); color: var(--bg);
    border: none; border-radius: 6px;
    font-family: var(--sans); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: opacity .15s;
}
.cta-btn:hover { opacity: .85; }
.cta-btn.sold { background: var(--border); color: var(--text-3); cursor: default; }

/* ===== MODAL ===== */
#modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
    z-index: 200; display: flex; align-items: center; justify-content: center;
}

#purchase-modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; width: 420px; max-width: 92vw;
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
    animation: modalUp .25s cubic-bezier(.16,1,.3,1);
}
@keyframes modalUp {
    from { opacity: 0; transform: scale(.97) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

#info-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7); z-index: 400;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}

#info-modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; width: 420px; max-width: 92vw;
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
    animation: modalUp .25s cubic-bezier(.16,1,.3,1);
}

.info-text p {
    font-size: 14px; color: var(--text-2); margin-bottom: 12px; line-height: 1.5;
}
.info-text p:last-child { margin-bottom: 0; }
.info-text strong { color: var(--text); font-weight: 600; }

.info-btn {
    background: var(--accent); color: #000; border: none;
    border-radius: 4px; padding: 4px 12px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    cursor: pointer; transition: all .15s; margin-left: 16px;
    box-shadow: 0 0 12px rgba(212, 255, 0, 0.2);
}
.info-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212, 255, 0, 0.4); }

.modal-top {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-top h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.modal-sub { font-size: 13px; color: var(--text-2); }
.modal-sub strong { color: var(--text); font-weight: 600; }

.modal-body { padding: 20px 24px 24px; }

.field-label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-2); margin-bottom: 6px; margin-top: 18px;
    letter-spacing: .3px;
}
.field-label:first-child { margin-top: 0; }

.modal-body input[type="url"],
.modal-body input[type="text"] {
    width: 100%; padding: 10px 12px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text);
    font-family: var(--sans); font-size: 14px;
    transition: border-color .15s;
}
.modal-body input:focus { outline: none; border-color: var(--text-3); }
.modal-body input::placeholder { color: var(--text-3); }

.upload-area {
    border: 1px dashed var(--border-l); border-radius: 8px;
    padding: 28px 16px; text-align: center;
    cursor: pointer; background: var(--bg);
    transition: border-color .15s;
}
.upload-area:hover { border-color: var(--text-3); }
.upload-area.has-image { padding: 8px; border-style: solid; }

#upload-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    color: var(--text-3); font-size: 13px;
}
.upload-plus {
    width: 32px; height: 32px; line-height: 30px;
    border: 1px solid var(--border-l); border-radius: 6px;
    font-size: 20px; color: var(--text-3);
}
#upload-preview { max-width: 100%; max-height: 160px; border-radius: 4px; }

.pay-btn {
    display: block; width: 100%; margin-top: 24px;
    padding: 14px 0; background: var(--text); color: var(--bg);
    border: none; border-radius: 6px;
    font-family: var(--sans); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: opacity .15s;
}
.pay-btn:hover { opacity: .85; }

.fine-print { text-align: center; font-size: 11px; color: var(--text-3); margin-top: 12px; }

/* ===== WELCOME ===== */
#welcome-overlay {
    position: fixed; inset: 0;
    background: var(--bg); z-index: 300;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}

.welcome-grid-bg {
    position: absolute; inset: -50%;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridDrift 20s linear infinite;
}
@keyframes gridDrift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(30px, 30px) rotate(1deg); }
}

#welcome-content {
    position: relative; z-index: 1;
    text-align: center; max-width: 520px; padding: 40px 24px;
}

.welcome-eyebrow {
    font-size: 12px; font-weight: 600; color: var(--text-3);
    letter-spacing: 2px; text-transform: uppercase;
    margin-bottom: 32px;
    animation: fadeUp .6s ease both;
}

.welcome-title {
    font-family: var(--serif);
    font-size: clamp(56px, 10vw, 86px);
    font-weight: 400; line-height: .95;
    letter-spacing: -2px;
    margin-bottom: 32px;
    animation: fadeUp .6s ease .1s both;
}
.title-line { display: block; color: var(--text); }
.title-line.accent { color: var(--accent); }

.welcome-desc {
    font-size: 16px; line-height: 1.7;
    color: var(--text-2); font-weight: 400;
    margin-bottom: 40px;
    animation: fadeUp .6s ease .2s both;
}

.welcome-stats {
    display: flex; align-items: center; justify-content: center;
    gap: 20px; margin-bottom: 48px;
    animation: fadeUp .6s ease .3s both;
}
.ws { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ws-val { font-size: 18px; font-weight: 600; color: var(--text); }
.ws-label { font-size: 11px; color: var(--text-3); font-weight: 500; }
.ws-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

.enter-btn {
    padding: 14px 40px;
    background: var(--text); color: var(--bg);
    border: none; border-radius: 6px;
    font-family: var(--sans); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all .2s;
    animation: fadeUp .6s ease .4s both;
}
.enter-btn:hover { background: var(--accent); }

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

/* ===== ZOOM CONTROLS ===== */
#zoom-controls {
    position: fixed; bottom: 20px; right: 176px;
    display: flex; flex-direction: column; gap: 1px;
    border: 1px solid var(--border); border-radius: 6px;
    overflow: hidden; z-index: 50;
}
.ctrl-btn {
    width: 34px; height: 30px;
    background: var(--surface); color: var(--text-2);
    border: none; font-size: 16px;
    cursor: pointer; transition: background .1s;
    display: flex; align-items: center; justify-content: center;
}
.ctrl-btn:hover { background: var(--border); color: var(--text); }
.ctrl-btn--reset { font-size: 20px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ===== COORDS ===== */
#coords-display {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    font-size: 11px; color: var(--text-3); font-weight: 500;
    z-index: 50; font-variant-numeric: tabular-nums;
    display: flex; gap: 8px; align-items: center;
}
.coords-sep { font-size: 8px; }

/* ===== TOOLTIP ===== */
#tooltip {
    position: fixed;
    background: var(--text); color: var(--bg);
    padding: 8px 12px; border-radius: 6px;
    font-size: 12px; z-index: 150; pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.tooltip-title { font-weight: 600; font-size: 13px; }
.tooltip-owner { color: var(--text-3); font-size: 11px; margin-top: 2px; word-break: break-all; }
.tooltip-price { font-weight: 600; margin-top: 4px; }

/* ===== FLASH ===== */
.success-flash {
    position: fixed; inset: 0; background: var(--accent);
    z-index: 250; pointer-events: none;
    animation: flash .4s ease forwards;
}
@keyframes flash { 0% { opacity: .15; } 100% { opacity: 0; } }

/* ===== PAYMENT BANNER ===== */
.payment-banner {
    position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 8px; z-index: 200;
    font-size: 14px; font-weight: 600;
    animation: fadeUp .4s ease both;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.payment-banner.loading { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.payment-banner.success { background: #1a2e0a; color: var(--accent); border: 1px solid #2a4a10; }
.payment-banner.error   { background: #2e0a0a; color: #ff6b6b; border: 1px solid #4a1010; }

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
    .brand { font-size: 14px; }
    .topbar-right .stat-label { display: none; }
    .countdown-label { display: none; }
    #selection-panel { left: 12px; right: 12px; width: auto; }
    .welcome-title { letter-spacing: -1px; }
    #zoom-controls { right: 164px; }
}
