:root {
  --ink: #eef1ea;
  --muted: #98a19a;
  --canvas: #0b100f;
  --panel: #141b19;
  --panel-raised: #1a2320;
  --line: rgba(237, 241, 232, 0.12);
  --accent: #d7a858;
  --accent-soft: rgba(215, 168, 88, 0.15);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #070a09;
}

body {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.map-app {
  position: relative;
  isolation: isolate;
  width: min(100%, 920px);
  height: 100vh;
  height: 100dvh;
  min-height: 520px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--canvas);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.55);
}

.app-header {
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: calc(74px + env(safe-area-inset-top));
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(180deg, rgba(7, 10, 9, 0.92), rgba(7, 10, 9, 0.56) 72%, transparent);
  pointer-events: none;
}

.brand-block,
.language-chip {
  pointer-events: auto;
}

.brand-block h1 {
  margin: 2px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 4.7vw, 25px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.eyebrow {
  color: var(--accent);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.2em;
}

.language-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 27, 25, 0.88);
  color: #e8ece6;
  font-size: 12px;
  font-weight: 650;
  backdrop-filter: blur(16px);
  cursor: pointer;
}

.language-code {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.chip-arrow {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transform: rotate(90deg);
}

.map-viewport {
  position: absolute;
  inset: 0 0 calc(70px + env(safe-area-inset-bottom));
  overflow: hidden;
  outline: none;
  background: #101615;
  touch-action: none;
  cursor: grab;
}

.map-viewport:active {
  cursor: grabbing;
}

.map-viewport:focus-visible::after {
  position: absolute;
  z-index: 50;
  inset: 4px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  content: "";
  pointer-events: none;
}

.map-atmosphere {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(79, 91, 73, 0.22), transparent 55%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
  pointer-events: none;
}

.map-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.map-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center;
  will-change: transform;
}

.map-image {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 245, 215, 0.35);
  background: #c8b78f;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.65), 0 0 0 10px rgba(8, 11, 10, 0.28);
  opacity: 0;
  transition: opacity 260ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.map-image.is-ready {
  opacity: 1;
}

.map-loader {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(13, 18, 17, 0.82);
  color: var(--muted);
  font-size: 12px;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(14px);
}

