* {
  box-sizing: border-box;
}

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

body.experience-agriculture-body {
  --lab-accent: #9fe35d;
  overflow: hidden;
  background: var(--lab-bg);
  color: var(--lab-ink);
  font-family: var(--font-family), "Noto Sans KR", sans-serif;
  letter-spacing: 0;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 50;
  transform: translateY(-140%);
  padding: 8px 12px;
  border-radius: var(--lab-radius);
  background: #ffffff;
  color: #111111;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.ag-flow {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--lab-bg);
}

.ag-stage {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 18%, rgba(133, 214, 63, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 30%),
    var(--lab-bg);
}

.ag-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.ag-stage canvas:active {
  cursor: grabbing;
}

/* .ag-loading/.ag-toast/.ag-spinner 공통 규칙은 static/css/lab-experience.css로 이동. */
.ag-toast {
  bottom: 42px;
}

.ag-map-tooltip {
  position: absolute;
  z-index: 14;
  display: grid;
  gap: 2px;
  max-width: 260px;
  padding: 8px 11px;
  border: 1px solid rgba(170, 227, 104, 0.28);
  border-radius: var(--lab-radius);
  background: var(--lab-panel-strong);
  backdrop-filter: blur(var(--lab-blur));
  pointer-events: none;
}

.ag-map-tooltip strong {
  color: #ffffff;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 12px;
  font-weight: 700;
}

.ag-map-tooltip span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 700;
}

