/* Jerry 网站启动台 —— style.css
 * 深浅双主题 + 横竖屏/折叠屏/安全区全适配（2026-10-20）
 */
:root {
  --bg: #f2f5fa;
  --bg-glow-1: rgba(0, 120, 212, 0.10);
  --bg-glow-2: rgba(139, 92, 246, 0.08);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #16202c;
  --muted: #5b6b7f;
  --line: #e3e9f2;
  --accent: #0078d4;
  --accent-soft: rgba(0, 120, 212, 0.10);
  --shadow: 0 1px 3px rgba(16, 32, 53, 0.06), 0 8px 24px rgba(16, 32, 53, 0.06);
  --shadow-hover: 0 4px 12px rgba(16, 32, 53, 0.10), 0 16px 40px rgba(16, 32, 53, 0.12);
  --radius: 16px;
  --kbd-bg: #eef2f8;
}
html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-glow-1: rgba(0, 120, 212, 0.16);
  --bg-glow-2: rgba(139, 92, 246, 0.12);
  --surface: #131c2b;
  --surface-2: #182233;
  --text: #e8eef7;
  --muted: #94a5bc;
  --line: #26334a;
  --accent: #4db2ff;
  --accent-soft: rgba(77, 178, 255, 0.14);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.35);
  --kbd-bg: #1d2939;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .3s, color .3s;
}

/* 背景光斑（纯装饰） */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 12% -6%, var(--bg-glow-1), transparent 70%),
    radial-gradient(700px 420px at 92% 4%, var(--bg-glow-2), transparent 70%);
}

/* ============ 顶栏 ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 38px;
  height: 38px;
  flex: none;
  color: #fff;
  background: linear-gradient(135deg, #0a6fb5, #2bb3ed);
  border-radius: 11px;
  padding: 7px;
  box-shadow: 0 3px 10px rgba(0, 120, 212, 0.35);
}
.brand-text { min-width: 0; }
.brand h1 {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.brand-sub {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-right { display: flex; align-items: center; gap: 12px; flex: none; }

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.clock-time { font-size: 1.12rem; font-weight: 800; }
.clock-date { font-size: 0.72rem; color: var(--muted); }

.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 19px; height: 19px; }
html:not([data-theme="dark"]) .icon-sun { display: block; }
html:not([data-theme="dark"]) .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

/* ============ 主体 ============ */
.content {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  flex: 1;
  padding: 26px 24px 40px;
}