.loader-mark {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(215, 168, 88, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.map-status {
  position: absolute;
  z-index: 12;
  top: calc(82px + env(safe-area-inset-top));
  left: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(14, 19, 18, 0.72);
  color: #bec6be;
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.status-separator {
  width: 1px;
  height: 10px;
  background: var(--line);
}

.compass {
  position: absolute;
  z-index: 12;
  top: calc(82px + env(safe-area-inset-top));
  right: 16px;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(14, 19, 18, 0.76);
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.compass span {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  transition: transform 120ms ease-out;
}

.compass span::before {
  position: absolute;
  top: 4px;
  width: 0;
  height: 0;
  border-right: 3px solid transparent;
  border-bottom: 5px solid var(--accent);
  border-left: 3px solid transparent;
  content: "";
}

.zoom-controls {
  position: absolute;
  z-index: 12;
  right: 14px;
  bottom: 22px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 23, 21, 0.88);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.zoom-controls button {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #e4e9e1;
  font-size: 22px;
  cursor: pointer;
}

.zoom-controls button:last-child {
  border-bottom: 0;
}

.zoom-controls button:active {
  background: var(--accent-soft);
  color: var(--accent);
}

.fit-icon,
.fullscreen-icon {
  position: relative;
  width: 17px;
  height: 17px;
}

.fit-icon {
  border: 1.5px solid currentColor;
  box-shadow: inset 0 0 0 4px rgba(17, 23, 21, 1);
}

.fit-icon::after {
  position: absolute;
  inset: 5px;
  border: 1px solid currentColor;
  content: "";
}

.fullscreen-icon {
  border: 1.5px solid transparent;
  background:
    linear-gradient(currentColor, currentColor) left top / 7px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) left top / 1.5px 7px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 7px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 1.5px 7px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 7px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 1.5px 7px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 7px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 1.5px 7px no-repeat;
}

.fullscreen-icon.is-active {
  transform: scale(0.78);
}

.gesture-hint {
  position: absolute;
  z-index: 8;
  bottom: 16px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(10, 14, 13, 0.62);
  color: rgba(229, 234, 226, 0.72);
  font-size: 10px;
  transform: translateX(-50%);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  animation: hint-away 700ms ease 4.8s forwards;
  pointer-events: none;
}

.gesture-fingers {
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 2px;
}

@keyframes hint-away {
  to { opacity: 0; transform: translate(-50%, 8px); }
}

.bottom-nav {
  position: absolute;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: calc(70px + env(safe-area-inset-bottom));
  padding: 5px 8px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(12, 17, 16, 0.96);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(22px);
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: #879089;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.nav-item::before {
  position: absolute;
  top: -6px;
  width: 24px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: transparent;
  content: "";
}

.nav-item.is-active,
.nav-item:active {
  color: var(--accent);
}

.nav-item.is-active::before {
  background: var(--accent);
}

.nav-symbol {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: currentColor;
}

.overview-symbol {
  border: 1.5px solid currentColor;
  transform: perspective(18px) rotateX(12deg) rotateZ(-4deg);
}

.overview-symbol::before,
.overview-symbol::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: currentColor;
  content: "";
  transform: rotate(10deg);
}

.overview-symbol::before { left: 7px; }
.overview-symbol::after { right: 7px; }

.navigate-symbol {
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.navigate-symbol::before {
  position: absolute;
  width: 6px;
  height: 9px;
  border-top: 9px solid currentColor;
  border-right: 3px solid transparent;
  border-left: 3px solid transparent;
  content: "";
  transform: translateY(-3px);
}

.language-symbol,
.info-symbol {
  font-family: Georgia, serif;
  font-size: 18px;
}

.language-symbol::after {
  position: absolute;
  right: 0;
  bottom: 1px;
  color: currentColor;
  content: "文";
  font-family: sans-serif;
  font-size: 8px;
}

.info-symbol {
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 14px;
  font-style: italic;
}

.sheet-layer {
  position: absolute;
  z-index: 35;
  inset: 0 0 calc(70px + env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  background: rgba(2, 4, 3, 0.5);
  animation: fade-in 160ms ease-out;
}

.bottom-sheet {
  width: 100%;
  max-height: min(72vh, 620px);
  padding: 8px 18px 22px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, #19211f, #111714);
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.45);
  animation: sheet-up 220ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }

.sheet-handle {
  display: block;
  width: 42px;
  height: 18px;
  margin: 0 auto 4px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.sheet-handle::after {
  display: block;
  width: 34px;
  height: 4px;
  margin: auto;
  border-radius: 99px;
  background: #3d4743;
  content: "";
}

.sheet-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 16px;
}

.sheet-heading h2 {
  margin: 3px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.sheet-count {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.language-list {
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.language-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.language-row.is-selected {
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
}

.language-row.is-disabled {
  cursor: default;
  opacity: 0.48;
}

.row-code {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.row-copy {
  display: grid;
  gap: 3px;
}

.row-copy strong {
  font-size: 14px;
  font-weight: 650;
}

.row-copy small,
.zoom-slider small,
.guide-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 450;
  line-height: 1.35;
}

.row-state {
  color: var(--accent);
  font-size: 18px;
}

.language-row.is-disabled .row-state {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.file-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.file-note code {
  color: #c8cec8;
  word-break: break-all;
}

.direction-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.direction-pad button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 82px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-raised);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.direction-pad button span {
  color: var(--ink);
  font-size: 23px;
}

.direction-pad .north-button {
  border-color: rgba(215, 168, 88, 0.36);
  background: var(--accent-soft);
  color: var(--accent);
}

.direction-pad .north-button span {
  color: var(--accent);
  font-family: Georgia, serif;
}

.zoom-slider {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.zoom-slider > span {
  display: grid;
  gap: 2px;
}

.zoom-slider strong {
  font-size: 12px;
}

.zoom-slider input {
  width: 100%;
  accent-color: var(--accent);
}

.primary-action {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #17130c;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.guide-grid article {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.guide-grid article > span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(215, 168, 88, 0.3);
  border-radius: 50%;
  color: var(--accent);
  font-size: 15px;
}

.guide-grid article div {
  display: grid;
  gap: 3px;
}

.guide-grid strong {
  font-size: 12px;
}

.about-copy {
  margin: 14px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.55;
}

@media (min-width: 700px) {
  .app-header { padding-right: 26px; padding-left: 26px; }
  .map-status { left: 24px; }
  .compass { right: 24px; }
  .zoom-controls { right: 24px; }
  .bottom-sheet { padding-right: 28px; padding-left: 28px; }
}

@media (max-height: 620px) {
  .gesture-hint { display: none; }
  .app-header { min-height: calc(62px + env(safe-area-inset-top)); }
  .map-status,
  .compass { top: calc(66px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
