:root {
  --bg: #101214;
  --panel: #1b1f22;
  --panel-2: #242a2e;
  --line: #384048;
  --text: #f3f0e8;
  --muted: #a9b0b5;
  --amber: #d7a33f;
  --green: #62b886;
  --red: #d75f5f;
  --cyan: #70b9c8;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
}

button:hover:not(:disabled) {
  border-color: var(--amber);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.query-panel,
.summary,
.workspace {
  border: 1px solid var(--line);
  background: rgba(27, 31, 34, 0.94);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  padding: 12px 24px;
  border-radius: 8px;
  border-bottom: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-logo {
  height: 48px;
  width: auto;
  margin-right: 12px;
  object-fit: contain;
}

.topbar-title {
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, #FF6B35 0%, #F7C948 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  max-width: 100%;
}

@media (max-width: 768px) {
  .topbar-logo {
    height: 6vw;
    margin-right: 1vw;
    flex-shrink: 0;
  }

  .topbar-title {
    font-size: 5vw;
    letter-spacing: 0;
    white-space: nowrap;
  }
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  font-weight: 800;
}

h2 {
  font-size: 17px;
}

.runtime {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 12px;
  white-space: nowrap;
}

.query-panel {
  margin-top: 8px;
  padding: 20px 24px;
  border-bottom: 0;
}

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

.query-form input,
.keys-grid input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111416;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.query-form input:focus,
.keys-grid input:focus {
  border-color: var(--cyan);
}

.query-form button {
  min-height: 48px;
  background: var(--amber);
  border-color: var(--amber);
  color: #1b1406;
  font-weight: 800;
}

.quick-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.recent-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111416;
  color: var(--text);
  padding: 0 16px;
  text-decoration: none;
}

.recent-link:hover:not(.disabled) {
  border-color: var(--amber);
}

.recent-link.disabled {
  color: var(--muted);
  opacity: 0.5;
  pointer-events: none;
}

.keys-panel {
  margin-top: 12px;
  color: var(--muted);
}

.keys-panel summary {
  cursor: pointer;
  width: fit-content;
}

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

.keys-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
}

.key-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.key-link-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.key-link {
  display: grid;
  gap: 4px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111416;
  color: var(--text);
  padding: 10px;
  text-decoration: none;
}

.key-link:hover {
  border-color: var(--amber);
}

.key-link span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 18px 24px;
}

.summary-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 34px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 14px;
}

.summary-low .summary-level {
  background: rgba(98, 184, 134, 0.16);
  color: var(--green);
}

.summary-medium .summary-level {
  background: rgba(215, 163, 63, 0.16);
  color: var(--amber);
}

.summary-high .summary-level {
  background: rgba(215, 95, 95, 0.16);
  color: var(--red);
}

.workspace {
  padding: 24px;
  border-radius: 0 0 8px 8px;
}

.workspace-full {
  width: 100%;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  gap: 14px;
}

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

.provider-grid,
.link-grid {
  display: grid;
  gap: 12px;
}

.provider-card,
.link-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.provider-top,
.link-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.provider-name,
.link-name {
  font-weight: 800;
}

.provider-status {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 9px;
  color: var(--muted);
  font-size: 12px;
}

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

.status-missing-key {
  color: var(--amber);
}

.status-error {
  color: var(--red);
}

.provider-summary,
.link-category {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-row a {
  color: var(--cyan);
}

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.signal {
  border: 1px solid rgba(215, 95, 95, 0.4);
  border-radius: 999px;
  color: #f0b2b2;
  padding: 4px 9px;
  font-size: 12px;
}

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.link-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 0 12px;
  text-decoration: none;
}

.link-card a:hover {
  border-color: var(--amber);
}

.empty {
  color: var(--muted);
  padding: 16px 0;
}

/* Ad slots */
.ad-banner,
.top-banner {
  width: 100%;
  text-align: center;
  margin: 12px 0;
}

.ad-banner img,
.top-banner img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  object-fit: contain;
}

/* 电脑端显示，手机端隐藏 */
.desktop-img {
  display: block;
}

.mobile-img {
  display: none;
}

@media (max-width: 768px) {
  .desktop-img {
    display: none;
  }

  .mobile-img {
    display: block;
  }

  .ad-banner img,
  .top-banner img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }
}

.ad-square {
  width: 100%;
  text-align: center;
  margin-top: 12px;
}

.ad-square a {
  display: inline-block;
}

.ad-square img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  object-fit: contain;
}

/* 左右漂浮广告 */
.ad-float {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999;
}

.ad-float-left {
  left: 10px;
}

.ad-float-right {
  right: 10px;
}

.ad-float a,
.ad-float img {
  display: block;
  width: 100%;
}

.ad-float img {
  border-radius: 6px;
}

@media (max-width: 1400px) {
  .ad-float {
    display: none;
  }
}

.ad-hidden {
  display: none;
}

@media (max-width: 860px) {
  .query-form,
  .workspace,
  .keys-grid,
  .key-link-grid {
    grid-template-columns: 1fr;
  }

  .link-card {
    grid-template-columns: 1fr;
  }
}
