:root {
    color-scheme: light;
    --bg: #f4f7f5;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #5f6c7b;
    --primary: #1f7a4d;
    --primary-dark: #145c38;
    --border: #d8e0da;
    --accent: #e8f5ee;
    --top100: #b45309;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", "Malgun Gothic", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #123524;
    color: #f8faf9;
    padding: 1.5rem 1rem;
}

.brand a {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
}

.brand span {
    display: block;
    margin-top: 0.25rem;
    color: #c7dfd1;
    font-size: 0.9rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 2rem;
}

.nav-menu a {
    padding: 0.75rem 0.9rem;
    border-radius: 0.6rem;
    color: #e7f2eb;
}

.nav-menu a.active {
    background: rgba(255, 255, 255, 0.14);
    font-weight: 600;
}

.main-content {
    padding: 2rem;
}

.home-page .hero {
    margin-bottom: 2rem;
}

.home-page .hero h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
}

.home-page .hero p,
.page-description,
.result-count,
.loading-text,
.empty-text {
    color: var(--muted);
}

.metadata-panel,
.search-panel,
.menu-card,
.schedule-panel,
.mountain-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(18, 53, 36, 0.05);
}

.metadata-panel {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.metadata-panel dl,
.mountain-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1.5rem;
    margin: 0;
}

.metadata-panel dt,
.mountain-details dt {
    font-size: 0.85rem;
    color: var(--muted);
}

.metadata-panel dd,
.mountain-details dd {
    margin: 0.15rem 0 0;
}

.map-workspace {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 1rem;
    min-height: calc(100vh - 170px);
}

.map-control-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.map-control-section {
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(18, 53, 36, 0.05);
}

.map-control-section h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}

.map-status {
    margin: 0.8rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.naver-map {
    min-height: 680px;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    background: #dbe4df;
}

.map-info-window {
    display: grid;
    gap: 0.45rem;
    min-width: 240px;
    max-width: 320px;
    padding: 0.75rem 0.85rem;
}

.map-info-window header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.map-info-window strong {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.25;
}

.map-info-window .map-info-address {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.35;
}

.map-info-window em {
    flex: 0 0 auto;
    color: var(--top100);
    font-size: 0.8rem;
    font-style: normal;
    font-weight: 700;
}

.map-info-window dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.8rem;
    margin: 0.1rem 0 0;
}

.map-info-window dl div {
    min-width: 0;
}

.map-info-window dt {
    color: var(--muted);
    font-size: 0.75rem;
}

