:root {
  color-scheme: dark;
  --bg: #050609;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f4f5f7;
  --muted: rgba(244, 245, 247, 0.62);
  --accent: #f7f7f7;
  --accent-dark: #101114;
  --danger: #ff6573;
  --ok: #67e28d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.18), transparent 28rem),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 12rem 12rem, 12rem 12rem, auto;
  color: var(--text);
  overflow-x: hidden;
}

button,
a {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 920px);
  max-width: 100%;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.hero {
  position: relative;
  min-height: 320px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #090a0d;
}

.hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.58;
  filter: saturate(0.2) contrast(1.1);
}

.hero__glow {
  position: absolute;
  inset: auto 8% -22% 8%;
  height: 55%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.32), transparent 68%);
  filter: blur(26px);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  min-height: 320px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.72));
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

h1 {
  font-size: clamp(40px, 8vw, 76px);
  line-height: 0.92;
}

h2 {
  font-size: 24px;
}

.hero p:last-child,
.muted,
small {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.card,
.glass-card,
.tabs {
  max-width: 100%;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.state-card {
  margin-top: 18px;
  padding: 24px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.loader {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 6px;
  margin: 18px 0;
  border-radius: 24px;
  min-width: 0;
  overflow: hidden;
}

.tab {
  min-height: 42px;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab.is-active {
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-weight: 750;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: grid;
  gap: 16px;
}

.glass-card {
  border-radius: 28px;
  padding: 22px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.status-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 24px currentColor;
  color: var(--danger);
  flex: 0 0 auto;
}

.status-dot.ok {
  background: var(--ok);
  color: var(--ok);
}

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

.grid strong {
  display: block;
  font-size: 26px;
  margin-bottom: 8px;
}

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

.primary-btn,
.ghost-btn,
.icon-btn {
  min-height: 50px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  touch-action: manipulation;
}

.primary-btn {
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-dark);
  font-weight: 800;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.compact {
  min-height: 42px;
  padding: 0 16px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  min-height: 46px;
  background: rgba(255, 255, 255, 0.11);
  color: var(--text);
  font-size: 28px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.links-list,
.devices-list,
.web-link-box {
  display: grid;
  gap: 12px;
}

.link-row,
.device-row,
.copy-row {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.copy-value {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #d9e7ff;
}

.copy-btn {
  min-width: 86px;
  min-height: 42px;
  border-radius: 14px;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  font-weight: 800;
}

.ref-code {
  margin: 18px 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.11);
  font: 700 28px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.stats-row div {
  display: grid;
  gap: 4px;
  text-align: center;
}

.stats-row strong {
  font-size: 26px;
}

.stats-row span {
  color: var(--muted);
  font-size: 13px;
}

.warning {
  color: #ffd28a;
}

.faq details {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  padding: 16px;
  margin-top: 10px;
}

.faq summary {
  cursor: pointer;
  font-weight: 750;
}

.link-btn {
  display: grid;
  place-items: center;
  text-decoration: none;
  margin-top: 16px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
  overflow-y: auto;
}

.modal__panel {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: rgba(25, 25, 30, 0.94);
  box-shadow: var(--shadow);
}

.modal__panel .icon-btn {
  position: absolute;
  top: 14px;
  right: 14px;
}

.modal__panel h2 {
  padding-right: 52px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-weight: 750;
  box-shadow: var(--shadow);
}

@media (max-width: 680px) {
  .app-shell {
    padding: 8px 8px 30px;
  }

  .hero,
  .hero__content {
    min-height: 204px;
  }

  .hero {
    border-radius: 22px;
  }

  .hero__content {
    padding: 16px;
  }

  .hero__image {
    opacity: 0.48;
  }

  h1 {
    font-size: clamp(36px, 11vw, 52px);
  }

  h2 {
    font-size: 24px;
    line-height: 1.1;
  }

  .hero p:last-child {
    font-size: 18px;
    line-height: 1.2;
  }

  .eyebrow,
  .label {
    font-size: 11px;
    letter-spacing: 0.07em;
  }

  .icon-btn {
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 16px;
    font-size: 24px;
  }

  .tabs {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    padding: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 14px 0;
    border-radius: 24px;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 7px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 15px;
    overflow: visible;
    text-overflow: clip;
    scroll-margin-inline: 7px;
    scroll-snap-align: start;
  }

  .glass-card,
  .state-card {
    border-radius: 22px;
    padding: 18px;
  }

  .section-title {
    flex-direction: column;
  }

  .compact {
    width: 100%;
  }

  .grid.two,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .link-row,
  .device-row,
  .copy-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .copy-value {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    font-size: 15px;
    max-height: 5.4em;
    overflow: auto;
  }

  .copy-btn {
    width: 100%;
    min-height: 46px;
  }

  .ref-code {
    padding: 16px 10px;
    font-size: 28px;
    overflow-wrap: anywhere;
  }

  .stats-row {
    gap: 6px;
  }

  .stats-row strong {
    font-size: 24px;
  }

  .stats-row span {
    font-size: 12px;
  }

  .modal {
    align-items: center;
    justify-items: center;
    padding: 16px 12px;
  }

  .modal__panel {
    width: 100%;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 32px);
    max-height: calc(100svh - 32px);
    padding: 20px;
    border-radius: 24px;
  }

  .modal__panel h2 {
    font-size: 26px;
    line-height: 1.08;
  }

  .modal__panel p {
    font-size: 16px;
    line-height: 1.45;
  }

  .modal__panel .primary-btn {
    min-height: 46px;
    padding: 0 18px;
  }
}

@media (max-width: 380px) {
  .hero,
  .hero__content {
    min-height: 188px;
  }

  h1 {
    font-size: 38px;
  }

  .tab {
    padding: 0 12px;
    font-size: 15px;
  }

  .glass-card,
  .state-card {
    padding: 16px;
  }
}
