:root {
  --bg: #0b1020;
  --card: rgba(255, 255, 255, 0.08);
  --card-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --primary: #7c3aed;
  --primary-2: #8b5cf6;
  --ring: rgba(124, 58, 237, 0.22);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);

  --radius: 18px;
  --radius-sm: 14px;
  --gap: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";

  /* iOS 瀹夊叏鍖� */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* 鐢� index.html 鍐呰仈鑴氭湰鍐欏叆锛屼緵 WebView 浣跨敤锛堥伩鍏� 100vh/dvh 涓� flex 涓诲尯鍩熼珮搴︿负 0锛� */
  --app-vh: 100vh;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  /* 鍏� 100vh锛氭棫鐗� Android WebView 涓嶈 dvh锛屽惁鍒欐暣鏉� min-height 鏄撳け鏁� */
  min-height: 100vh;
  min-height: 100dvh;
  min-height: var(--app-vh);
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: var(--app-vh);
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1000px 700px at 20% 10%, rgba(124, 58, 237, 0.28), transparent 60%),
    radial-gradient(1000px 700px at 80% 30%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(1000px 700px at 50% 90%, rgba(16, 185, 129, 0.14), transparent 60%),
    var(--bg);
}

.app {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: var(--app-vh);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

.topbar {
  flex-shrink: 0;
  min-height: calc(64px + var(--safe-top));
  padding: 0 16px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* WebView / 灏忓睆锛氭瘺鐜荤拑鏄撳鑷翠笅灞備富鍐呭涓嶅悎鎴愶紝鏀逛负瀹炲簳 */
@media (max-width: 768px) {
  .topbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(11, 16, 32, 0.96);
  }
}

/* 閮ㄥ垎 WebKit 鍦� backdrop-filter 涓嬪瓙灞傚悎鎴愬紓甯革紝闄嶇骇涓哄疄搴� */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar {
    background: rgba(11, 16, 32, 0.92);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-hint {
  font-size: 12px;
  color: var(--muted);
}

.view {
  /*
   * flex:1 1 0 + min-height:0 鍦ㄣ€岀埗绾ф湭鎾戞弧瑙嗗彛銆嶇殑 WebView 閲屼細鎶婁富鍖哄煙鍘嬫垚 0 楂樸€�
   * 鐢� 1 1 auto + 鏄惧紡 min-height锛�100vh 涓� --app-vh锛変繚璇佺櫥褰曞尯绛夊缁堟湁缁樺埗楂樺害銆�
   */
  flex: 1 1 auto;
  min-height: calc(100vh - 72px - var(--safe-top) - var(--safe-bottom));
  min-height: calc(100dvh - 72px - var(--safe-top) - var(--safe-bottom));
  min-height: calc(var(--app-vh) - 72px - var(--safe-top) - var(--safe-bottom));
  width: 100%;
  max-width: 100%;
  padding: 18px;
  padding-bottom: calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.card {
  width: min(560px, 100%);
  max-width: 100%;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: radial-gradient(900px 220px at 30% 0%, rgba(124, 58, 237, 0.20), transparent 60%),
    radial-gradient(800px 220px at 85% 20%, rgba(59, 130, 246, 0.18), transparent 60%);
  opacity: 0.9;
}

.card > * {
  position: relative;
}

.card-tight {
  width: 100%;
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.h1 {
  margin: 0;
  padding: 18px 18px 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.card > .muted {
  padding: 6px 18px 0;
  margin: 0;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 18px 0;
}

.segmented-item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
}

.segmented-item.is-active {
  border-color: rgba(124, 58, 237, 0.65);
  background: rgba(124, 58, 237, 0.22);
}

.form {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.input {
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  outline: none;
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
}

.input:focus {
  border-color: rgba(124, 58, 237, 0.75);
  box-shadow: 0 0 0 4px var(--ring);
}

.mono {
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

.btn {
  height: 44px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 650;
  color: var(--text);
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.05);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-full {
  width: 100%;
}

.btn + .btn {
  margin-top: 10px;
}

.btn-primary.is-on {
  position: relative;
  animation: vib 0.12s infinite linear;
}

.btn-primary.is-on::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 55%),
    radial-gradient(circle at 70% 60%, rgba(124, 58, 237, 0.28), transparent 55%);
  filter: blur(10px);
  opacity: 0.9;
  pointer-events: none;
}

@keyframes vib {
  0% { transform: translate(0, 0) scale(0.999); }
  25% { transform: translate(0.6px, -0.4px) scale(1); }
  50% { transform: translate(-0.5px, 0.6px) scale(1.001); }
  75% { transform: translate(0.5px, 0.4px) scale(1); }
  100% { transform: translate(0, 0) scale(0.999); }
}

.title-lg {
  font-size: 18px;
  font-weight: 700;
}

.spacer {
  height: 6px;
}

.remote-bg {
  width: 100%;
  display: grid;
  place-items: start center;
}

.remote-wrap {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.remote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.remote-title {
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.grid-2 {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-card {
  width: 100%;
  height: 56px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-align: left;
  padding-left: 16px;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.action-card:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.06);
}

.action-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.action-card.fx-pulse {
  animation: pulse 800ms ease-out 1;
}

.action-card.fx-wave {
  animation: wave 1100ms ease-out 1;
}

.action-card.fx-heat {
  animation: heat 1200ms ease-out 1;
}

.action-card.fx-drops {
  position: relative;
}

.action-card.fx-drops::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: calc(var(--radius) + 10px);
  background:
    radial-gradient(circle at 12% 22%, rgba(56, 189, 248, 0.0) 0 38%, rgba(56, 189, 248, 0.65) 40%, rgba(56, 189, 248, 0.0) 58%),
    radial-gradient(circle at 78% 28%, rgba(56, 189, 248, 0.0) 0 36%, rgba(56, 189, 248, 0.55) 40%, rgba(56, 189, 248, 0.0) 60%),
    radial-gradient(circle at 30% 82%, rgba(56, 189, 248, 0.0) 0 36%, rgba(56, 189, 248, 0.55) 40%, rgba(56, 189, 248, 0.0) 60%),
    radial-gradient(circle at 88% 78%, rgba(56, 189, 248, 0.0) 0 34%, rgba(56, 189, 248, 0.50) 40%, rgba(56, 189, 248, 0.0) 62%);
  filter: blur(0.2px);
  opacity: 0;
  animation: drops 1300ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-speed-up {
  position: relative;
}

.action-card.fx-speed-up::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: calc(var(--radius) + 12px);
  background:
    linear-gradient(90deg, rgba(16,185,129,0.0), rgba(16,185,129,0.18), rgba(16,185,129,0.0)),
    radial-gradient(circle at 70% 40%, rgba(167,243,208,0.20), transparent 55%);
  opacity: 0;
  transform: translateX(-18px);
  animation: speedUp 900ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-speed-down {
  position: relative;
}

.action-card.fx-speed-down::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: calc(var(--radius) + 12px);
  background:
    linear-gradient(90deg, rgba(59,130,246,0.0), rgba(59,130,246,0.16), rgba(59,130,246,0.0)),
    radial-gradient(circle at 30% 60%, rgba(191,219,254,0.18), transparent 55%);
  opacity: 0;
  transform: translateX(18px);
  animation: speedDown 900ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-shimmer {
  position: relative;
}

.action-card.fx-shimmer::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: calc(var(--radius) + 14px);
  background:
    radial-gradient(circle at 15% 25%, rgba(255,255,255,0.0) 0 40%, rgba(255,255,255,0.16) 44%, rgba(255,255,255,0.0) 60%),
    radial-gradient(circle at 85% 35%, rgba(255,255,255,0.0) 0 40%, rgba(255,255,255,0.14) 44%, rgba(255,255,255,0.0) 60%),
    linear-gradient(120deg, rgba(124,58,237,0.0), rgba(124,58,237,0.10), rgba(124,58,237,0.0));
  opacity: 0;
  animation: shimmer 1100ms ease-out 1;
  pointer-events: none;
}

.action-card.fx-tick {
  animation: tick 800ms ease-out 1;
}

.action-card.is-active {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.10);
}

@keyframes speedUp {
  0% { opacity: 0; transform: translateX(-18px); }
  25% { opacity: 0.85; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(10px); }
}

@keyframes speedDown {
  0% { opacity: 0; transform: translateX(18px); }
  25% { opacity: 0.85; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-10px); }
}

@keyframes shimmer {
  0% { opacity: 0; transform: rotate(-2deg) scale(0.98); }
  30% { opacity: 0.9; transform: rotate(0deg) scale(1); }
  100% { opacity: 0; transform: rotate(1deg) scale(1.02); }
}

@keyframes tick {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(0) scale(1.01); }
  60% { transform: translateY(0) scale(0.995); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.18); transform: translateY(0) scale(1.01); }
  100% { filter: brightness(1); transform: translateY(0) scale(1); }
}

@keyframes wave {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.0); }
  30% { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0.18); }
  100% { box-shadow: 0 0 0 18px rgba(124, 58, 237, 0.0); }
}