.ag-map-tooltip em {
  color: rgba(178, 235, 94, 0.84);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.ag-topbar,
.ag-panel,
.ag-view-controls {
  position: fixed;
  z-index: 10;
}

.ag-topbar {
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: 40px minmax(132px, 1fr) auto;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.ag-topbar > * {
  pointer-events: auto;
}

/* .ag-icon-button(+--small/:disabled/아이콘 크기) 공통 규칙은 static/css/lab-experience.css로 이동. */

.ag-brand {
  display: grid;
  gap: 1px;
  min-width: 0;
  width: fit-content;
  padding: 6px 12px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  backdrop-filter: blur(var(--lab-blur));
}

.ag-brand strong {
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.ag-brand span {
  color: var(--lab-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.ag-summary {
  display: flex;
  gap: 8px;
  justify-self: end;
  margin: 0;
}

.ag-summary > div {
  display: grid;
  gap: 1px;
  min-width: 76px;
  padding: 6px 11px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  backdrop-filter: blur(var(--lab-blur));
}

.ag-summary dt {
  color: var(--lab-dim);
  font-size: 10px;
  font-weight: 800;
}

.ag-summary dd {
  margin: 0;
  color: #ffffff;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.ag-view-controls {
  left: 14px;
  top: 76px;
  display: grid;
  gap: 8px;
}

.ag-control-group {
  display: grid;
  gap: 6px;
}

.ag-compass-rose {
  position: relative;
  display: block;
  width: 21px;
  height: 21px;
  transform: rotate(var(--ag-bearing, 0deg));
}

.ag-compass-needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 9px solid #9fe35d;
  transform: translate(-50%, -100%);
}

.ag-compass-n {
  position: absolute;
  left: 50%;
  bottom: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 8px;
  font-weight: 900;
  transform: translateX(-50%);
}

.ag-panel {
  top: max(70px, calc(env(safe-area-inset-top) + 62px));
  right: 14px;
  bottom: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
  width: min(338px, calc(100vw - 28px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  scrollbar-width: thin;
  transition:
    transform 200ms ease,
    opacity 200ms ease;
}

body.is-panel-collapsed .ag-panel {
  transform: translateX(calc(100% + 22px));
  opacity: 0;
  pointer-events: none;
}

.ag-panel-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius-lg);
  background: var(--lab-panel);
  backdrop-filter: blur(var(--lab-blur));
}

.ag-section-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ag-section-head h1,
.ag-section-head h2 {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.ag-section-head .material-symbols-outlined {
  color: rgba(159, 227, 93, 0.9);
  font-size: 17px;
}

.ag-section-head output {
  color: var(--lab-muted);
  font-size: 11px;
  font-weight: 800;
}

.ag-section-tools {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.ag-rank-pager {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ag-rank-pager output {
  min-width: 40px;
  color: var(--lab-muted);
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.ag-segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-surface);
}

.ag-segmented button {
  min-width: 0;
  min-height: 32px;
  border: 0;
  border-radius: var(--lab-radius-sm);
  background: transparent;
  color: var(--lab-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.ag-segmented button:hover,
.ag-segmented button:focus-visible {
  background: var(--lab-surface-hover);
  color: #ffffff;
  outline: none;
}

.ag-segmented button.is-active {
  background: rgba(159, 227, 93, 0.18);
  color: #f4ffd8;
  box-shadow: inset 0 0 0 1px rgba(159, 227, 93, 0.22);
}

.ag-readout {
  display: grid;
  gap: 2px;
  padding: 11px 12px;
  border: 1px solid rgba(159, 227, 93, 0.2);
  border-radius: var(--lab-radius);
  background: linear-gradient(135deg, rgba(159, 227, 93, 0.13), rgba(245, 190, 64, 0.08));
}

.ag-readout strong {
  color: #ffffff;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.ag-readout span {
  color: var(--lab-muted);
  font-size: 11px;
  font-weight: 700;
}

.ag-snapshot-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.ag-snapshot-stats > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-surface);
}

.ag-snapshot-stats dt {
  color: var(--lab-dim);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.ag-snapshot-stats dd {
  margin: 0;
  color: #ffffff;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ag-snapshot-meta,
.ag-source-note {
  margin: 0;
  color: var(--lab-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
}

.ag-source-note--dim {
  color: var(--lab-dim);
}

.ag-control-label {
  color: var(--lab-dim);
  font-size: 10px;
  font-weight: 800;
}

.ag-range-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 48px;
  align-items: center;
  gap: 8px;
  color: var(--lab-muted);
  font-size: 11px;
  font-weight: 800;
}

.ag-range-control input {
  width: 100%;
  accent-color: #9fe35d;
}

.ag-range-control.is-disabled {
  opacity: 0.44;
}

.ag-range-control.is-disabled input {
  cursor: default;
}

.ag-range-control output {
  color: #ffffff;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 11px;
  text-align: right;
}

.ag-heat-scale {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--lab-dim);
  font-size: 10px;
  font-weight: 800;
}

.ag-heat-scale i {
  height: 8px;
  border-radius: var(--lab-radius-pill);
  /* JS(updateHeatScaleLegend)가 활성 데이터 모드의 실제 램프 색으로 즉시 덮어쓴다.
     아래 값은 JS 실행 전 첫 페인트 동안만 보이는 농지 램프 근사 폴백. */
  background: linear-gradient(90deg, #122a1a, #285026, #568432, #9ca83a, #d6af3a, #ffc440);
  box-shadow: 0 0 12px rgba(255, 196, 64, 0.16);
}

.ag-rank-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ag-rank-list li {
  min-width: 0;
}

.ag-rank-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-surface);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.ag-rank-item:hover,
.ag-rank-item:focus-visible {
  border-color: rgba(159, 227, 93, 0.35);
  background: var(--lab-surface-hover);
  outline: none;
}

.ag-rank-index {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: var(--lab-radius-sm);
  background: rgba(159, 227, 93, 0.16);
  color: #eaffcf;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 12px;
  font-weight: 800;
}

.ag-rank-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ag-rank-name {
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-rank-meta {
  color: var(--lab-dim);
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-rank-value {
  color: #ffffff;
  font-family: "JetBrains Mono", "Noto Sans KR", monospace;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ag-rank-empty {
  padding: 10px 4px;
  color: var(--lab-dim);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .ag-summary > div {
    min-width: 62px;
    padding: 5px 8px;
  }

  .ag-summary dd {
    font-size: 12px;
  }

  .ag-panel {
    top: auto;
    left: 14px;
    right: auto;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    max-height: 46dvh;
  }

  body.is-panel-collapsed .ag-panel {
    transform: translateY(calc(100% + 22px));
  }

  .ag-view-controls {
    top: auto;
    bottom: calc(46dvh + 26px);
  }

  body.is-panel-collapsed .ag-view-controls {
    bottom: 26px;
  }
}

@media (max-width: 560px) {
  .ag-topbar {
    grid-template-columns: 40px 1fr;
  }

  .ag-summary {
    display: none;
  }

  .ag-readout strong {
    font-size: 22px;
  }

  .ag-snapshot-stats {
    gap: 4px;
  }

  .ag-snapshot-stats > div {
    padding: 8px 6px;
  }

  .ag-snapshot-stats dt {
    font-size: 9px;
  }

  .ag-section-head--rank {
    align-items: flex-start;
  }

  .ag-section-tools {
    gap: 6px;
  }
}
