:root {
  color-scheme: light dark;
  --bg: #15191d;
  --surface: #20262c;
  --surface-strong: #2a3239;
  --text: #eef3f5;
  --muted: #aab5bd;
  --line: #39434c;
  --accent: #29a394;
  --accent-strong: #66d5c7;
  --danger: #f08a7d;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  --highlight-bg: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f6f7f8;
    --surface: #ffffff;
    --surface-strong: #f0f3f5;
    --text: #1d252d;
    --muted: #66717c;
    --line: #dce2e7;
    --accent: #16746b;
    --accent-strong: #0e5d56;
    --danger: #b2473b;
    --shadow: 0 12px 30px rgba(24, 33, 42, 0.08);
    --highlight-bg: color-mix(in srgb, var(--accent) 10%, #ffffff);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.app {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.app:has(#projectView:not([hidden])) {
  padding-top: 12px;
}

.app-header {
  margin-bottom: 20px;
}

.app-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.app-header-top h1 {
  flex: 1;
  min-width: 0;
}

.app-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
}

.help-btn,
.settings-btn {
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.help-btn {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.help-btn:hover,
.help-btn:active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--surface-strong);
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.settings-btn:hover,
.settings-btn:active {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--surface-strong);
}

.settings-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  fill: currentColor;
}

.subtitle,
.empty-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.view-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.project-toolbar {
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.project-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
}

