:root {
  --bg: #070a0d;
  --panel: rgba(18, 23, 28, 0.88);
  --panel-strong: #151b20;
  --line: rgba(255, 255, 255, 0.085);
  --text: #f3f7f5;
  --muted: #8d9993;
  --green: #60f5a5;
  --green-soft: rgba(96, 245, 165, 0.12);
  --red: #ff6b72;
  --amber: #f4c864;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.46);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 25% -10%, rgba(45, 156, 101, 0.14), transparent 34%),
    linear-gradient(180deg, #080c0f 0%, #07090b 100%);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-a { background: #21b96e; top: -180px; right: -120px; }
.ambient-b { background: #167c91; bottom: -260px; left: -140px; }

.shell {
  position: relative;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 36px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(96, 245, 165, 0.45);
  border-radius: 19px;
  color: var(--green);
  background: linear-gradient(145deg, rgba(96, 245, 165, 0.16), rgba(96, 245, 165, 0.025));
  box-shadow: inset 0 1px rgba(255,255,255,.1), 0 15px 45px rgba(34, 178, 106, .12);
  font-size: 27px;
  font-weight: 800;
}

.eyebrow, .step {
  margin: 0 0 7px;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(29px, 5vw, 42px); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 22px; letter-spacing: -.02em; }
.subtitle { margin-bottom: 0; color: var(--muted); font-size: 14px; }

.query-card, .result {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(150deg, rgba(24, 31, 36, .96), rgba(13, 17, 21, .92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.query-card { padding: 28px; }
.card-heading, .result-topline, .name-row, .result-actions, .usage-copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-pill, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 700;
}

.live-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}

form { margin-top: 24px; }
label { display: block; margin-bottom: 9px; color: #bdc6c1; font-size: 13px; font-weight: 650; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }

.key-input-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(4, 7, 9, .52);
  transition: border-color .2s, box-shadow .2s;
}

.key-input-wrap:focus-within { border-color: rgba(96, 245, 165, .5); box-shadow: 0 0 0 4px rgba(96, 245, 165, .075); }
.key-prefix { padding-left: 16px; color: var(--green); font-family: ui-monospace, monospace; font-size: 12px; font-weight: 800; }

input[type="password"], input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 12px 0 10px;
  color: var(--text);
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

input::placeholder { color: #505b56; }
.icon-button { border: 0; padding: 10px 14px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.icon-button:hover { color: var(--text); }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 750;
  transition: transform .18s, box-shadow .18s, opacity .18s;
}

.primary-button {
  position: relative;
  min-width: 142px;
  height: 54px;
  padding: 0 22px;
  color: #04130b;
  background: var(--green);
  box-shadow: 0 13px 35px rgba(96, 245, 165, .16);
}

.primary-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 42px rgba(96, 245, 165, .25); }
button:disabled { cursor: wait; opacity: .6; }
.spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(4,19,11,.25); border-top-color: #04130b; border-radius: 50%; animation: spin .7s linear infinite; }
.primary-button.loading .button-text { display: none; }
.primary-button.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.privacy-note { margin: 10px 0 0; color: #68746e; font-size: 11px; }
.error-box { margin-top: 18px; padding: 13px 15px; border: 1px solid rgba(255,107,114,.26); border-radius: 13px; color: #ffb8bc; background: rgba(255,107,114,.08); font-size: 13px; }

.result { margin-top: 18px; padding: 28px; }
.result-enter { animation: rise .36s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.name-row { justify-content: flex-start; gap: 12px; }
.name-row h2 { font-size: 25px; }
.status-badge { padding: 5px 9px; font-size: 11px; }
.status-off { color: var(--red); background: rgba(255,107,114,.1); }
code { display: block; margin-top: 9px; color: #75827b; font-size: 12px; }
.sync-state { text-align: right; }
.sync-state span { display: block; color: var(--muted); font-size: 11px; }
.sync-state strong { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 26px; }
.metric { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.025); }
.metric-accent { background: linear-gradient(145deg, rgba(96,245,165,.105), rgba(96,245,165,.025)); }
.metric > span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; overflow: hidden; margin: 12px 0 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(20px, 3vw, 29px); letter-spacing: -.04em; text-overflow: ellipsis; }
.metric-accent strong { color: var(--green); }
.metric small { color: #65706b; font-size: 11px; }

.usage-panel { margin-top: 13px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: rgba(3,6,8,.32); }
.usage-copy { color: var(--muted); font-size: 12px; }
.usage-copy strong { color: var(--text); }
.progress-track { height: 8px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #262d29; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--green); box-shadow: 0 0 18px rgba(96,245,165,.45); transition: width .55s ease; }
.progress-bar.warning { background: var(--amber); }
.progress-bar.danger { background: var(--red); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.detail-grid div { min-width: 0; }
.detail-grid span { display: block; margin-bottom: 5px; color: #65706b; font-size: 11px; }
.detail-grid strong { display: block; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

.result-actions { margin-top: 18px; }
.secondary-button { padding: 11px 15px; border: 1px solid var(--line); background: rgba(255,255,255,.04); font-size: 12px; }
.secondary-button:hover:not(:disabled) { background: rgba(255,255,255,.075); }
.auto-refresh { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 500; }
.auto-refresh input { accent-color: var(--green); }

footer { display: flex; justify-content: center; gap: 9px; margin-top: 24px; color: #505a55; font-size: 11px; }
.dot { color: var(--green); }

[hidden] { display: none !important; }

@media (max-width: 800px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .shell { width: min(100% - 24px, 1080px); padding-top: 34px; }
  .hero { align-items: flex-start; }
  .brand-mark { width: 52px; height: 52px; flex: 0 0 auto; }
  .query-card, .result { padding: 20px; border-radius: 19px; }
  .input-row { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { padding: 16px; }
  .result-topline { align-items: flex-start; gap: 20px; }
  .sync-state { max-width: 130px; }
  .detail-grid { grid-template-columns: 1fr; }
  footer { flex-wrap: wrap; text-align: center; }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr; }
  .live-pill { display: none; }
}

