:root {
  --joseon-paper: #f3efe4;
  --joseon-paper-strong: #e9e1cf;
  --joseon-surface: #fbfaf5;
  --joseon-ink: #24221e;
  --joseon-muted: #6e695f;
  --joseon-faint: #948d80;
  --joseon-line: #d3cbbb;
  --joseon-line-strong: #a99f8c;
  --joseon-red: #9f392d;
  --joseon-red-soft: #f2e1dc;
  --joseon-blue: #365d69;
  --joseon-shadow: 0 -10px 36px rgba(44, 37, 27, 0.16);
  --font-sans: "IBM Plex Sans KR", "Noto Sans KR", "Noto Sans CJK KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans KR", "Noto Sans CJK KR", "Apple SD Gothic Neo", "Malgun Gothic", ui-monospace, SFMono-Regular, Consolas, monospace;
  --accent: var(--joseon-red);
  --accent-soft: var(--joseon-red-soft);
}

html,
body.joseon-page {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.joseon-page {
  min-width: 320px;
  background: var(--joseon-paper);
  color: var(--joseon-ink);
  font-family: var(--font-sans);
  line-height: 1.5;
}

.joseon-page button,
.joseon-page select,
.joseon-page input {
  font: inherit;
}

.joseon-page dialog,
.j-map.maplibregl-map,
.j-map .maplibregl-popup,
.j-map .maplibregl-ctrl {
  font-family: var(--font-sans);
}

.joseon-page button {
  color: inherit;
}

.j-head {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--joseon-line-strong);
  background: var(--joseon-paper);
}

.j-product {
  display: flex;
  align-items: center;
  min-width: 0;
}

.j-playcity-link,
.j-brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
}

.j-playcity-link {
  flex: none;
  color: var(--brand);
}

.j-brand {
  margin-left: 11px;
  padding: 0 7px 0 12px;
  border-left: 1px solid var(--joseon-line-strong);
  color: var(--brand);
}

.j-brand b {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
}

.j-head-nav {
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 3px;
}

.j-head-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 7px;
  color: var(--joseon-muted);
  font-size: 13px;
  text-decoration: none;
}

.j-head-nav a:hover {
  color: var(--joseon-ink);
}

.j-head .t-head-auth {
  --pc-auth-surface: var(--joseon-surface);
  --pc-auth-surface-strong: var(--joseon-surface);
  --pc-auth-border: var(--joseon-line-strong);
  --pc-auth-hover: var(--joseon-paper-strong);
  --pc-auth-muted: var(--joseon-muted);
  --pc-auth-text: var(--joseon-ink);
}

.j-brand[aria-current] {
  color: var(--brand);
  font-weight: 700;
}

.j-brand[aria-current]::after {
  position: absolute;
  right: 7px;
  bottom: -8px;
  left: 12px;
  height: 2px;
  background: currentColor;
  content: "";
}

.j-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100dvh - 56px);
  min-height: 0;
}

.j-panel {
  position: relative;
  z-index: 20;
  min-width: 0;
  border-right: 1px solid var(--joseon-line-strong);
  background:
    linear-gradient(rgba(58, 51, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 51, 42, 0.035) 1px, transparent 1px),
    var(--joseon-paper);
  background-size: 26px 26px;
}

.j-panel-toggle {
  display: none;
}

.j-panel-body {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 27px 26px 36px;
  scrollbar-color: var(--joseon-line-strong) transparent;
}

.j-intro {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--joseon-line-strong);
}

.j-intro h1 {
  font-size: clamp(26px, 3.1vw, 34px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.j-intro > p:last-child {
  max-width: 31em;
  margin-top: 9px;
  color: var(--joseon-muted);
  font-size: 14px;
}

.j-route-form {
  padding: 17px 0 0;
}

.j-place-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 9px 8px;
  align-items: end;
}

.j-place-field {
  min-width: 0;
}

.j-place-field:first-child {
  grid-column: 1;
}

.j-place-field:nth-child(3) {
  grid-column: 1;
}

.j-place-field > label {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 5px;
}

.j-place-field b,
.j-mode-group legend {
  font-size: 12px;
  font-weight: 600;
}

.j-place-field small {
  color: var(--joseon-red);
  font-family: var(--font-mono);
  font-size: 10px;
}

.j-place-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

.j-place-field select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  appearance: none;
  padding: 8px 37px 8px 12px;
  border: 1px solid var(--joseon-line-strong);
  border-radius: 3px 0 0 3px;
  background:
    linear-gradient(45deg, transparent 50%, var(--joseon-muted) 50%) calc(100% - 17px) 18px / 5px 5px no-repeat,
    linear-gradient(135deg, var(--joseon-muted) 50%, transparent 50%) calc(100% - 12px) 18px / 5px 5px no-repeat,
    var(--joseon-surface);
  color: var(--joseon-ink);
  font-size: 14px;
  font-weight: 500;
}

