:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #aeb8c5;
  --paper: rgba(250, 252, 255, 0.96);
  --paper-ink: #16202a;
  --paper-muted: #5f6f7b;
  --line: rgba(255, 255, 255, 0.18);
  --charcoal: #101318;
  --charcoal-2: #1f252b;
  --grass: #2e8a57;
  --cyan: #39c6e6;
  --amber: #f7bd38;
  --coral: #ff6f61;
  --violet: #8f7df2;
  --leaf: #7ac943;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: var(--charcoal);
  color: var(--ink);
}

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

a {
  color: inherit;
}

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #11171a;
}

.scene-shade {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10, 13, 16, 0.46), transparent 38%, rgba(10, 13, 16, 0.18)),
    radial-gradient(circle at 50% 22%, transparent 0 48%, rgba(0, 0, 0, 0.28) 100%);
}

.topbar,
.content-panel,
.mini-map,
.touch-controls {
  position: fixed;
  z-index: 5;
}

.topbar {
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.brand,
.station-nav,
.content-panel,
.mini-map,
.touch-controls {
  border: 1px solid var(--line);
  background: rgba(13, 17, 21, 0.66);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  pointer-events: auto;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #d7e3e7;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 0.98rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.76rem;
}

.station-nav {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 8px;
  pointer-events: auto;
}

.station-nav a {
  min-width: 84px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease;
}

.station-nav a:hover,
.station-nav a.is-active,
.station-nav a:focus-visible {
  color: #121212;
  background: var(--amber);
  outline: none;
}

.content-panel {
  left: 20px;
  bottom: 20px;
  width: min(500px, calc(100vw - 40px));
  max-height: min(74vh, 760px);
  overflow: auto;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 250, 0.94)),
    var(--paper);
  color: var(--paper-ink);
  pointer-events: auto;
  scrollbar-color: rgba(22, 32, 42, 0.4) transparent;
  backdrop-filter: blur(22px) saturate(150%);
}

.panel-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(23, 36, 48, 0.1);
  background:
    linear-gradient(90deg, rgba(247, 189, 56, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.88);
}

