:root {
    --bg: #f3eee3;
    --panel: rgba(255, 251, 244, 0.88);
    --ink: #24333f;
    --muted: #64748b;
    --line: rgba(36, 51, 63, 0.12);
    --shadow: 0 22px 45px rgba(68, 55, 23, 0.14);
    --teal: #0f766e;
    --teal-soft: #d4f3ec;
    --sun: #ef7d57;
    --sun-soft: #ffd9bf;
    --paper-edge: #efe5d6;
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: "SUIT Variable", "Pretendard", sans-serif;
    color: var(--ink);
    overflow-x: hidden;
    background:
        radial-gradient(circle at 0% 0%, rgba(239, 125, 87, 0.18), transparent 28%),
        radial-gradient(circle at 100% 18%, rgba(15, 118, 110, 0.18), transparent 30%),
        linear-gradient(180deg, #faf5ea 0%, #f2ecde 100%);
}

body.workspace-active {
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

canvas {
    display: block;
    width: 100%;
    border-radius: 18px;
}

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

body.workspace-active .app-shell {
    height: 100dvh;
    padding: 10px;
    gap: 10px;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 22px;
    background: rgba(255, 250, 240, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

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

.topbar-copy h1 {
    margin: 4px 0 0;
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    line-height: 1.1;
}

.topbar-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    text-align: right;
    max-width: 420px;
}

.compact-back {
    padding: 10px 12px;
    border-radius: 14px;
    white-space: nowrap;
}

body.workspace-active .app-topbar {
    padding: 8px 12px;
    border-radius: 16px;
    gap: 12px;
}

body.workspace-active .topbar-copy .eyebrow,
body.workspace-active .topbar-subtitle {
    display: none;
}

body.workspace-active .topbar-copy h1 {
    margin: 0;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
}

body.workspace-active .compact-back {
    padding: 8px 10px;
    border-radius: 12px;
}

.home-screen {
    display: grid;
    gap: 14px;
}

.home-hero {
    padding: 22px;
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(255, 252, 246, 0.92), rgba(252, 245, 232, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow);
}

.home-hero h2 {
    margin: 8px 0 8px;
    font-size: clamp(1.5rem, 2.8vw, 2.25rem);
}

.home-hero p:last-child {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.choice-card {
    position: relative;
    text-align: left;
    padding: 22px 20px 20px;
    border: 0;
    border-radius: 26px;
    background: linear-gradient(160deg, rgba(255, 251, 243, 0.98), rgba(239, 248, 245, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.choice-card strong {
    display: block;
    margin: 14px 0 8px;
    font-size: 1.18rem;
}

.choice-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.choice-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--sun));
    color: white;
    font-weight: 800;
}

.is-hidden {
    display: none !important;
}

.app-header {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 18px;
}

.brand-block,
.header-card,
.tab-bar,
.control-panel,
.sheet {
    backdrop-filter: blur(16px);
}

.app-header,
.tab-bar {
    display: none;
}

.brand-block,
.header-card {
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: linear-gradient(145deg, rgba(255, 252, 246, 0.92), rgba(252, 245, 232, 0.92));
    border-radius: 28px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker,
.sheet-kicker,
.header-card-title {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal);
    font-weight: 700;
}

.brand-block h1,
.sheet-head h2 {
    margin: 8px 0 6px;
    font-size: clamp(1.85rem, 3vw, 2.7rem);
    line-height: 1.08;
}

.brand-copy,
.sheet-subcopy {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.header-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.step-row {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.step-row span {
    border-radius: 16px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(239, 125, 87, 0.12));
    border: 1px solid rgba(15, 118, 110, 0.12);
    font-weight: 600;
}

.tab-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    background: rgba(255, 250, 240, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 8px;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.tab-button,
.view-button,
.style-button,
.tool-button,
.primary-button,
.ghost-button {
    border: 0;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.tab-button {
    padding: 14px 12px;
    border-radius: 18px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

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

.tab-button.is-active {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(239, 125, 87, 0.2));
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.12);
}

.tab-panel {
    display: none;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    min-width: 0;
    min-height: 0;
    width: 100%;
}

.tab-panel.is-active {
    display: grid;
    flex: 1;
    min-height: 0;
}

.tab-host {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

body.workspace-active .tab-panel {
    grid-template-columns: minmax(260px, 290px) minmax(0, 1fr);
    gap: 14px;
}

body.workspace-active .tab-panel.is-active {
    height: 100%;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

body.workspace-active .control-panel {
    align-self: stretch;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 6px;
}

body.workspace-active .control-panel::-webkit-scrollbar {
    width: 10px;
}

body.workspace-active .control-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.18);
}

.panel-card,
.sheet {
    border-radius: 28px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
}

.panel-card {
    padding: 18px;
}

body.workspace-active .panel-card {
    padding: 14px;
    border-radius: 22px;
}

.workspace-panel {
    min-width: 0;
}

body.workspace-active .workspace-panel {
    align-self: stretch;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.92rem;
    font-weight: 700;
}

.text-input,
.select-input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
}

.text-input:focus,
.select-input:focus {
    outline: 2px solid rgba(15, 118, 110, 0.22);
    border-color: rgba(15, 118, 110, 0.24);
}

.button-row,
.segmented-row,
.search-row {
    display: grid;
    gap: 10px;
}

.button-row,
.segmented-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.primary-button,
.ghost-button,
.view-button,
.style-button,
.tool-button {
    padding: 12px 14px;
    border-radius: 16px;
    font-weight: 700;
}

.primary-button {
    background: linear-gradient(135deg, var(--teal), #14867d);
    color: #fff;
    box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.primary-button.compact {
    padding-inline: 16px;
}

.ghost-button,
.view-button,
.style-button,
.tool-button {
    background: rgba(255, 255, 255, 0.84);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(36, 51, 63, 0.08);
}

.view-button.is-active,
.style-button.is-active,
.tool-button.is-active {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(239, 125, 87, 0.18));
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.2);
    color: var(--ink);
}

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

.style-button-wide {
    grid-column: 1 / -1;
}

.slider-group + .slider-group {
    margin-top: 14px;
}

.slider-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 16px;
    font-size: 0.95rem;
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    margin: 0;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--teal-soft), var(--sun-soft));
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--sun);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px rgba(239, 125, 87, 0.16);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--sun);
    border: 3px solid #fff;
}