.reset-progress-btn {
  flex-shrink: 0;
  min-height: 36px;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.reset-progress-btn:hover,
.reset-progress-btn:active {
  color: var(--text);
  background: var(--surface-strong);
  border: none;
}

.edit-toggle-btn {
  flex-shrink: 0;
  min-height: 36px;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.edit-toggle-btn:hover,
.edit-toggle-btn[aria-pressed="true"] {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: none;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
}

button.compact {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.ghost {
  background: transparent;
  padding-left: 0;
  border-color: transparent;
}

button.ghost:hover {
  border-color: transparent;
  color: var(--accent-strong);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px 6px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.back-btn:hover,
.back-btn:active {
  color: var(--accent-strong);
  border-color: transparent;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.back-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.back-btn span {
  font-size: 14px;
}

.inline-form {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: 80px;
  scroll-margin-bottom: 120px;
}

.inline-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.inline-form input {
  width: 100%;
  min-height: 40px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.inline-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.inline-form-actions {
  display: flex;
  gap: 8px;
}

.inline-form-actions button {
  flex: 1;
}

.inline-form--card,
.inline-form--stage {
  margin: 0;
  padding: 12px 14px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: var(--surface-strong);
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: visible;
}

.project-card-row {
  display: flex;
  align-items: stretch;
}

.project-card-main-wrap {
  flex: 1;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px 12px 14px 16px;
}

.project-card-main {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.project-card-main:hover {
  color: inherit;
}

.project-card-row:has(.project-card-main:hover) .project-card-main-wrap {
  background: var(--surface-strong);
  border-radius: 8px 0 0 8px;
}

.project-card-meta-wrap {
  display: grid;
  gap: 8px;
}

.project-card-name {
  font-size: 17px;
  font-weight: 600;
  word-break: break-word;
}

.project-card-meta {
  color: var(--muted);
  font-size: 13px;
}

.project-card-track {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.project-card-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.card-actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  width: 48px;
  border-left: 1px solid var(--line);
}

.card-actions--compact {
  width: 40px;
  padding: 2px 0 4px;
}

.card-actions-menu {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
}

.menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.card-actions .menu-trigger {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.card-actions .menu-trigger:hover {
  border-color: transparent;
}

.card-actions--compact .menu-trigger {
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
  letter-spacing: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.menu-trigger {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  letter-spacing: 1px;
}

.card-actions--compact .menu-trigger:hover,
.card-actions--compact .menu-trigger:active,
.card-actions--compact .menu-trigger[aria-expanded="true"] {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: none;
  box-shadow: none;
}

.card-actions .menu-trigger:hover,
.card-actions .menu-trigger[aria-expanded="true"] {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: none;
  box-shadow: none;
}

.drag-handle-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  touch-action: none;
  cursor: grab;
}

.card-actions--compact .drag-handle-btn {
  width: 36px;
  min-height: 36px;
  height: 36px;
  border-radius: 6px;
}

.drag-handle-btn:hover,
.drag-handle-btn:active {
  color: var(--text);
  background: var(--surface-strong);
  border-color: transparent;
}

.drag-handle-btn--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.drag-handle-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.sortable-dragging {
  opacity: 0.88;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.sortable-placeholder {
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-sizing: border-box;
}

body.sortable-active {
  user-select: none;
  -webkit-user-select: none;
}

.sortable-list-locked {
  touch-action: none;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 168px;
  max-width: min(240px, calc(100vw - 40px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
}

.menu-item:hover {
  background: var(--surface-strong);
  border-color: transparent;
}

.menu-item-danger {
  color: var(--muted);
}

.menu-item-danger:hover,
.menu-item-danger:active {
  color: var(--text);
  background: var(--surface-strong);
  border-color: transparent;
}

.delete-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
}

.delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.delete-button:hover,
.delete-button:active {
  color: var(--text);
  background: var(--surface-strong);
  border-color: transparent;
}

.status-panel,
.stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: visible;
}

.status-panel {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.status-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.status-project-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 4px;
  min-width: 0;
  flex: 1;
  margin: 0;
  line-height: 1.3;
}

.status-label-inline {
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
  flex-shrink: 0;
}

#currentProjectName {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.progress-count {
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-strong);
  line-height: 1.2;
}

.step--checkable {
  grid-template-columns: 28px minmax(0, 1fr) 40px;
  cursor: pointer;
}

#projectView:not(.is-editing) .stage-header-top .card-actions {
  display: none;
}

#projectView:not(.is-editing) .add-stage-block {
  display: none;
}

#projectView:not(.is-editing) .add-step-form {
  display: none;
}

#projectView:not(.is-editing) .delete-button {
  display: none;
}

#projectView:not(.is-editing) .step--checkable {
  grid-template-columns: 28px minmax(0, 1fr);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.stages {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.stage {
  padding: 16px;
}

.stage-header {
  margin-bottom: 4px;
}

.stage-header-top {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.stage-header-top .card-actions--compact {
  align-self: stretch;
}

.stage-header-main {
  flex: 1;
  min-width: 0;
}

.stage-title-row {
  min-width: 0;
  flex: 1;
}

.stage-title-count-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.stage-title-count-row h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 17px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.inline-title-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  scroll-margin-top: 80px;
  scroll-margin-bottom: 120px;
}

.inline-title-edit input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
}

.inline-title-edit input:focus {
  outline: none;
}

.project-card-main-wrap .inline-title-edit input {
  font-size: 17px;
}

.inline-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.inline-edit-btn:hover {
  border-color: var(--accent);
}

.inline-edit-confirm {
  color: var(--accent-strong);
}

.inline-edit-cancel:hover {
  color: var(--text);
}

.stage-count {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.step-list {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.step {
  display: grid;
  grid-template-columns: 28px 1fr 40px;
  gap: 6px;
  align-items: center;
  padding: 4px 2px;
  border-radius: 6px;
}

.step:hover {
  background: var(--surface-strong);
}

.step-checkbox {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.step-text {
  min-width: 0;
  padding: 6px 4px;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.45;
}

.step-text.done {
  color: var(--muted);
  text-decoration: line-through;
}

.step--checkable:hover {
  background: var(--surface-strong);
}

.step-text-btn {
  min-height: 36px;
  padding: 6px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  word-break: break-word;
}

.step-text-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: transparent;
}

.step-text-btn.done {
  color: var(--muted);
  text-decoration: line-through;
}

.step-edit-inline {
  min-width: 0;
}

.step-edit-inline input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.step-edit-inline input:focus {
  outline: none;
}

.add-inline-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.add-inline-button:hover,
.add-inline-button:active {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: none;
}

.add-step-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.add-step-form input {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.add-step-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.add-stage-block {
  margin-bottom: 8px;
  padding: 0 2px;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 24px, 1080px);
    padding-top: 16px;
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }

  h1 {
    font-size: 22px;
  }

  .status-head {
    align-items: flex-start;
  }

  .progress-count {
    text-align: right;
  }

  .project-edit-bar {
    justify-content: flex-start;
  }

  .stage-header-top .card-actions--compact {
    min-height: 72px;
  }

  .dropdown-menu {
    right: 0;
    left: auto;
  }

  .inline-title-edit {
    flex-wrap: wrap;
  }

  .inline-title-edit input {
    flex: 1 1 100%;
  }

  .inline-edit-btn {
    flex: 1;
    min-width: 0;
  }
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.help-overlay[hidden] {
  display: none !important;
}

.help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
}

.help-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 560px);
  max-height: min(88vh, 720px);
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.help-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.help-panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  padding-right: 8px;
}

.help-close-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.help-close-icon:hover,
.help-close-icon:active {
  color: var(--text);
  background: var(--surface-strong);
  border: none;
}

.help-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.help-panel-body h3 {
  margin: 20px 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.help-panel-body h3:first-of-type {
  margin-top: 4px;
}

.help-panel-body p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.help-lead {
  font-size: 15px;
}

.help-panel-body .help-highlight {
  margin: 16px -16px;
  padding: 12px 16px;
  background: var(--highlight-bg);
  border: none;
  border-radius: 0;
  color: var(--text);
  line-height: 1.7;
}

.help-panel-body p.help-highlight {
  margin: 16px -16px;
}

.help-panel-body .help-highlight h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.help-panel-body .help-highlight p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.help-panel-body .help-highlight p:last-child {
  margin-bottom: 0;
}

.help-panel-body ul {
  margin: 0 0 12px;
  padding-left: 1.25em;
  font-size: 14px;
  line-height: 1.6;
}

.help-panel-body li {
  margin-bottom: 6px;
}

.help-panel-body li:last-child {
  margin-bottom: 0;
}

.help-panel-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-strong);
  font-size: 13px;
}

.help-panel-foot {
  flex-shrink: 0;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.help-close-btn {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 14px;
}

.help-close-btn:hover {
  border-color: var(--accent);
}

body.help-open,
body.settings-open {
  overflow: hidden;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.settings-overlay[hidden] {
  display: none !important;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
}

.settings-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 420px);
  max-height: min(70vh, 480px);
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.settings-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.settings-panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}

.settings-close-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.settings-close-icon:hover,
.settings-close-icon:active {
  color: var(--text);
  background: var(--surface-strong);
  border: none;
}

.settings-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  overflow-y: auto;
}