@keyframes heat {
  0% { filter: hue-rotate(0deg) brightness(1); }
  30% { filter: hue-rotate(-14deg) brightness(1.12); }
  100% { filter: hue-rotate(0deg) brightness(1); }
}

@keyframes drops {
  0% { opacity: 0; transform: scale(0.98); }
  25% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}

.action-card::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.85;
}

.action-card {
  padding-left: 38px;
}

.tone-positive {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.22);
}
.tone-positive::before {
  background: rgba(167, 243, 208, 0.85);
}

.tone-neutral {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.tone-neutral::before {
  background: rgba(255, 255, 255, 0.75);
}

.tone-accent {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.22);
}
.tone-accent::before {
  background: rgba(191, 219, 254, 0.90);
}

.tone-accent2 {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(124, 58, 237, 0.22);
}
.tone-accent2::before {
  background: rgba(221, 214, 254, 0.92);
}

.tone-warning {
  background: rgba(254, 226, 226, 0.90);
  border-color: rgba(254, 202, 202, 1);
  color: #991b1b;
}
.tone-warning::before {
  background: rgba(153, 27, 27, 0.85);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  z-index: 50;
}

.overlay-card {
  width: min(360px, 92vw);
  background: rgba(20, 24, 38, 0.88);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.overlay-text {
  font-weight: 650;
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.88);
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.40);
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  z-index: 60;
}

.modal-card {
  width: min(420px, 92vw);
  background: rgba(20, 24, 38, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}

.modal-title {
  font-size: 18px;
  font-weight: 750;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 80;
  max-width: min(520px, 92vw);
  text-align: center;
}

@media (max-width: 480px) {
  .view {
    padding: 12px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }

  .topbar {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }

  .brand-title {
    max-width: 42vw;
    font-size: 14px;
  }

  .session-hint {
    max-width: 28vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .h1 {
    font-size: 19px;
    padding-top: 14px;
  }

  .remote-wrap {
    width: min(560px, 100%);
  }

  .action-card {
    height: 60px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