.j-place-search {
  min-width: 49px;
  border: 1px solid var(--joseon-line-strong);
  border-left: 0;
  border-radius: 0 3px 3px 0;
  background: var(--joseon-paper);
  color: var(--joseon-red);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.j-place-search:hover {
  background: var(--joseon-red-soft);
}

.j-place-field select:hover {
  border-color: var(--joseon-ink);
}

.j-swap {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  width: 34px;
  height: 56px;
  margin-top: 21px;
  border: 1px solid var(--joseon-line-strong);
  border-radius: 3px;
  background: var(--joseon-surface);
  color: var(--joseon-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 16px;
}

.j-swap:hover {
  border-color: var(--joseon-ink);
  color: var(--joseon-red);
}

.j-mode-group {
  margin-top: 19px;
  border: 0;
}

.j-mode-group legend {
  margin-bottom: 7px;
}

.j-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--joseon-line-strong);
  background: var(--joseon-surface);
}

.j-mode {
  min-width: 0;
  min-height: 58px;
  padding: 8px 3px 7px;
  border: 0;
  border-left: 1px solid var(--joseon-line);
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.j-mode:first-child {
  border-left: 0;
}

.j-mode b,
.j-mode small {
  display: block;
}

.j-mode b {
  font-size: 12px;
}

.j-mode small {
  margin-top: 2px;
  color: var(--joseon-faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.j-mode:hover {
  background: var(--joseon-red-soft);
}

.j-mode[aria-pressed="true"] {
  background: var(--joseon-ink);
  color: var(--joseon-surface);
}

.j-mode[aria-pressed="true"] small {
  color: var(--joseon-paper-strong);
}

.j-mode-description {
  min-height: 18px;
  margin-top: 6px;
  color: var(--joseon-muted);
  font-size: 10.5px;
}

.j-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 13px 0 18px;
  border-bottom: 1px solid var(--joseon-line-strong);
}

.j-preset {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--joseon-line);
  border-radius: 2px;
  background: rgba(251, 250, 245, 0.65);
  color: var(--joseon-muted);
  cursor: pointer;
  font-size: 10.5px;
}

.j-preset:hover {
  border-color: var(--joseon-red);
  color: var(--joseon-red);
}

.j-result {
  padding-top: 23px;
}

.j-result-heading {
  padding-bottom: 17px;
}

.j-result-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.j-result-route {
  min-height: 17px;
  color: var(--joseon-red);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.j-result-heading h2 {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.j-share-route {
  flex: none;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--joseon-red);
  border-radius: 3px;
  background: transparent;
  color: var(--joseon-red);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.j-share-route:hover:not(:disabled),
.j-share-route:focus-visible {
  background: var(--joseon-red);
  color: var(--joseon-surface);
}

.j-share-route:disabled {
  cursor: wait;
  opacity: 0.58;
}

.j-share-status {
  margin-top: 5px;
  color: var(--joseon-muted);
  font-size: 10px;
}

.j-share-status:empty {
  display: none;
}

.j-result-heading h2 i {
  color: var(--joseon-line-strong);
  font-family: var(--font-mono);
  font-size: 14px;
  font-style: normal;
}

.j-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--joseon-line-strong);
  border-bottom: 1px solid var(--joseon-line-strong);
}

.j-metrics > div {
  min-width: 0;
  padding: 12px 10px;
  border-left: 1px solid var(--joseon-line);
}

.j-metrics > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.j-metrics dt {
  color: var(--joseon-faint);
  font-size: 10px;
}

.j-metrics dd {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.j-result-note {
  margin-top: 11px;
  color: var(--joseon-muted);
  font-size: 11.5px;
}

.j-result.is-empty .j-metrics,
.j-result.is-empty .j-route-composition,
.j-result.is-empty .j-itinerary-heading,
.j-result.is-empty .j-itinerary,
.j-result.is-empty .j-share-route,
.j-result.is-empty .j-share-status {
  display: none;
}

.j-route-composition {
  margin-top: 20px;
}

.j-subheading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.j-subheading h3 {
  font-size: 13px;
}

.j-subheading p {
  color: var(--joseon-faint);
  font-size: 10px;
  text-align: right;
}

.j-route-sections {
  margin-top: 8px;
  border-top: 1px solid var(--joseon-line-strong);
  list-style: none;
}

.j-route-section {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--joseon-line);
}

.j-route-section-color {
  width: 3px;
  height: 32px;
  border-radius: 2px;
  background: var(--road-color, var(--joseon-red));
}

.j-route-section-name b,
.j-route-section-name small {
  display: block;
}

.j-route-section-name b {
  font-size: 12px;
}

.j-route-section-name small {
  margin-top: 2px;
  color: var(--joseon-faint);
  font-size: 10px;
}

.j-route-section-distance {
  color: var(--joseon-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
}

.j-route-section-distance b,
.j-route-section-distance small {
  display: block;
}

.j-route-section-distance b {
  color: var(--joseon-ink);
  font-size: 11px;
}

.j-itinerary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
}

.j-itinerary-heading h3,
.j-sources h2 {
  font-size: 13px;
}

.j-itinerary-heading button {
  border: 0;
  background: transparent;
  color: var(--joseon-red);
  cursor: pointer;
  font-size: 11px;
}

.j-itinerary {
  margin-top: 9px;
  list-style: none;
  border-top: 1px solid var(--joseon-line-strong);
}

.j-day {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--joseon-line);
}