.settings-menu-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 15px;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.settings-menu-item:hover,
.settings-menu-item:active {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-strong));
}

.settings-menu-item-danger {
  color: var(--muted);
}

.settings-menu-item-danger:hover,
.settings-menu-item-danger:active {
  color: var(--text);
}

.settings-panel-foot {
  flex-shrink: 0;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
}

.settings-close-btn {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 14px;
}

.settings-close-btn:hover {
  border-color: var(--accent);
}

@media (min-width: 600px) {
  .settings-overlay {
    align-items: center;
    padding: 24px 16px;
  }

  .settings-panel {
    border-radius: 12px;
  }
}

.safe-mode-view {
  padding-bottom: 24px;
}

.safe-mode-header {
  margin-bottom: 16px;
}

.safe-mode-header h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.safe-mode-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.safe-mode-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.safe-mode-actions .settings-menu-item {
  width: 100%;
  text-align: left;
}

.safe-exit-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 4px;
  border-radius: 8px;
  color: var(--accent-strong);
  font-size: 15px;
  text-decoration: none;
  touch-action: manipulation;
}

.safe-exit-link:hover {
  background: var(--surface-strong);
}

.safe-project-summary {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  list-style: none;
}

.safe-project-summary li {
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.5;
  border-bottom: 1px solid var(--line);
}

.safe-project-summary li:last-child {
  border-bottom: 0;
}

body.safe-mode-active .app:has(#projectView:not([hidden])) {
  padding-top: 12px;
}

@media (min-width: 600px) {
  .help-overlay {
    align-items: center;
    padding: 24px 16px;
  }

  .help-panel {
    max-height: min(85vh, 680px);
    border-radius: 12px;
  }
}

