:root {
  --panel: rgba(255, 255, 255, 0.84);
  --ink: #10221d;
  --ink-soft: #48615b;
  --line: rgba(18, 56, 49, 0.12);
  --primary: #184d42;
  --primary-soft: rgba(24, 77, 66, 0.12);
  --accent: #f0bf55;
  --danger: #db6d56;
  --warn: #df8d2b;
  --success: #258b63;
  --shadow: 0 18px 48px rgba(22, 54, 46, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(80, 170, 125, 0.17), transparent 24%),
    radial-gradient(circle at 82% 20%, rgba(244, 169, 64, 0.18), transparent 22%),
    linear-gradient(180deg, #f4f7ef 0%, #edf3f0 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans KR", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(1500px, calc(100vw - 32px));
  margin: 18px auto;
  padding-bottom: 24px;
}

.ambient {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
}

.ambient-left {
  top: -40px;
  left: -80px;
  background: rgba(86, 179, 125, 0.34);
}

.ambient-right {
  top: 80px;
  right: -100px;
  background: rgba(240, 191, 85, 0.28);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2rem, 2vw + 1.4rem, 3.1rem);
  line-height: 1.02;
}

h2 {
  font-size: 1.22rem;
}

.hero-subtitle,
.section-copy,
.status-notice,
.report-card p,
.pending-card p,
.auth-banner p,
.empty-state p,
.national-summary p,
.ranking-card p {
  color: var(--ink-soft);
}

.hero-subtitle {
  margin: 14px 0 0;
  max-width: 68ch;
  line-height: 1.65;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pill,
.mini-pill,
.popup-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 600;
}

.pill {
  padding: 10px 14px;
  background: rgba(16, 77, 66, 0.09);
  color: var(--primary);
}

.pill-muted {
  background: rgba(16, 34, 29, 0.05);
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: 250px;
}

.hero-actions > * {
  width: 100%;
}

.role-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.mode-toggle,
.segmented-row,
.chip-grid,
.draft-actions,
.pending-actions,
.report-card-pills,
.popup-pills,
.map-actions,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-toggle {
  padding: 6px;
  border-radius: 999px;
  background: rgba(16, 77, 66, 0.08);
}