.j-day-no {
  color: var(--joseon-red);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}

.j-day-route {
  min-width: 0;
}

.j-day-route b {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.j-day-route small {
  display: block;
  margin-top: 2px;
  color: var(--joseon-faint);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.j-day-distance {
  color: var(--joseon-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.j-itinerary.is-all-stops .j-day {
  grid-template-columns: 38px minmax(0, 1fr);
}

.j-itinerary.is-all-stops .j-day-distance {
  display: none;
}

.j-sources {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--joseon-line-strong);
}

.j-sources > p {
  margin-top: 8px;
  color: var(--joseon-muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.j-sources details {
  margin-top: 8px;
}

.j-sources summary {
  color: var(--joseon-red);
  cursor: pointer;
  font-size: 11.5px;
}

.j-sources ul {
  margin: 8px 0 0 17px;
  color: var(--joseon-muted);
  font-size: 11px;
}

.j-sources li + li {
  margin-top: 5px;
}

.j-sources a {
  color: var(--joseon-blue);
}

.j-road-catalog {
  margin-top: 9px;
  border-top: 1px solid var(--joseon-line);
  list-style: none;
}

.j-road-catalog li {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--joseon-line);
  color: var(--joseon-muted);
  font-size: 10px;
}

.j-road-catalog b {
  color: var(--joseon-ink);
  font-size: 10.5px;
}

.j-road-catalog small {
  color: var(--joseon-faint);
  font-family: var(--font-mono);
  text-align: right;
}

.j-map-region {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #d8d5cb;
}

.j-map {
  position: absolute;
  inset: 0;
  background: var(--joseon-paper-strong);
}

.j-map-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.72) contrast(0.93);
}

.j-route-fallback {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.j-route-fallback .j-fallback-road {
  fill: none;
  stroke: rgba(126, 71, 54, 0.48);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.j-route-fallback .j-fallback-road.is-main {
  stroke: rgba(126, 71, 54, 0.68);
  stroke-width: 1.5;
}

#fallback-selected-route-shadow,
#fallback-selected-route-casing,
#fallback-selected-route,
#fallback-selected-gaps {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

#fallback-selected-route-shadow {
  stroke: rgba(36, 34, 30, 0.42);
  stroke-width: 12;
}

#fallback-selected-route-casing {
  stroke: rgba(255, 250, 236, 0.99);
  stroke-width: 8;
}

#fallback-selected-route {
  stroke: #b33b2f;
  stroke-width: 4.5;
}

#fallback-selected-gaps {
  stroke: #8a6426;
  stroke-width: 2.2;
  stroke-dasharray: 5 5;
}

.j-map.is-ready .j-map-fallback {
  display: none;
}

.j-map.is-ready .j-route-fallback .j-fallback-road {
  display: none;
}

.j-map.is-moving .j-route-fallback {
  opacity: 0;
}

.j-map-status {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 50%;
  transform: translate(-50%, 50%);
  max-width: calc(100% - 40px);
  padding: 8px 11px;
  border: 1px solid var(--joseon-line-strong);
  background: var(--joseon-surface);
  color: var(--joseon-muted);
  font-size: 11px;
  text-align: center;
}

