:root {
  color-scheme: dark;
  --bg: #07100f;
  --panel: rgba(9, 25, 21, 0.92);
  --panel-strong: rgba(13, 34, 28, 0.96);
  --line: rgba(132, 247, 168, 0.28);
  --line-strong: rgba(132, 247, 168, 0.58);
  --text: #f0f7f3;
  --muted: #9aaca5;
  --green: #84f7a8;
  --shadow: 0 10px 38px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  font-family: "Microsoft YaHei UI", "PingFang SC", Arial, sans-serif;
  color: var(--text);
}

button {
  font: inherit;
}

.dashboard-stage,
.dashboard-frames,
.dashboard-frame {
  position: absolute;
  inset: 0;
}

.dashboard-stage {
  isolation: isolate;
  background:
    radial-gradient(circle at 78% -10%, rgba(36, 117, 86, 0.19), transparent 34%),
    var(--bg);
}

.dashboard-frame {
  z-index: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease;
}

.dashboard-frame.is-active {
  z-index: 1;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.dashboard-frame__content {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
}

.frame-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  background:
    radial-gradient(circle at 78% -10%, rgba(36, 117, 86, 0.19), transparent 34%),
    var(--bg);
  letter-spacing: 0.08em;
  transition: opacity 180ms ease;
}

.dashboard-frame.is-loaded .frame-loading {
  visibility: hidden;
  opacity: 0;
}

.edge-control {
  position: fixed;
  z-index: 4;
  top: 50%;
  display: grid;
  width: 44px;
  height: 74px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(7, 16, 15, 0.52);
  box-shadow: var(--shadow);
  opacity: 0.46;
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    opacity 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.edge-control span {
  display: block;
  margin-top: -5px;
  font-family: Arial, sans-serif;
  font-size: 50px;
  font-weight: 200;
  line-height: 1;
}

.edge-control--previous {
  left: max(6px, env(safe-area-inset-left));
  border-radius: 0 9px 9px 0;
}

.edge-control--next {
  right: max(6px, env(safe-area-inset-right));
  border-radius: 9px 0 0 9px;
}

.edge-control:hover,
.edge-control:focus-visible {
  color: var(--green);
  border-color: var(--line-strong);
  background: rgba(9, 31, 25, 0.92);
  opacity: 1;
  outline: none;
}

.switcher {
  position: fixed;
  z-index: 5;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.switcher__status {
  display: flex;
  min-width: 128px;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.switcher__pulse {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(132, 247, 168, 0.7);
}

.switcher__tabs {
  display: flex;
  align-self: stretch;
  gap: 3px;
}

.switcher__tab {
  min-width: 88px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.switcher__tab:hover,
.switcher__tab:focus-visible {
  color: var(--text);
  border-color: var(--line);
  outline: none;
}

.switcher__tab.is-active {
  color: var(--green);
  border-color: var(--line-strong);
  background: var(--panel-strong);
  box-shadow: inset 0 -2px 0 rgba(132, 247, 168, 0.72);
}

.switcher__label--short {
  display: none;
}

.switcher__position {
  min-width: 42px;
  padding: 0 7px;
  color: var(--text);
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.switcher__fullscreen {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--green);
  background: rgba(132, 247, 168, 0.09);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.switcher__fullscreen:hover,
.switcher__fullscreen:focus-visible {
  color: var(--text);
  background: var(--panel-strong);
  outline: none;
}

.dashboard-stage:fullscreen,
.dashboard-stage:-webkit-full-screen {
  width: 100%;
  height: 100%;
}

.noscript-message {
  position: fixed;
  z-index: 8;
  inset: 50% auto auto 50%;
  padding: 18px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-strong);
  transform: translate(-50%, -50%);
}

@media (max-width: 600px) {
  .dashboard-frame {
    transition-duration: 220ms;
  }

  .edge-control {
    display: none;
  }

  .switcher {
    top: auto;
    bottom: max(7px, env(safe-area-inset-bottom));
    min-height: 40px;
    gap: 3px;
    padding: 3px;
    border-radius: 6px;
  }

  .switcher__status {
    display: none;
  }

  .switcher__pulse {
    display: none;
  }

  .switcher__status span:last-child {
    max-width: 38px;
  }

  .switcher__tab {
    min-width: 58px;
    padding: 0 10px;
    font-size: 12px;
  }

  .switcher__label--long {
    display: none;
  }

  .switcher__label--short {
    display: inline;
  }

  .switcher__position {
    display: none;
  }

  .switcher__fullscreen {
    display: none;
  }
}

@media (orientation: landscape) and (max-width: 1100px) {
  .switcher {
    min-height: 36px;
    gap: 3px;
    padding: 3px;
  }

  .switcher__status {
    display: none;
  }

  .switcher__tab {
    min-width: 70px;
    padding: 0 8px;
    font-size: 11px;
  }

  .switcher__position {
    min-width: 34px;
    padding: 0 3px;
    font-size: 10px;
  }

  .switcher__fullscreen {
    min-height: 28px;
    padding: 0 7px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-frame,
  .edge-control,
  .switcher__tab,
  .frame-loading {
    transition: none;
  }
}
