:root {
  color-scheme: dark;
  --bg: #06120f;
  --bg-deep: #020806;
  --ink: #effff9;
  --muted: rgba(239, 255, 249, .68);
  --faint: rgba(239, 255, 249, .42);
  --line: rgba(199, 255, 235, .14);
  --line-strong: rgba(199, 255, 235, .24);
  --surface: rgba(12, 31, 26, .72);
  --surface-strong: rgba(17, 45, 37, .84);
  --surface-soft: rgba(255, 255, 255, .055);
  --mint: #a9ffe9;
  --mint-strong: #20b98e;
  --mint-ink: #03251d;
  --amber: #ffd28b;
  --danger: #ffb3a6;
  --white: #ffffff;
  --shadow: 0 28px 80px rgba(0, 0, 0, .36);
  --dock-h: 74px;
  --radius: 26px;
  --radius-sm: 18px;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% -4%, rgba(169, 255, 233, .18), transparent 34%),
    radial-gradient(circle at 110% 20%, rgba(32, 185, 142, .18), transparent 32%),
    linear-gradient(150deg, #06120f 0%, #071b16 48%, #020806 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(#000, rgba(0, 0, 0, .72) 58%, transparent);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.gate img {
  width: 118px;
  height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 28px 54px rgba(0, 0, 0, .38));
  animation: gatePulse 2.8s ease-in-out infinite;
}

.app {
  position: relative;
  z-index: 1;
  width: min(100%, 540px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(var(--dock-h) + 22px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 2px 14px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 14px 32px rgba(0, 0, 0, .34));
}

.brand b {
  display: block;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;
}

.brand span {
  display: block;
  margin-top: 5px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1;
}

.profile-chip {
  min-width: 0;
  max-width: 48%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255,255,255,.055);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  overflow: hidden;
}

.profile-chip .dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--mint-strong);
  box-shadow: 0 0 18px rgba(32, 185, 142, .82);
}

.profile-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen {
  display: grid;
  gap: 14px;
  animation: screenIn .28s ease both;
}

.hero-card,
.panel,
.service-card,
.list-item,
.location-card,
.detail-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.025)),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), var(--shadow);
  backdrop-filter: blur(22px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border-radius: 34px;
  padding: 24px;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    radial-gradient(circle at 76% 18%, rgba(169,255,233,.24), transparent 30%),
    linear-gradient(135deg, rgba(169,255,233,.15), transparent 36%, rgba(255,255,255,.04));
  mask-image: linear-gradient(#000, transparent 84%);
}

.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 212px;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 18px;
  align-items: center;
}

.status-copy {
  min-width: 0;
}

.status-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 780;
  line-height: 1;
}

.status-kicker .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 20px currentColor;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 280px;
  font-size: 36px;
  line-height: .96;
  font-weight: 880;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h2 {
  font-size: 24px;
  line-height: 1.04;
  font-weight: 840;
}

h3 {
  font-size: 17px;
  line-height: 1.15;
  font-weight: 800;
}

p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.48;
}

.status-text {
  margin-top: 13px;
  max-width: 290px;
}

.status-ring {
  --progress: 0;
  position: relative;
  width: 126px;
  height: 126px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(var(--mint-strong) calc(var(--progress) * 1%), rgba(255,255,255,.09) 0),
    radial-gradient(circle, rgba(255,255,255,.10), rgba(255,255,255,.025));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 22px 60px rgba(0,0,0,.34);
}

.status-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(5, 19, 15, .92), rgba(3, 10, 8, .95));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}

.status-ring strong,
.status-ring span {
  position: relative;
  z-index: 1;
}

.status-ring strong {
  font-size: 32px;
  line-height: 1;
}

.status-ring span {
  margin-top: 5px;
  color: var(--faint);
  font-size: 11px;
}

.ring-inner {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
}

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

.actions .btn {
  flex: 1 1 148px;
}

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255,255,255,.09);
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:active {
  transform: scale(.97);
}

.btn.primary {
  background: var(--mint-strong);
  color: #fff;
  box-shadow: 0 18px 42px rgba(32,185,142,.20), inset 0 -1px 0 rgba(0,0,0,.12);
}

.btn.ghost {
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.055);
  color: var(--muted);
}

.btn:disabled {
  cursor: wait;
  opacity: .58;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid rgba(255,255,255,.085);
  border-radius: 22px;
  padding: 16px;
  background: rgba(255,255,255,.052);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.055);
}

.metric .m-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric svg,
.service-icon {
  width: 25px;
  height: 25px;
  color: var(--mint);
}

.metric strong {
  display: block;
  margin-top: 14px;
  font-size: 24px;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 6px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.25;
}