.j-map-hover-card {
  position: absolute;
  z-index: 40;
  left: 0;
  top: 0;
  display: grid;
  width: min(260px, calc(100% - 24px));
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--joseon-line-strong);
  border-radius: 3px;
  background: rgba(251, 250, 245, 0.97);
  box-shadow: 0 8px 28px rgba(44, 37, 27, 0.22);
  pointer-events: none;
  opacity: 1;
  transition: opacity 90ms ease;
}

.j-map-hover-card[hidden] {
  display: none;
}

.j-map-hover-card small {
  color: var(--joseon-red);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.j-map-hover-card strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.j-map-hover-card span {
  color: var(--joseon-muted);
  font-size: 10px;
  line-height: 1.45;
}

.j-map-hover-card span:empty {
  display: none;
}

.j-map.is-ready .j-map-status {
  display: none;
}

.j-map-toolbar {
  position: absolute;
  z-index: 12;
  top: 14px;
  left: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 82px);
}

.j-map-modes {
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(107, 96, 78, 0.48);
  border-radius: 3px;
  background: rgba(251, 250, 245, 0.94);
  box-shadow: 0 3px 12px rgba(44, 37, 27, 0.12);
  backdrop-filter: blur(8px);
}

.j-map-modes button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-left: 1px solid var(--joseon-line);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.j-map-modes button:first-child {
  border-left: 0;
}

.j-map-modes button:hover {
  background: var(--joseon-red-soft);
}

.j-map-modes button[aria-pressed="true"] {
  background: var(--joseon-ink);
  color: var(--joseon-surface);
}

.j-fit-route {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(107, 96, 78, 0.48);
  border-radius: 3px;
  background: rgba(251, 250, 245, 0.94);
  box-shadow: 0 3px 12px rgba(44, 37, 27, 0.12);
  backdrop-filter: blur(8px);
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.j-fit-route:hover:not(:disabled) {
  border-color: var(--joseon-red);
  color: var(--joseon-red);
}

.j-fit-route:disabled {
  cursor: wait;
  opacity: 0.52;
}

.j-opacity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(107, 96, 78, 0.48);
  border-radius: 3px;
  background: rgba(251, 250, 245, 0.94);
  box-shadow: 0 3px 12px rgba(44, 37, 27, 0.12);
  backdrop-filter: blur(8px);
}

.j-opacity-control[hidden] {
  display: none;
}

.j-opacity-control span {
  color: var(--joseon-muted);
  font-size: 10px;
  white-space: nowrap;
}

.j-opacity-control input {
  width: 76px;
  accent-color: var(--joseon-red);
}

.j-map-legend {
  position: absolute;
  z-index: 12;
  right: 14px;
  bottom: 38px;
  display: flex;
  gap: 12px;
  padding: 7px 9px;
  border: 1px solid rgba(107, 96, 78, 0.42);
  border-radius: 3px;
  background: rgba(251, 250, 245, 0.92);
  color: var(--joseon-muted);
  font-size: 9.5px;
  backdrop-filter: blur(8px);
}

.j-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.j-map-legend i {
  display: inline-block;
  width: 17px;
  height: 2px;
  background: var(--joseon-line-strong);
}

.j-map-legend .is-route {
  height: 3px;
  background: var(--joseon-red);
}

.j-map-legend .is-main-road {
  background: #8e5138;
}

.j-map-legend .is-branch-road {
  height: 2px;
  background: rgba(126, 71, 54, 0.76);
}

.j-map-legend .is-stop {
  width: 7px;
  height: 7px;
  border: 1px solid var(--joseon-red);
  border-radius: 50%;
  background: var(--joseon-surface);
}

.j-map-legend .is-gap {
  height: 0;
  border-top: 1px dashed #8a6426;
  background: transparent;
}

.j-map-disclaimer {
  position: absolute;
  z-index: 12;
  left: 14px;
  bottom: 9px;
  padding: 3px 5px;
  background: rgba(251, 250, 245, 0.82);
  color: var(--joseon-muted);
  font-size: 9.5px;
}

.j-map .maplibregl-canvas {
  outline: none;
}

.j-map .maplibregl-popup {
  z-index: 30;
}

.j-map .maplibregl-ctrl-top-right {
  top: 7px;
  right: 0;
}

.j-map .maplibregl-ctrl-group {
  border: 1px solid rgba(107, 96, 78, 0.48);
  border-radius: 3px;
  box-shadow: 0 3px 12px rgba(44, 37, 27, 0.12);
}

