/* 快捷键速查页 · 专用样式 */
:root {
  --key-bg: #f8fafc;
  --key-border: #cbd5e1;
  --scene: #ea8c00;
  --scene-soft: rgba(234, 140, 0, 0.1);
  --advanced: #7c3aed;
  --advanced-soft: rgba(124, 58, 237, 0.08);
  --advanced-key-bg: #f5f3ff;
  --advanced-key-border: #c4b5fd;
}

[data-theme="dark"] {
  --key-bg: #1e293b;
  --key-border: #475569;
  --scene-soft: rgba(234, 140, 0, 0.15);
  --advanced-soft: rgba(124, 58, 237, 0.15);
  --advanced-key-bg: #2e1065;
  --advanced-key-border: #6d28d9;
}

html, body {
  height: 100%;
  overflow: hidden;
}

.app-shell { max-width: 1320px; }

.stats {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 6px;
  padding: 3px 10px;
  background: var(--accent-soft);
  border-radius: 999px;
  font-weight: 600;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.control-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  margin-left: auto;
  min-width: 0;
}

.search-wrap {
  flex: 1 1 380px;
  min-width: 200px;
  max-width: 520px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--border-light);
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--surface);
}

.search-wrap input::placeholder { color: var(--muted); opacity: 0.75; }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  justify-content: flex-start;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  flex-shrink: 0;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.12);
}

.tab-brand--wps {
  background: linear-gradient(145deg, #f04a3e, #d9362e);
}

.tab.active .tab-brand--wps {
  background: rgba(255, 255, 255, 0.95);
  color: #dc2626;
  box-shadow: none;
}

.tab:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.tab.active {
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.tab[data-app="word"].active { background: #2b579a; border-color: #2b579a; }
.tab[data-app="excel"].active { background: #217346; border-color: #217346; }
.tab[data-app="ppt"].active { background: #ea580c; border-color: #ea580c; }
.tab[data-app="wps"].active { background: #dc2626; border-color: #dc2626; }
.tab[data-app="ps"].active { background: #31a8ff; border-color: #31a8ff; color: #0f172a; }

.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 0;
  overflow: hidden;
}

.group-nav {
  flex-shrink: 0;
  width: 148px;
  padding: 16px 12px 16px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  display: none;
}

.group-nav-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 10px 12px;
}

.group-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  margin-bottom: 3px;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  line-height: 1.35;
}

.group-nav-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.group-nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.group-nav-btn.is-scene:hover,
.group-nav-btn.is-scene.active {
  background: var(--scene-soft);
  color: var(--scene);
}

.group-nav-btn.is-scene.active { border-left-color: var(--scene); }

.group-nav-btn.is-advanced:hover,
.group-nav-btn.is-advanced.active {
  background: var(--advanced-soft);
  color: var(--advanced);
}

.group-nav-btn.is-advanced.active { border-left-color: var(--advanced); }

.content-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 22px 24px;
  scroll-behavior: smooth;
  background: var(--bg);
  background-image: var(--bg-subtle);
}

#main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-content: start;
}

.group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.group--active {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow);
}

.group--scene.group--active {
  border-color: rgba(234, 140, 0, 0.35);
  box-shadow: 0 0 0 1px var(--scene-soft), var(--shadow);
}

.group--advanced.group--active {
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 0 0 1px var(--advanced-soft), var(--shadow);
}

.group-title {
  padding: 11px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  background: var(--border-light);
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background var(--transition);
}

.group-title:hover { background: var(--accent-soft); }
.group--scene .group-title:hover { background: var(--scene-soft); }
.group--advanced .group-title:hover { background: var(--advanced-soft); }

.group:not(.group--scene):not(.group--advanced) .group-title {
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.group--scene .group-title {
  background: var(--scene-soft);
  border-left: 3px solid var(--scene);
  padding-left: 13px;
}

.group--advanced .group-title {
  background: var(--advanced-soft);
  border-left: 3px solid var(--advanced);
  padding-left: 13px;
}

.group.is-collapsed .group-title { border-bottom: none; }
.group.is-collapsed .group-items { display: none; }

.group-chevron {
  font-size: 0.65rem;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  width: 12px;
}

.group.is-collapsed .group-chevron { transform: rotate(-90deg); }

.group-title::before,
.group--scene .group-title::before,
.group--advanced .group-title::before {
  display: none !important;
  content: none !important;
}

.group-title-text { flex: 1; min-width: 0; }

.group-title-tag {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.group-title-tag--scene { background: var(--scene-soft); color: var(--scene); }
.group-title-tag--advanced { background: var(--advanced-soft); color: var(--advanced); }

.group-items {
  display: grid;
  grid-template-columns: 1fr;
  padding: 4px 0;
  background: var(--surface);
}

.shortcut-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.btn-fav {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--border);
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.4;
  transition: color var(--transition), background var(--transition), opacity var(--transition);
}

.shortcut-row:hover .btn-fav,
.btn-fav.is-fav { opacity: 1; }

.btn-fav:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-fav.is-fav { color: #f59e0b; }
.btn-fav.is-fav:hover { color: #d97706; background: rgba(245, 158, 11, 0.12); }

.shortcut-row:last-child { border-bottom: none; }
.shortcut-row:hover { background: var(--accent-soft); }
.shortcut-row--scene:hover { background: var(--scene-soft); }
.shortcut-row--advanced:hover { background: var(--advanced-soft); }

.shortcut-row--advanced .key {
  background: var(--advanced-key-bg);
  border-color: var(--advanced-key-border);
  color: #5b21b6;
  box-shadow: 0 1px 0 var(--advanced-key-border);
}

[data-theme="dark"] .shortcut-row--advanced .key { color: #ddd6fe; }

.shortcut-row--advanced .key-arrow {
  color: var(--advanced);
  background: transparent;
  border: none;
  box-shadow: none;
}

.shortcut-row.copied-flash { animation: copiedFlash 0.55s ease; }

@keyframes copiedFlash {
  0%, 100% { background: transparent; }
  35% { background: var(--success-soft); }
}

.shortcut-desc {
  font-size: 0.84rem;
  min-width: 0;
  line-height: 1.45;
  color: var(--text);
}

.shortcut-desc-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}

.btn-path-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: help;
  flex-shrink: 0;
  opacity: 0.45;
  transition: color var(--transition), background var(--transition), opacity var(--transition);
}

.btn-path-hint-icon {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}

.btn-path-hint:hover,
.btn-path-hint.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  opacity: 1;
}

.shortcut-row:hover .btn-path-hint { opacity: 0.85; }

.path-popover {
  position: fixed;
  z-index: 200;
  max-width: min(380px, calc(100vw - 24px));
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text);
  pointer-events: none;
}

.path-popover.is-pinned { pointer-events: auto; }

.path-popover-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.path-popover-body {
  white-space: pre-line;
  word-break: break-word;
}

.shortcut-note {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  flex-shrink: 0;
  max-width: 48%;
}

kbd, .key {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--key-bg);
  border: 1px solid var(--key-border);
  border-radius: 6px;
  box-shadow: 0 1px 0 var(--key-border);
  white-space: nowrap;
  color: var(--text);
}