.helper-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.55;
}

.helper-list li + li {
    margin-top: 8px;
}

.sheet {
    padding: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 251, 242, 0.96));
}

body.workspace-active .sheet {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 18px;
    border-radius: 24px;
}

.sheet-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}

body.workspace-active .sheet-head {
    gap: 10px;
    margin-bottom: 12px;
}

body.workspace-active .sheet-head h2 {
    font-size: clamp(1.35rem, 2.3vw, 1.9rem);
    margin: 6px 0 4px;
}

.stat-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.stat-chip {
    min-width: 146px;
    max-width: 220px;
    border-radius: 18px;
    padding: 12px 14px;
    background: linear-gradient(145deg, rgba(255, 246, 228, 0.96), rgba(235, 252, 248, 0.96));
    border: 1px solid rgba(15, 118, 110, 0.12);
}

body.workspace-active .stat-chip {
    min-width: 118px;
    padding: 10px 12px;
}

.stat-chip span {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.stat-chip strong {
    display: block;
    font-size: 0.98rem;
    line-height: 1.35;
}

.sheet-grid {
    display: grid;
    gap: 18px;
}

body.workspace-active .sheet-grid {
    flex: 1;
    min-height: 0;
}

.sheet-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sheet-card {
    padding: 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(253, 248, 239, 0.98));
    border: 1px solid var(--paper-edge);
    min-width: 0;
}

body.workspace-active .sheet-card {
    padding: 14px;
    border-radius: 20px;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.card-title-row h3 {
    margin: 0;
    font-size: 1.08rem;
}

.pill-label {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--teal);
    font-size: 0.84rem;
    font-weight: 800;
}

.render-surface,
.map-surface {
    width: 100%;
    min-height: 400px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #dceefe, #eef6ff 38%, #f5ecdd 100%);
    border: 1px solid rgba(36, 51, 63, 0.08);
}

.render-surface canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
}

body.workspace-active #real-map {
    min-height: 420px;
}

.note-strip {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

body.workspace-active .note-strip {
    margin-top: 14px;
}

.note-card {
    border-radius: 18px;
    padding: 14px 16px;
    background: rgba(255, 253, 247, 0.92);
    border: 1px dashed rgba(36, 51, 63, 0.12);
}

.note-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.note-card span {
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.92rem;
}

.search-results {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.search-result-button {
    text-align: left;
    padding: 11px 12px;
    border-radius: 14px;
    border: 1px solid rgba(36, 51, 63, 0.08);
    background: rgba(255, 255, 255, 0.84);
    cursor: pointer;
}

.search-result-button strong,
.search-result-button span {
    display: block;
}

.search-result-button strong {
    margin-bottom: 3px;
}

.search-result-button span {
    color: var(--muted);
    font-size: 0.88rem;
}

.leaflet-container {
    font-family: "SUIT Variable", "Pretendard", sans-serif;
}

#lab-3d-container,
#draw-editor-canvas,
#draw-3d-container {
    touch-action: none;
}

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

    body.workspace-active .tab-panel {
        grid-template-columns: 1fr;
    }

    .control-panel {
        order: 2;
    }

    .workspace-panel {
        order: 1;
    }
}

@media (max-height: 860px) {
    body.workspace-active .app-shell {
        padding: 8px;
        gap: 8px;
    }

    body.workspace-active .app-topbar {
        padding: 6px 10px;
    }

    body.workspace-active .sheet {
        padding: 14px;
    }

    body.workspace-active .sheet-subcopy,
    body.workspace-active .note-strip {
        display: none;
    }

    body.workspace-active .stat-chip {
        min-width: 104px;
        padding: 8px 10px;
    }

    body.workspace-active #real-map,
    body.workspace-active .render-surface,
    body.workspace-active .map-surface {
        min-height: 320px;
    }
}

@media (max-width: 960px) {
    .app-shell {
        padding: 12px;
    }

    .app-header,
    .sheet-head,
    .sheet-grid-two,
    .note-strip,
    .choice-grid,
    .tab-bar,
    .button-row,
    .segmented-row,
    .style-grid,
    .tool-grid,
    .search-row {
        grid-template-columns: 1fr;
    }

    .app-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-subtitle {
        text-align: left;
        max-width: none;
    }

    .stat-chip-group {
        justify-content: flex-start;
    }

    .render-surface,
    .map-surface {
        min-height: 320px;
    }
}


