.xp-help-center {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  color: var(--text-primary);
}

.xp-help-header {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--accent-soft);
  background: linear-gradient(180deg, var(--surface-window), var(--surface-soft));
}

.xp-help-header-icon {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  border-top: 1px solid var(--surface-contrast);
  border-left: 1px solid var(--surface-contrast);
  border-right: 1px solid var(--border-muted);
  border-bottom: 1px solid var(--border-muted);
  background: linear-gradient(180deg, var(--titlebar-1), var(--titlebar-2));
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 1px 0 var(--overlay-strong);
}

.xp-help-header-copy h2 {
  margin: 0;
  font-size: 15px;
  color: var(--accent-deep);
}

.xp-help-header-copy p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.xp-help-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  flex: 1;
}

.xp-help-toc {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  border: 1px solid var(--divider);
  background: var(--surface-soft);
  padding: 6px;
}

.xp-help-toc-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-deep);
  margin-bottom: 2px;
}

.xp-help-topic-btn {
  text-align: left;
  font-size: 11px;
  color: var(--text-primary);
  border-top: 1px solid var(--surface-contrast);
  border-left: 1px solid var(--surface-contrast);
  border-right: 1px solid var(--border-muted);
  border-bottom: 1px solid var(--border-muted);
  background: linear-gradient(180deg, var(--surface-window), var(--accent-fill));
  padding: 5px 7px;
  cursor: pointer;
}

.xp-help-topic-btn:hover,
.xp-help-topic-btn:focus-visible {
  outline: none;
  background: linear-gradient(180deg, var(--surface-soft-hover), var(--surface-highlight));
}

.xp-help-topic-btn.active {
  border-top-color: var(--border-muted);
  border-left-color: var(--border-muted);
  border-right-color: var(--surface-contrast);
  border-bottom-color: var(--surface-contrast);
  background: linear-gradient(180deg, var(--titlebar-1), var(--titlebar-2));
  color: var(--color-white);
  text-shadow: 0 1px 0 var(--overlay-strong);
}

.xp-help-content {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--divider);
  background: var(--color-white);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.xp-help-content:focus {
  outline: 1px dotted var(--accent-stroke);
  outline-offset: -3px;
}

.xp-help-section {
  border: 1px solid var(--accent-soft);
  background: linear-gradient(180deg, var(--surface-window-alt), var(--surface-window));
  padding: 9px;
}

.xp-help-section h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--accent-deep);
}

.xp-help-section h4 {
  margin: 10px 0 4px;
  font-size: 12px;
  color: var(--text-accent);
}

.xp-help-section p,
.xp-help-section li,
.xp-help-section td,
.xp-help-section th,
.xp-help-section summary {
  font-size: 11px;
  color: var(--explorer-item-text);
  line-height: 1.35;
}

.xp-help-section p {
  margin: 5px 0;
}

.xp-help-section ul,
.xp-help-section ol {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.xp-help-section code,
.xp-help-section kbd {
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 10px;
}

.xp-help-section kbd {
  display: inline-block;
  padding: 1px 4px;
  border: 1px solid var(--accent-mid);
  background: var(--surface-soft);
}

.xp-help-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}

.xp-help-table th,
.xp-help-table td {
  border: 1px solid var(--accent-soft);
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}

.xp-help-table th {
  background: var(--surface-soft);
  color: var(--accent-deep);
}

.xp-help-note {
  border-left: 3px solid var(--accent-stroke);
  padding-left: 6px;
}

.xp-help-section details {
  border: 1px solid var(--accent-soft);
  background: var(--surface-soft);
  padding: 5px 6px;
  margin-top: 6px;
}

.xp-help-section details p {
  margin: 5px 0 0;
}

@media (max-width: 768px) {
  .app-window {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    min-width: 0;
    min-height: 180px;
    top: 6px;
    left: 6px;
    transform: none;
    max-height: calc(100vh - 50px);
  }

  .app-window.maximized {
    left: 0;
    top: 0;
    width: 100vw;
    max-width: none;
    max-height: none;
  }

  .window-titlebar {
    padding: 7px 8px;
  }

  .window-minimize,
  .window-maximize,
  .window-close {
    width: 30px;
    height: 24px;
    font-size: 13px;
  }

  .window-content {
    margin: 3px;
    padding: 8px;
  }

  .window-resize-handle {
    display: none;
  }

  .xp-explorer-body {
    grid-template-columns: 128px minmax(0, 1fr);
    align-items: stretch;
  }

  .xp-sidebar {
    max-height: none;
    min-height: 0;
  }

  .xp-main {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  .xp-files {
    min-width: 0;
  }

  .xp-details {
    display: none;
  }

  .xp-files {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    grid-auto-rows: 88px;
  }

  .xp-file-item {
    width: 84px;
    height: 84px;
    padding: 4px;
  }

  .xp-notepad .xp-note-editor {
    min-height: 180px;
  }

  .xp-help-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .xp-help-toc {
    max-height: 170px;
    overflow: auto;
  }

  .xp-help-content {
    max-height: min(56vh, 420px);
  }

  .xp-saveas-row {
    grid-template-columns: auto auto auto auto;
  }

  .xp-saveas-path {
    grid-column: 1 / -1;
  }

  .xp-saveas-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .xp-saveas-sidebar {
    max-height: 130px;
  }

  .xp-saveas-footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .xp-saveas-buttons {
    justify-content: flex-end;
  }

  .xp-audio-controls {
    grid-template-columns: auto auto auto;
    grid-template-rows: auto auto;
  }

  .xp-audio-seek {
    grid-column: 1 / -1;
  }
}