.key-arrow {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--scene);
  font-weight: 700;
  padding: 2px 4px;
  font-size: 0.82rem;
}

mark.search-hit {
  background: rgba(250, 204, 21, 0.45);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

[data-theme="dark"] mark.search-hit {
  background: rgba(250, 204, 21, 0.28);
}

.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
  font-size: 0.92rem;
  grid-column: 1 / -1;
}

.empty-hint {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.65;
}

.content-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.content-toolbar .btn-sm.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #d97706;
  font-weight: 600;
}

.group-nav-mobile {
  display: none;
  flex-shrink: 0;
  gap: 6px;
  padding: 10px 0 0;
  margin-top: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.group-nav-mobile::-webkit-scrollbar { height: 4px; }

.group-nav-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.group-nav-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.group-nav-chip.is-scene.active {
  background: var(--scene-soft);
  border-color: var(--scene);
  color: var(--scene);
}

.group-nav-chip.is-advanced.active {
  background: var(--advanced-soft);
  border-color: var(--advanced);
  color: var(--advanced);
}

footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.65;
}

footer kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: 4px;
}

@media (min-width: 900px) {
  .group-nav { display: block; }
  .group-nav-mobile { display: none !important; }
}

@media (max-width: 899px) {
  .group-nav { display: none !important; }
  .group-nav-mobile { display: flex; }
}

@media (min-width: 1200px) {
  .keys { max-width: none; }
}

@media (max-width: 767px) {
  html, body { overflow: auto; height: auto; }
  .app-shell { height: auto; min-height: 100vh; min-height: 100dvh; }
  .app-body { flex-direction: column; overflow: visible; }
  .content-pane { overflow: visible; padding: 12px 14px 28px; }
  .shortcut-row { grid-template-columns: 28px 1fr; }
  .shortcut-row .keys { grid-column: 1 / -1; padding-left: 28px; }
  .control-row { flex-direction: column; align-items: stretch; }
  .control-right { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .search-wrap { max-width: none; flex: 1 1 140px; min-width: 0; }
  .tabs { justify-content: flex-start; }
}

@media print {
  html, body { overflow: visible; height: auto; }
  .app-shell { height: auto; max-width: none; box-shadow: none; }
  .app-top .header-actions, .search-wrap, .group-nav, .content-toolbar, .toast, .path-popover, .btn-path-hint { display: none !important; }
  .content-pane { overflow: visible; }
  #main { grid-template-columns: 1fr; }
  .group { break-inside: avoid; box-shadow: none; }
}
