/* Dog Proxy 深色主题 */
:root {
  --bg: #0f1115;
  --bg2: #171a21;
  --bg3: #1f232c;
  --border: #2a2f3a;
  --text: #e6e6e6;
  --muted: #8b8f9a;
  --accent: #5ea2ff;
  --accent2: #7c5cff;
  --danger: #ff6b6b;
  --ok: #4cd97b;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.brand-ico { font-size: 20px; }
.brand-name { font-weight: 700; letter-spacing: .5px; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav { display: flex; gap: 4px; }
.tool, .mode-btn, .go, .star, .btn {
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.tool:hover, .mode-btn:hover, .go:hover, .btn:hover { background: #2a3040; }
.tool:disabled { opacity: .35; cursor: default; }

.addr { flex: 1; display: flex; gap: 6px; min-width: 260px; }
.addr input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.addr input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94,162,255,.15); }
.addr .star { border-radius: 20px; }
.addr .star.on { background: #3a2f10; border-color: #d4a017; color: #ffd75e; }
.addr .go { border-radius: 20px; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-color: transparent; font-weight: 600; }

.mode { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mode-btn { border: none; border-radius: 0; background: transparent; }
.mode-btn.active { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; font-weight: 600; }

.panels { display: flex; gap: 4px; }

/* ---------- 主区域 ---------- */
#main { flex: 1; position: relative; min-height: 0; }
.hidden { display: none !important; }

.viewer, .api-view { position: absolute; inset: 0; display: flex; flex-direction: column; }
#frame { flex: 1; width: 100%; border: none; background: #fff; }
.frame-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(20,22,28,.92); border: 1px solid var(--border); border-radius: 20px;
  padding: 7px 16px; font-size: 13px; z-index: 5;
}
.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0 2px; font-size: inherit; text-decoration: underline; }
.link:hover { color: #8fc0ff; }

/* ---------- 加载遮罩 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10,12,16,.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.loading {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 30px; display: flex; align-items: center; gap: 14px; font-size: 15px;
}
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 首页 ---------- */
.home { position: absolute; inset: 0; overflow-y: auto; padding: 40px 24px 60px; }
.home-hero { text-align: center; max-width: 760px; margin: 0 auto 34px; }
.home-hero h1 { margin: 0 0 6px; font-size: 40px; }
.sub { color: var(--muted); margin: 0 0 26px; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
@media (max-width: 720px) { .quick { grid-template-columns: 1fr; } }
.quick-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.quick-item b { color: var(--accent); display: block; margin-bottom: 6px; }
.quick-item span { color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.favs-block { max-width: 900px; margin: 0 auto 30px; }
.block-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.block-head h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fav-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: border-color .15s, transform .1s;
  display: flex; align-items: center; gap: 12px;
}
.fav-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.fav-ico {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff;
}
.fav-info { min-width: 0; flex: 1; }
.fav-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-url { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-del {
  border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px;
}
.fav-del:hover { color: var(--danger); }
.fav-empty { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 30px 0; }

.tips { max-width: 900px; margin: 0 auto; font-size: 12.5px; line-height: 1.8; }
.tips p { margin: 4px 0; }

/* ---------- API 模式 ---------- */
.api-view { padding: 20px 24px; overflow-y: auto; }
.api-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.api-head h2 { margin: 0 0 4px; }
.api-head p { margin: 0; }
.btn { display: inline-block; text-decoration: none; }
.api-cols { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; }
@media (max-width: 900px) { .api-cols { grid-template-columns: 1fr; } }
.api-col h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.code {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px;
  white-space: pre-wrap; word-break: break-all; max-height: 60vh; overflow: auto; margin: 0;
}

/* ---------- 侧滑面板 ---------- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 92vw);
  background: var(--bg2); border-left: 1px solid var(--border); z-index: 60;
  display: flex; flex-direction: column; box-shadow: -12px 0 30px rgba(0,0,0,.4);
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.panel-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.panel-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 8px; cursor: pointer;
}
.panel-item:hover { background: var(--bg3); }
.panel-item .fav-ico { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; }
.panel-item .fav-title { font-size: 13.5px; }
.panel-item .fav-url { font-size: 11.5px; }
.panel-empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 13.5px; }
.panel-item .fav-del { font-size: 14px; }

@media (max-width: 640px) {
  .toolbar { padding: 8px; }
  .brand-name { display: none; }
}