.panel-heading p {
  margin: 0 0 8px;
  color: var(--paper-muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-heading h1 {
  margin: 0;
  color: #101820;
  font-size: clamp(1.62rem, 2vw, 2.2rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.panel-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 8px;
  background: rgba(16, 24, 32, 0.08);
  color: #101820;
  cursor: pointer;
}

.panel-toggle::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.content-panel.is-collapsed .panel-toggle::before {
  transform: translateY(2px) rotate(-135deg);
}

.content-panel.is-collapsed {
  width: min(320px, calc(100vw - 40px));
  max-height: 112px;
  overflow: hidden;
}

.content-panel.is-collapsed .panel-heading {
  align-items: center;
  padding: 14px;
  border-bottom: 0;
}

.content-panel.is-collapsed .panel-heading p {
  margin-bottom: 4px;
  font-size: 0.64rem;
}

.content-panel.is-collapsed .panel-heading h1 {
  display: -webkit-box;
  overflow: hidden;
  font-size: 1.05rem;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.content-panel.is-collapsed .panel-body,
.content-panel.is-collapsed .panel-actions {
  display: none;
}

.panel-body {
  margin-top: 0;
  padding: 18px 20px 0;
  color: #32404d;
  line-height: 1.62;
}

.panel-body p {
  margin: 0 0 12px;
}

.stat-strip,
.project-grid,
.timeline,
.service-grid,
.link-row {
  display: grid;
  gap: 10px;
}

.stat-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
}

.stat {
  min-height: 76px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(21, 34, 45, 0.08);
  background: #f0f5f4;
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  color: #0d161d;
  font-size: 1.1rem;
}

.stat span {
  margin-top: 4px;
  color: #63707a;
  font-size: 0.72rem;
  font-weight: 800;
}

.skill-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-list li {
  display: grid;
  gap: 6px;
}

.skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #17232d;
  font-weight: 800;
}

.skill-row span:last-child {
  color: #63707a;
  font-size: 0.76rem;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe5e8;
}

.meter span {
  display: block;
  height: 100%;
  width: var(--level);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--grass), var(--cyan), var(--amber));
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag-cloud span {
  padding: 7px 9px;
  border-radius: 8px;
  background: #e8eef4;
  color: #263541;
  font-size: 0.78rem;
  font-weight: 800;
}

.timeline {
  position: relative;
}

.timeline-item {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(21, 34, 45, 0.08);
  background: #f0f5f4;
}

.timeline-item time {
  color: #596874;
  font-size: 0.76rem;
  font-weight: 900;
}

.timeline-item strong {
  display: block;
  color: #101820;
}

.timeline-item span {
  color: #465866;
  font-size: 0.9rem;
}

.project-grid,
.service-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-card,
.service-card {
  min-height: 146px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(21, 34, 45, 0.08);
  background: #f4f7f9;
}

.project-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-card img {
  width: 100%;
  height: 88px;
  display: block;
  object-fit: cover;
  background: #d3dde4;
}

.project-card div,
.service-card {
  padding: 12px;
}

.project-card strong,
.service-card strong {
  display: block;
  color: #101820;
  line-height: 1.25;
}

.project-card p,
.service-card p {
  margin: 7px 0 0;
  color: #556470;
  font-size: 0.82rem;
  line-height: 1.45;
}

.link-row {
  margin-top: 18px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  padding: 18px 20px 20px;
}

.panel-actions a,
.panel-actions button,
.link-row a,
.contact-form button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #101820, #243340);
  color: #f7fbff;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.panel-actions a:hover,
.panel-actions a:focus-visible,
.panel-actions button:hover,
.panel-actions button:focus-visible,
.link-row a:hover,
.link-row a:focus-visible,
.contact-form button:hover,
.contact-form button:focus-visible {
  box-shadow: 0 10px 24px rgba(16, 24, 32, 0.18);
  outline: none;
  transform: translateY(-1px);
}

.panel-actions a.secondary,
.link-row a.secondary {
  background: #e2e9ee;
  color: #14202a;
}

.contact-form {
  display: grid;
  gap: 10px;
}

.contact-form label {
  display: grid;
  gap: 6px;
  color: #243340;
  font-size: 0.82rem;
  font-weight: 900;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid #cad7df;
  border-radius: 6px;
  background: #ffffff;
  color: #16202a;
  padding: 11px 12px;
  outline: none;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(57, 198, 230, 0.2);
}

.mini-map {
  right: 20px;
  bottom: 20px;
  width: 168px;
  height: 168px;
  border-radius: 8px;
  pointer-events: auto;
}

.mini-map::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.mini-map button {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
}

.mini-map button.is-active {
  background: var(--amber);
  box-shadow: 0 0 0 8px rgba(247, 189, 56, 0.22);
}

.mini-map button:nth-child(1) {
  left: 73px;
  top: 73px;
}

.mini-map button:nth-child(2) {
  left: 29px;
  top: 40px;
}

.mini-map button:nth-child(3) {
  right: 30px;
  top: 38px;
}

.mini-map button:nth-child(4) {
  left: 34px;
  bottom: 30px;
}

.mini-map button:nth-child(5) {
  right: 33px;
  bottom: 32px;
}

.touch-controls {
  left: 50%;
  bottom: 20px;
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  transform: translateX(-50%);
  pointer-events: auto;
}

.touch-controls button {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.touch-controls button:active,
.touch-controls button.is-pressed {
  background: var(--amber);
  color: #111111;
}

.touch-controls [data-control="forward"] {
  grid-column: 2;
  grid-row: 1;
}

.touch-controls [data-control="left"] {
  grid-column: 1;
  grid-row: 2;
}

.touch-controls [data-control="right"] {
  grid-column: 3;
  grid-row: 2;
}

.touch-controls [data-control="backward"] {
  grid-column: 2;
  grid-row: 3;
}

.noscript {
  position: relative;
  z-index: 10;
  max-width: 700px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 24px;
  background: #ffffff;
  color: #17202a;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .station-nav {
    width: min(100%, 540px);
    overflow-x: auto;
  }

  .station-nav a {
    min-width: 92px;
  }

  .content-panel {
    left: 12px;
    right: 12px;
    bottom: 184px;
    width: auto;
    max-height: min(38vh, 360px);
  }

  .content-panel.is-collapsed {
    left: 12px;
    right: auto;
    bottom: 12px;
    width: min(320px, calc(100vw - 196px));
    max-height: 128px;
  }

  .mini-map {
    right: 12px;
    top: 128px;
    bottom: auto;
    width: 128px;
    height: 128px;
  }

  .mini-map::before {
    inset: 18px;
  }

  .mini-map button:nth-child(1) {
    left: 53px;
    top: 53px;
  }

  .mini-map button:nth-child(2) {
    left: 22px;
    top: 29px;
  }

  .mini-map button:nth-child(3) {
    right: 22px;
    top: 28px;
  }

  .mini-map button:nth-child(4) {
    left: 25px;
    bottom: 22px;
  }

  .mini-map button:nth-child(5) {
    right: 24px;
    bottom: 23px;
  }

  .touch-controls {
    left: auto;
    right: 12px;
    bottom: 12px;
    transform: none;
  }
}

@media (max-width: 680px) {
  .brand {
    max-width: calc(100vw - 40px);
  }

  .station-nav {
    width: calc(100vw - 40px);
  }

  .station-nav a {
    flex: 1 1 0;
    min-width: 0;
    padding-right: 5px;
    padding-left: 5px;
    font-size: 0.68rem;
  }

  .panel-heading h1 {
    font-size: 1.54rem;
  }

  .content-panel {
    left: 12px;
    right: 12px;
    bottom: 154px;
    width: auto;
    max-height: min(48vh, 360px);
  }

  .content-panel.is-collapsed {
    right: auto;
    bottom: 12px;
    width: calc(100vw - 190px);
    max-height: 128px;
    overflow: hidden;
  }

  .content-panel.is-collapsed .panel-heading {
    align-items: center;
    padding: 12px;
    border-bottom: 0;
  }

  .content-panel.is-collapsed .panel-heading p {
    margin-bottom: 4px;
    font-size: 0.62rem;
  }

  .content-panel.is-collapsed .panel-heading h1 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.98rem;
    line-height: 1.18;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .stat-strip,
  .project-grid,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .mini-map {
    display: none;
  }

  .touch-controls {
    grid-template-columns: repeat(3, 42px);
    grid-template-rows: repeat(3, 42px);
  }

  .touch-controls button {
    width: 42px;
    height: 42px;
  }
}

@media (pointer: fine) and (min-width: 981px) {
  .touch-controls {
    opacity: 0.72;
  }

  .touch-controls:hover {
    opacity: 1;
  }
}

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