.j-map .maplibregl-ctrl-group button {
  width: 34px;
  height: 34px;
}

.j-map .maplibregl-ctrl-attrib {
  background: rgba(251, 250, 245, 0.84);
  color: var(--joseon-muted);
  font-family: var(--font-sans);
  font-size: 9px;
}

.j-map .maplibregl-ctrl-attrib a {
  color: var(--joseon-blue);
}

.j-map-popup .maplibregl-popup-content {
  width: min(270px, calc(100vw - 32px));
  padding: 12px 13px;
  border: 1px solid var(--joseon-line-strong);
  border-radius: 3px;
  background: var(--joseon-surface);
  box-shadow: 0 6px 24px rgba(44, 37, 27, 0.18);
}

.j-map-popup .maplibregl-popup-close-button {
  width: 30px;
  height: 30px;
  color: var(--joseon-muted);
  font-size: 18px;
}

.j-map-popup .maplibregl-popup-tip {
  border-top-color: var(--joseon-surface);
}

.j-popup-kind {
  color: var(--joseon-red);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.j-popup-name {
  margin-top: 2px;
  font-size: 14px;
}

.j-popup-current {
  margin-top: 3px;
  color: var(--joseon-muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.j-popup-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.j-popup-actions button {
  flex: 1;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid var(--joseon-line);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.j-popup-actions button:hover {
  border-color: var(--joseon-red);
  color: var(--joseon-red);
}

.j-place-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--joseon-line-strong);
  border-radius: 4px;
  background: var(--joseon-paper);
  color: var(--joseon-ink);
  box-shadow: 0 20px 80px rgba(32, 27, 20, 0.28);
}

.j-place-dialog::backdrop {
  background: rgba(35, 31, 25, 0.48);
  backdrop-filter: blur(2px);
}

.j-place-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--joseon-line-strong);
}

.j-place-dialog-head h2 {
  font-size: 18px;
}

.j-place-dialog-head button {
  min-width: 44px;
  min-height: 36px;
  border: 1px solid var(--joseon-line);
  border-radius: 3px;
  background: var(--joseon-surface);
  cursor: pointer;
  font-size: 11px;
}

.j-place-query {
  display: block;
  padding: 14px 18px 8px;
}

.j-place-query span {
  display: block;
  margin-bottom: 5px;
  color: var(--joseon-muted);
  font-size: 10.5px;
}

.j-place-query input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--joseon-line-strong);
  border-radius: 3px;
  background: var(--joseon-surface);
  color: var(--joseon-ink);
  font-size: 14px;
}

.j-place-query input:focus-visible {
  outline: 2px solid var(--joseon-red);
  outline-offset: 1px;
}

.j-place-filters {
  display: flex;
  gap: 5px;
  padding: 2px 18px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.j-place-filter {
  flex: none;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--joseon-line);
  border-radius: 999px;
  background: var(--joseon-surface);
  cursor: pointer;
  font-size: 10.5px;
  white-space: nowrap;
}

.j-place-filter[aria-pressed="true"] {
  border-color: var(--joseon-ink);
  background: var(--joseon-ink);
  color: var(--joseon-surface);
}

.j-place-search-summary {
  padding: 0 18px 8px;
  color: var(--joseon-faint);
  font-size: 10px;
}