.panel {
  border-radius: var(--radius);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head > div {
  min-width: 0;
}

.panel-head p {
  margin-top: 7px;
}

.list {
  display: grid;
  gap: 9px;
}

.list-item,
.location-card,
.service-card {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 21px;
  padding: 14px;
  color: inherit;
  text-align: left;
  text-decoration: none;
}

button.list-item,
button.location-card,
button.service-card {
  cursor: pointer;
}

.list-item .main,
.location-card .main,
.service-card .main {
  min-width: 0;
  flex: 1;
}

.list-item b,
.location-card b,
.service-card b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-card b {
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.list-item span,
.location-card span,
.service-card span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-card span {
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.list-item .tail,
.location-card .tail {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

.icon-box,
.country-box {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(169,255,233,.14);
  border-radius: 16px;
  background: rgba(169,255,233,.075);
  color: var(--mint);
}

.country-box {
  font-size: 13px;
  font-weight: 860;
}

.location-card.is-ready {
  border-color: rgba(32,185,142,.38);
  background:
    linear-gradient(180deg, rgba(32,185,142,.18), rgba(255,255,255,.035)),
    var(--surface);
}

.location-card.is-working .country-box {
  animation: softSpin 2.2s linear infinite;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 7px 9px;
  background: rgba(255,255,255,.08);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 780;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.ready {
  background: rgba(32,185,142,.14);
  color: var(--mint);
}

.status-pill.wait {
  background: rgba(255,210,139,.12);
  color: var(--amber);
}

.status-pill.off {
  color: var(--faint);
}

.detail-card {
  border-radius: 30px;
  padding: 20px;
}

.detail-card .backline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.text-block {
  display: grid;
  gap: 11px;
}

.text-block p {
  font-size: 14.5px;
}

.message-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bubble {
  max-width: 92%;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255,255,255,.055);
}

.bubble.outgoing {
  justify-self: end;
  border-color: rgba(32,185,142,.20);
  background: rgba(32,185,142,.12);
}

.bubble b {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--faint);
}

.bubble p {
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  width: min(calc(100vw - 24px), 514px);
  height: var(--dock-h);
  display: grid;
  grid-template-columns: 1fr 62px;
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.dock-pill,
.dock-orb {
  pointer-events: auto;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.95);
  color: #223630;
  box-shadow: 0 18px 60px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.96);
  backdrop-filter: blur(22px);
}

.dock-pill {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-radius: 999px;
  padding: 7px;
}

.dock-sel {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: calc(7px + var(--dock-index, 0) * ((100% - 14px) / 3));
  width: calc((100% - 14px) / 3);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(32,185,142,.16), rgba(32,185,142,.08));
  box-shadow: inset 0 0 0 1px rgba(32,185,142,.20);
  transition: left .42s cubic-bezier(.2, .9, .18, 1);
}

.dock button {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #2f403b;
  cursor: pointer;
}

.dock button svg {
  width: 21px;
  height: 21px;
}

.dock button span {
  font-size: 10px;
  line-height: 1;
  font-weight: 820;
}

.dock button.active {
  color: #0c9b76;
}

.dock-orb {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.dock-orb img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(0,0,0,.46);
  backdrop-filter: blur(12px);
}

.modal-panel {
  width: min(100%, 520px);
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(15,37,31,.98), rgba(5,16,13,.98));
  box-shadow: var(--shadow);
  animation: modalIn .24s ease both;
}

.qr-box {
  display: grid;
  place-items: center;
  margin: 16px 0 14px;
  border-radius: 22px;
  padding: 14px;
  background: #fff;
}

.qr-box img {
  width: min(100%, 320px);
  height: auto;
  display: block;
  border-radius: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + 28px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: min(420px, calc(100vw - 28px));
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 12px 15px;
  background: rgba(2, 8, 6, .88);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  font-size: 13px;
  line-height: 1.25;
  animation: toastIn .24s ease both;
}

.empty {
  border: 1px dashed rgba(255,255,255,.13);
  border-radius: 20px;
  padding: 16px;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.4;
}

.mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255,255,255,.055);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.code {
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

@keyframes gatePulse {
  0%, 100% { transform: translateY(0) scale(1); opacity: .88; }
  50% { transform: translateY(-3px) scale(1.025); opacity: 1; }
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 430px) {
  .app {
    padding-right: 10px;
    padding-left: 10px;
  }

  .hero-card {
    padding: 20px;
    border-radius: 30px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  h1 {
    font-size: 32px;
  }

  .status-ring {
    width: 112px;
    height: 112px;
    justify-self: start;
  }

  .actions .btn {
    flex-basis: 100%;
  }

  .grid {
    gap: 10px;
  }

  .metric,
  .panel {
    padding: 14px;
  }
}

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