*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

body {
  display: flex;
  flex-direction: column;
}

.top {
  padding: 0.65rem 1rem 0.45rem;
  flex-shrink: 0;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.top-row .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
}

.top-row h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  min-width: 0;
}

.top-row .file-btn {
  flex-shrink: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.75rem;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.file-btn,
#fontDownBtn,
#fontUpBtn,
#gpsBtn,
#followBtn,
#basemapBtn,
#fullscreenBtn {
  border: 1px solid #475569;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 0.375rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.file-btn:hover,
#fontDownBtn:not(:disabled):hover,
#fontUpBtn:not(:disabled):hover,
#gpsBtn:not(:disabled):hover,
#followBtn:not(:disabled):hover,
#basemapBtn:not(:disabled):hover,
#fullscreenBtn:not(:disabled):hover {
  background: #334155;
}

#fontDownBtn:disabled,
#fontUpBtn:disabled,
#gpsBtn:disabled,
#followBtn:disabled,
#basemapBtn:disabled,
#fullscreenBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#gpsBtn.is-active,
#followBtn.is-active,
#basemapBtn.is-active,
.map-float-bar button.is-active {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: #ffffff;
}

.vector-only {
  min-width: 2.5rem;
  font-weight: 700;
}

.viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  background: #020617;
  outline: none;
}

.map-host {
  position: absolute;
  inset: 0;
}

.map-host .ch2-map-root {
  position: absolute;
  inset: 0;
}

.map-host .ch2-vw-copy {
  position: absolute;
  left: 4px;
  bottom: 2px;
  font: 11px "Malgun Gothic", sans-serif;
  color: #333;
  background: rgba(255, 255, 255, 0.72);
  padding: 2px 6px;
  pointer-events: none;
  z-index: 9;
}

.map-host .ol-zoom {
  display: none !important;
}

.map-float-bar {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 30;
  display: flex;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid #475569;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.map-float-bar button {
  border: 1px solid #64748b;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 0.35rem;
  min-width: 2.4rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

body.map-fullscreen .top,
body.map-fullscreen .toolbar {
  display: none !important;
}

body.map-fullscreen #viewport,
#viewport:fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh !important;
  z-index: 200;
}

body.map-fullscreen .map-float-bar,
#viewport:fullscreen .map-float-bar {
  display: flex !important;
}

body.map-fullscreen .info-panel {
  z-index: 220;
}

.map-host.hidden,
.stage.hidden {
  display: none !important;
}

.hidden {
  display: none !important;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9375rem;
}

.stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.stage img {
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.info-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.96);
  border-top: 3px solid #475569;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.info-head strong {
  font-size: 0.875rem;
  color: #f8fafc;
}

#infoClose {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
}

.info-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: #e2e8f0;
  max-height: 40vh;
  overflow: auto;
}