.j-place-results {
  max-height: min(430px, calc(100dvh - 260px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--joseon-line-strong);
  background: var(--joseon-surface);
}

.j-place-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  width: 100%;
  min-height: 58px;
  padding: 9px 18px;
  border: 0;
  border-bottom: 1px solid var(--joseon-line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.j-place-result:hover,
.j-place-result:focus-visible {
  background: var(--joseon-red-soft);
}

.j-place-result[aria-current="true"] {
  box-shadow: inset 3px 0 var(--joseon-red);
}

.j-place-result b {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.j-place-result > span {
  color: var(--joseon-muted);
  font-size: 10.5px;
  text-align: right;
}

.j-place-result small {
  grid-column: 1 / -1;
  color: var(--joseon-faint);
  font-size: 10px;
}

.j-place-empty {
  padding: 32px 18px;
  color: var(--joseon-muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1040px) {
  .j-workspace {
    grid-template-columns: 360px minmax(0, 1fr);
  }

  .j-panel-body {
    padding-inline: 22px;
  }

  .j-opacity-control span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

@media (max-width: 780px) {
  .j-head {
    height: 56px;
    padding-inline: 14px;
  }

  .j-head-nav {
    gap: 0;
  }

  .j-workspace {
    display: block;
    position: relative;
    height: calc(100dvh - 56px);
  }

  .j-map-region {
    position: absolute;
    top: 0;
    right: 0;
    bottom: min(50dvh, 500px);
    left: 0;
    transition: bottom 180ms ease;
  }

  .j-panel {
    position: absolute;
    z-index: 22;
    right: 0;
    bottom: 0;
    left: 0;
    height: min(50dvh, 500px);
    border-top: 1px solid var(--joseon-line-strong);
    border-right: 0;
    box-shadow: var(--joseon-shadow);
    transition: height 180ms ease;
  }

  .j-panel.is-collapsed {
    height: 49px;
  }

  .j-panel.is-collapsed + .j-map-region {
    bottom: 49px;
  }

  .j-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 49px;
    padding: 0 17px;
    border: 0;
    border-bottom: 1px solid var(--joseon-line);
    background: rgba(243, 239, 228, 0.96);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
  }

  .j-panel-toggle::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 28px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: var(--joseon-line-strong);
  }

  .j-panel-toggle-state {
    color: var(--joseon-muted);
    font-size: 10.5px;
    font-weight: 400;
  }

  .j-panel-body {
    height: calc(100% - 49px);
    padding: 15px 18px 30px;
    transition: opacity 120ms ease;
  }

  .j-result-title-row {
    align-items: center;
  }

  .j-share-route {
    min-height: 44px;
    padding-inline: 12px;
  }

  .j-panel.is-collapsed .j-panel-body {
    visibility: hidden;
    opacity: 0;
  }

  .j-intro {
    padding-bottom: 13px;
  }

  .j-intro h1 {
    font-size: 25px;
  }

  .j-intro > p:last-child {
    margin-top: 5px;
    font-size: 12px;
  }

  .j-presets {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: -18px;
    padding-inline: 18px;
    scroll-padding-inline: 18px;
    scrollbar-width: none;
  }

  .j-presets::-webkit-scrollbar {
    display: none;
  }

  .j-preset {
    flex: 0 0 auto;
    min-height: 40px;
    scroll-snap-align: start;
  }

  .j-map-toolbar {
    top: 10px;
    left: 10px;
    max-width: calc(100% - 58px);
  }

  .j-map-modes {
    overflow-x: auto;
  }

  .j-map-modes button {
    min-height: 44px;
    padding-inline: 9px;
  }

  .j-fit-route {
    min-height: 44px;
  }

  .j-opacity-control {
    display: none;
  }

  .j-map .maplibregl-ctrl-top-right {
    top: 2px;
  }

  .j-map .maplibregl-ctrl-top-right .maplibregl-ctrl-group {
    margin-right: 10px;
  }

  .j-map-legend {
    top: 62px;
    right: auto;
    bottom: auto;
    left: 10px;
  }

  .j-map-disclaimer {
    display: none;
  }

  .j-place-dialog {
    width: 100%;
    max-width: none;
    max-height: min(78dvh, 700px);
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 12px 12px 0 0;
  }

  .j-place-dialog-head {
    padding-top: 20px;
  }

  .j-place-dialog-head::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 34px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: var(--joseon-line-strong);
  }

  .j-place-results {
    max-height: calc(78dvh - 257px);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .j-place-dialog-head button,
  .j-place-filter {
    min-height: 44px;
  }

  .j-place-result {
    min-height: 62px;
    padding-inline: 18px;
  }

  .j-map-popup .maplibregl-popup-content {
    padding: 13px 14px;
  }

  .j-popup-actions button {
    min-height: 44px;
    font-size: 11px;
  }
}

@media (max-width: 430px) {
  .j-head { padding-inline: 12px; }
  .j-head .t-playcity-mark { width: 54px; }
  .j-brand { margin-left: 8px; padding-right: 4px; padding-left: 9px; }
  .j-head-nav a {
    padding-inline: 4px;
    font-size: 12px;
  }

  .j-map-modes button {
    font-size: 10.5px;
  }

  .j-map-legend {
    gap: 8px;
    font-size: 9px;
  }

  .j-map-legend span:nth-child(4),
  .j-map-legend span:nth-child(5) {
    display: none;
  }

  .j-mode {
    min-height: 52px;
  }
}

@media (max-width: 330px) {
  .j-head-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .j-panel,
  .j-panel-body,
  .j-map-region,
  .j-map-hover-card {
    transition: none;
  }
}