.mode-button,
.primary-button,
.ghost-button,
.segmented-button,
.filter-chip {
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

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

.mode-button {
  flex: 1 1 0;
  padding: 12px 16px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}

.mode-button.is-active {
  background: #ffffff;
  color: var(--primary);
  border-color: rgba(16, 77, 66, 0.16);
}

.primary-button {
  padding: 12px 18px;
  background: linear-gradient(135deg, #164d42 0%, #227259 100%);
  color: #fff;
  font-weight: 700;
}

.ghost-button {
  padding: 11px 16px;
  border-color: rgba(16, 77, 66, 0.18);
  background: rgba(255, 255, 255, 0.65);
  color: var(--primary);
  font-weight: 600;
}

.workspace {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.sidebar,
.map-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stats-card,
.filters-card,
.national-card,
.report-list-card,
.submit-card,
.moderator-card,
.public-card,
.student-card,
.map-card {
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.compact-head {
  margin-top: 18px;
}

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

.stat-tile {
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(244, 248, 244, 0.92));
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.stat-label {
  display: block;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.stat-tile strong {
  display: block;
  margin-top: 8px;
  font-size: 1.85rem;
}

.filter-block + .filter-block {
  margin-top: 14px;
}

.filter-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  font-weight: 600;
}

.segmented-button,
.filter-chip {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 600;
}

.segmented-button.is-active,
.filter-chip.is-active {
  border-color: rgba(16, 77, 66, 0.24);
  background: rgba(16, 77, 66, 0.12);
  color: var(--primary);
}

.filter-chip[data-category-filter]:not([data-category-filter="all"])::before,
.filter-chip[data-facility-layer]:not([data-facility-layer="none"])::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--chip-color, #7da49b);
  display: inline-block;
  margin-right: 8px;
}

.filter-chip[style*="--chip-color"]::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--chip-color, #7da49b);
  display: inline-block;
  margin-right: 8px;
}

.public-card,
.student-card {
  display: flex;
  flex-direction: column;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(16, 77, 66, 0.06), rgba(240, 191, 85, 0.08));
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.layer-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.layer-card {
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.layer-card.is-active {
  border-color: rgba(16, 77, 66, 0.24);
  box-shadow: inset 0 0 0 1px rgba(16, 77, 66, 0.1);
}

.layer-card.is-editing {
  box-shadow:
    inset 0 0 0 1px rgba(16, 77, 66, 0.18),
    0 0 0 3px rgba(16, 77, 66, 0.08);
}

.layer-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.layer-card-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layer-dot,
.legend-square {
  display: inline-block;
  background: var(--swatch);
}

.layer-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.legend-square {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.layer-count {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.layer-card p {
  margin: 0;
  line-height: 1.6;
}

.layer-actions {
  margin-top: 12px;
}

.layer-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.feature-preview {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.feature-preview li + li {
  margin-top: 4px;
}

.student-layer-form {
  display: grid;
  gap: 12px;
}

.upload-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(16, 77, 66, 0.08), rgba(240, 191, 85, 0.08));
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.help-copy {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.field-fill {
  flex: 1 1 220px;
}

.compact-button {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.danger-button {
  color: var(--danger);
}

.national-summary {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(16, 77, 66, 0.08), rgba(240, 191, 85, 0.08));
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.national-summary strong,
.ranking-card strong {
  display: block;
  margin-bottom: 6px;
}

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

.summary-tile {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.summary-tile span {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.summary-tile strong {
  margin-top: 6px;
  font-size: 1.2rem;
}

.summary-gradient {
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--legend-low), #f0c25a 55%, var(--legend-high));
}

.summary-gradient-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.ranking-list,
.report-list,
.pending-list {
  display: grid;
  gap: 12px;
}

.ranking-card,
.report-card,
.pending-card {
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.ranking-card,
.report-card {
  cursor: pointer;
}

.ranking-card.is-selected,
.report-card.is-selected {
  border-color: rgba(16, 77, 66, 0.28);
  box-shadow: inset 0 0 0 1px rgba(16, 77, 66, 0.14);
}

.ranking-value {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--primary);
  font-weight: 700;
}

.ranking-value b {
  font-size: 1.15rem;
}

.report-card strong,
.pending-card strong,
.popup-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.report-card p,
.pending-card p,
.popup-card p,
.ranking-card p {
  margin: 0;
  line-height: 1.6;
}

.report-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.mini-pill,
.popup-pill {
  padding: 6px 10px;
  background: rgba(16, 34, 29, 0.05);
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.mini-pill[style*="--pill-color"],
.popup-pill[style*="--pill-color"] {
  background: color-mix(in srgb, var(--pill-color) 14%, white);
  color: color-mix(in srgb, var(--pill-color) 85%, black);
}

.draft-location-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(16, 77, 66, 0.08), rgba(240, 191, 85, 0.08));
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.draft-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.draft-actions {
  margin-top: 12px;
}

.report-form,
.moderator-login-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.review-note-field {
  width: 100%;
  border: 1px solid rgba(16, 77, 66, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  padding: 12px 14px;
  color: var(--ink);
}

.field textarea,
.review-note-field {
  resize: vertical;
}

.submit-button {
  margin-top: 4px;
}

.auth-banner {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(16, 77, 66, 0.08);
}

.auth-banner strong {
  display: block;
  margin-bottom: 4px;
}

.auth-banner-active {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pending-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.map-card {
  min-height: calc(100vh - 90px);
}

.map-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.map-stage {
  overflow: hidden;
  min-height: 720px;
  border-radius: 24px;
  border: 1px solid rgba(16, 77, 66, 0.1);
}

.map-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-top: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(16, 77, 66, 0.08);
  font-size: 0.88rem;
}

.legend-swatch,
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--swatch);
}

.legend-gradient {
  width: 120px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--legend-low), #f0c25a 55%, var(--legend-high));
}

.status-notice {
  max-width: 440px;
  margin: 0;
  line-height: 1.55;
  font-size: 0.92rem;
}

.status-notice[data-tone="success"] {
  color: var(--success);
}

.status-notice[data-tone="warn"] {
  color: var(--warn);
}

.status-notice[data-tone="error"] {
  color: var(--danger);
}

.empty-state {
  padding: 22px 16px;
  text-align: center;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.empty-state.compact {
  padding-block: 18px;
}

.report-marker-wrapper {
  background: transparent;
  border: none;
}

.marker-wrapper {
  background: transparent;
  border: none;
}

.report-marker,
.national-stat-marker,
.facility-marker {
  display: block;
  border-radius: 999px;
  border: 3px solid #ffffff;
  box-shadow: 0 7px 18px rgba(16, 34, 29, 0.24);
}

.report-marker {
  width: 22px;
  height: 22px;
  background: var(--marker);
}

.report-marker.severity-high {
  transform: scale(1.06);
}

.report-marker.severity-low {
  opacity: 0.86;
}

.report-marker.is-selected {
  outline: 3px solid rgba(16, 77, 66, 0.25);
  outline-offset: 2px;
}

.national-stat-marker {
  width: var(--size);
  height: var(--size);
  background: var(--marker);
}

.national-stat-marker.is-selected,
.facility-marker.is-selected {
  outline: 3px solid rgba(16, 77, 66, 0.3);
  outline-offset: 2px;
}

.facility-marker {
  width: 18px;
  height: 18px;
  background: var(--marker);
}

.public-marker,
.student-marker {
  display: block;
  border-radius: 999px;
  border: 3px solid #ffffff;
  box-shadow: 0 7px 18px rgba(16, 34, 29, 0.24);
}

.public-marker {
  width: var(--size);
  height: var(--size);
  background: var(--marker);
}

.student-marker {
  width: 20px;
  height: 20px;
  background: var(--marker);
}

.student-marker.is-selected {
  outline: 3px solid rgba(16, 77, 66, 0.28);
  outline-offset: 2px;
}

.legend-ring {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #184d42;
  background: rgba(78, 192, 143, 0.15);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.96);
}

.popup-card {
  min-width: 220px;
}

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

  .map-column {
    order: 1;
  }

  .sidebar {
    order: 2;
  }

  .map-card {
    min-height: auto;
  }

  .map-stage {
    min-height: 56vh;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 16px, 100%);
    margin: 8px auto 14px;
  }

  .hero-panel,
  .map-head,
  .map-footer,
  .auth-banner-active {
    flex-direction: column;
  }

  .hero-actions {
    min-width: 0;
  }

  .mode-toggle {
    width: 100%;
  }

  .mode-button,
  .primary-button,
  .ghost-button,
  .segmented-button,
  .filter-chip {
    min-height: 46px;
  }

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

  .map-stage {
    min-height: 52vh;
  }

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

@media (max-width: 520px) {
  .hero-panel,
  .stats-card,
  .filters-card,
  .national-card,
  .report-list-card,
  .submit-card,
  .moderator-card,
  .public-card,
  .student-card,
  .map-card {
    padding: 16px;
  }

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

  .map-stage {
    min-height: 48vh;
  }
}