.map-info-window dd {
    margin: 0.1rem 0 0;
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.map-info-window p {
    margin: 0.2rem 0 0;
    color: #334155;
    font-size: 0.84rem;
    line-height: 1.45;
}

.map-info-window .map-info-empty {
    color: var(--muted);
}

.mountain-poi-marker {
    position: relative;
    min-width: 44px;
    max-width: 92px;
    padding: 0.32rem 0.48rem;
    overflow: hidden;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #0f766e;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
    color: #ffffff;
    cursor: pointer;
    font: 700 0.78rem/1.1 "Segoe UI", "Malgun Gothic", sans-serif;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mountain-poi-marker::after {
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 10px;
    height: 10px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    background: inherit;
    content: "";
    transform: translateX(-50%) rotate(45deg);
}

.mountain-poi-marker.is-top100 {
    background: #b45309;
}

.poi-marker {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 0.28rem;
    min-width: 56px;
    max-width: 118px;
    padding: 0.32rem 0.5rem 0.36rem;
    overflow: visible;
    border: 2px solid #ffffff;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
    color: #ffffff;
    cursor: pointer;
    font: 800 0.78rem/1.1 "Segoe UI", "Malgun Gothic", sans-serif;
}

.poi-marker::after {
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 12px;
    height: 12px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    background: inherit;
    content: "";
    transform: translateX(-50%) rotate(45deg);
}

.poi-marker-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.poi-marker-icon svg {
    width: 17px;
    height: 17px;
}

.poi-marker-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poi-marker-mountain {
    background: #0f766e;
}

.poi-marker-mountain.is-top100 {
    background: #b45309;
}

.poi-marker-temple {
    background: #7c3aed;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.menu-card {
    padding: 1.25rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(18, 53, 36, 0.08);
}

.menu-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.menu-card p {
    margin: 0;
    color: var(--muted);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0 0 0.35rem;
}

.search-panel {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    font: inherit;
    background: #fff;
}

.btn {
    border: none;
    border-radius: 0.65rem;
    padding: 0.75rem 1rem;
    font: inherit;
    cursor: pointer;
}

.btn-outline-primary {
    background: var(--accent);
    color: var(--primary-dark);
    border: 1px solid #b9dcc8;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:disabled,
.btn-outline-primary:disabled {
    opacity: 0.6;
    cursor: wait;
}

.schedule-workspace {
    display: grid;
    grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.schedule-panel {
    padding: 1.25rem;
}

.schedule-panel h2 {
    margin: 0 0 1rem;
    font-size: 1.15rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 0.85rem;
}

.form-grid-wide {
    grid-column: 1 / -1;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
}

.weather-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.3rem;
    padding: 1rem;
    border: 1px solid #b9dcc8;
    border-radius: 0.75rem;
    background: var(--accent);
}

.weather-preview h3 {
    margin: 0 0 0.35rem;
    font-size: 0.98rem;
}

.weather-preview p,
.weather-preview span {
    display: block;
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
}

.form-status {
    color: var(--muted);
    font-size: 0.9rem;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-title-row h2 {
    margin: 0;
}

.schedule-list {
    display: grid;
    gap: 0.85rem;
}

.schedule-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fbfdfc;
}

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

.schedule-card span {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.schedule-card dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0.9rem 0 0;
}

.schedule-card dt {
    color: var(--muted);
    font-size: 0.8rem;
}

.schedule-card dd {
    margin: 0.15rem 0 0;
    line-height: 1.35;
}

.schedule-weather {
    grid-column: span 1;
}

.schedule-card p {
    margin: 0.85rem 0 0;
    color: #344054;
    line-height: 1.5;
}

.mountain-list {
    display: block;
}

.mountain-card {
    display: block;
    width: 100%;
    padding: 1.25rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.mountain-card:hover,
.mountain-card:focus-visible {
    border-color: #9ac9ad;
    box-shadow: 0 12px 28px rgba(18, 53, 36, 0.09);
    outline: none;
    transform: translateY(-1px);
}

.mountain-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mountain-card-header h3 {
    margin: 0;
}

.mountain-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.mountain-card-action {
    flex: 0 0 auto;
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-top100 {
    background: #fff7ed;
    color: var(--top100);
    border: 1px solid #fed7aa;
}

.badge-temple {
    background: #eef6ff;
    color: #075985;
    border: 1px solid #bae6fd;
}

.full-width {
    grid-column: 1 / -1;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.42);
}

.mountain-modal {
    width: min(820px, 100%);
    max-height: min(760px, calc(100vh - 2.5rem));
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.mountain-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.mountain-modal-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.45rem;
}

.mountain-modal-header p {
    margin: 0;
    color: var(--muted);
}

.modal-close-button {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
}

.modal-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    margin: 0;
    padding: 1rem 1.5rem;
    background: #f8faf9;
    border-bottom: 1px solid var(--border);
}

.modal-summary dt {
    font-size: 0.85rem;
    color: var(--muted);
}

.modal-summary dd {
    margin: 0.15rem 0 0;
}

.mountain-modal-body {
    max-height: calc(min(760px, 100vh - 2.5rem) - 178px);
    overflow-y: auto;
    padding: 1.25rem 1.5rem 1.5rem;
}

.mountain-modal-body h3,
.description-block h4 {
    margin: 0;
}

.mountain-modal-body h3 {
    font-size: 1.1rem;
}

.mountain-image-panel {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.mountain-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 320px));
    gap: 0.9rem;
    justify-content: start;
    margin-top: 0.9rem;
}

.mountain-photo {
    margin: 0;
    overflow: hidden;
    inline-size: min(100%, 320px);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: #f8faf9;
}

.mountain-photo-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    height: 240px;
    background: #e5e7eb;
}

.mountain-photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.mountain-photo figcaption {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.6rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.mountain-photo figcaption span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mountain-photo figcaption a {
    flex: 0 0 auto;
    color: var(--primary);
    text-decoration: none;
}

.image-loading-text {
    margin: 0.6rem 0 0;
    color: var(--muted);
}

.mountain-description-panel {
    padding-top: 1.25rem;
}

.description-block {
    margin-top: 1.1rem;
}

.description-block h4 {
    color: var(--primary-dark);
    font-size: 0.95rem;
}

.description-block p,
.empty-description {
    margin: 0.5rem 0 0;
    color: #344054;
    line-height: 1.65;
    white-space: pre-wrap;
}

#blazor-error-ui {
    display: none;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 1.25rem 1rem;
        padding-bottom: 1rem;
    }

    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 1rem;
    }

    .nav-menu a {
        padding: 0.65rem 0.75rem;
    }

    .main-content {
        padding: 1.25rem 1rem;
    }

    .page-header {
        flex-direction: column;
    }

    .map-workspace {
        grid-template-columns: 1fr;
    }

    .schedule-workspace,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .inline-form,
    .weather-preview,
    .form-actions,
    .section-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .weather-preview {
        display: grid;
    }

    .schedule-card dl {
        grid-template-columns: 1fr;
    }

    .naver-map {
        min-height: 520px;
    }

    .metadata-panel dl,
    .mountain-details {
        grid-template-columns: 1fr;
    }

    .mountain-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .mountain-modal-header {
        padding: 1rem;
    }

    .mountain-modal-body,
    .modal-summary {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