.search-row { margin-bottom: 18px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 14px;
  height: 48px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font-size: 1rem;
  color: var(--text);
  font-family: inherit;
  height: 100%;
}
.search-box input::placeholder { color: var(--muted); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  color: var(--muted);
  background: var(--kbd-bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 8px;
  flex: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============ 磁贴网格 ============ */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.tile {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.tile:active { transform: translateY(-1px); }
.tile-icon {
  width: 46px;
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  line-height: 1;
}
.tile-body { min-width: 0; flex: 1; }
.tile-name {
  font-size: 1.02rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tile-name .arrow {
  font-size: 0.8rem;
  color: var(--muted);
  transition: transform .16s, color .16s;
}
.tile:hover .tile-name .arrow { transform: translate(2px, -2px); color: var(--accent); }
.tile-desc {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 3px 0 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tile-domain {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.tile-cat {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 9px;
  flex: none;
}
.tile-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--kbd-bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 6px;
  flex: none;
  margin-left: auto;
}

.empty-tip {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  padding: 40px 0 20px;
}

/* ============ 页脚 ============ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 18px 24px calc(20px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.site-footer kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  background: var(--kbd-bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 6px;
}
.foot-by { margin-top: 4px; opacity: 0.75; }

/* ============ 登录（小蓝页 SSO） ============ */
.hdr-auth { display: flex; align-items: center; }
.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: filter .15s, transform .1s;
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: scale(0.97); }
.login-btn svg { width: 16px; height: 16px; }

.user-wrap { position: relative; }
.avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  max-width: 180px;
  transition: border-color .15s, background .15s;
}
.avatar-btn:hover { border-color: var(--accent); }
.avatar-btn img, .avatar-btn .fb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a6fb5, #2bb3ed);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}
.avatar-btn .nm {
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jl-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-hover);
  padding: 8px;
  font-size: 0.88rem;
}
.jl-menu.hide { display: none; }
.jl-menu .mhd { padding: 8px 10px 10px; }
.jl-menu .mhd .n { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.jl-menu .mhd .n .badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 7px;
}
.jl-menu .mhd .l { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.jl-menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.jl-menu a, .jl-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
}
.jl-menu a:hover, .jl-menu button:hover { background: var(--accent-soft); color: var(--accent); }
.jl-menu button { font-weight: 600; }

/* SSO 错误提示条 */
.sso-notice {
  max-width: calc(1080px - 48px);
  margin: 14px auto -6px;
  padding: 10px 16px;
  border-radius: 10px;
  background: color-mix(in srgb, #d13438 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #d13438 40%, var(--line));
  color: #d13438;
  font-size: 0.86rem;
  font-weight: 600;
}

/* 磁贴真实图标（图片模式） */
.tile-icon.has-img { background: transparent; border-color: transparent; padding: 0; }
.tile-icon.has-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ============ 响应式：横竖屏 / 平板 / 折叠屏 / 安全区 ============ */
/* 竖屏安全区：刘海/圆角不遮挡（无凹口设备 env 回退 0，零视觉变化） */
@media (orientation: portrait) {
  body {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
  }
  .site-header { padding-top: max(0px, env(safe-area-inset-top, 0px)); }
  .header-inner {
    padding-top: max(14px, calc(env(safe-area-inset-top, 0px) + 6px));
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
  }
}
/* 横屏安全区：左右刘海 */
@media (orientation: landscape) {
  .header-inner, .content {
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
  }
}
/* 平板竖屏：磁贴加宽一档 */
@media (orientation: portrait) and (min-width: 600px) {
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
}
/* 手机竖屏：双列磁贴更紧凑 */
@media (orientation: portrait) and (max-width: 560px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { flex-direction: column; gap: 10px; padding: 14px; }
  .tile-key { display: none; }
  .content { padding: 20px 14px 32px; }
  .header-inner { padding: 11px 16px; }
  .brand h1 { font-size: 1.02rem; }
  .brand-sub { display: none; }
  .clock-time { font-size: 0.98rem; }
  /* 窄屏：头像菜单只留头像，登录按钮收窄 */
  .avatar-btn { max-width: 40px; padding: 0; }
  .avatar-btn .nm { display: none; }
  .login-btn { padding: 0 12px; }
}
/* 超窄屏（≤380px）：单列大磁贴 */
@media (max-width: 380px) {
  .tile-grid { grid-template-columns: 1fr; }
}
/* 横屏矮高度（手机横放 / 折叠 PC 模式）：顶栏与磁贴收紧，首屏看到更多 */
@media (orientation: landscape) and (max-height: 560px) {
  .header-inner { padding-top: 8px; padding-bottom: 8px; }
  .brand-logo { width: 32px; height: 32px; border-radius: 9px; padding: 6px; }
  .brand h1 { font-size: 1rem; }
  .search-row { margin-bottom: 12px; }
  .search-box { height: 42px; }
  .chips { margin-bottom: 12px; }
  .chip { padding: 4px 12px; font-size: 0.8rem; }
  .tile { padding: 12px 14px; }
  .tile-icon { width: 40px; height: 40px; font-size: 20px; }
  .content { padding-top: 16px; padding-bottom: 24px; }
  .site-footer { padding-top: 10px; padding-bottom: 10px; }
}
/* 折叠屏 · 左右双视窗（横折展开）：磁贴单列并收进左半屏，避开中间铰链 */
@supports (left: env(fold-left)) {
  @media (horizontal-viewport-segments: 2) {
    .tile-grid {
      grid-template-columns: 1fr;
      max-width: calc(env(fold-left, 50vw) - 28px);
    }
    .search-box, .chips, .empty-tip { max-width: calc(env(fold-left, 50vw) - 28px); }
    .chips { flex-wrap: wrap; }
  }
}
/* 折叠屏 · 书本姿态（上下双视窗）：页脚上移让位铰链 */
@supports (bottom: env(fold-top)) {
  @media (vertical-viewport-segments: 2) {
    .site-footer { margin-bottom: env(fold-height, 0px); }
  }
}

/* 键盘可访问性焦点环 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* 尊重系统「减弱动画」 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* 打印：只留磁贴清单 */
@media print {
  .site-header, .search-row, .chips, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .tile { box-shadow: none; break-inside: avoid; }
}
