/* App-Modus (Android): Einstellungsblatt statt Header-Schalter. */
.is-app {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
.is-app .header-controls {
  display: none;
}

.settings-button {
  display: grid;
  justify-self: end;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.settings-button[hidden] {
  display: none;
}
.settings-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.settings-button:hover,
.settings-button:focus-visible {
  color: var(--green);
}

.settings-sheet {
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  margin: auto auto 0;
  padding: 20px 20px 28px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}
.settings-sheet::backdrop {
  background: rgb(0 0 0 / 0.55);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.settings-head h2 {
  margin: 0;
  font-size: 22px;
}
.settings-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.settings-close:hover,
.settings-close:focus-visible {
  color: var(--text);
}

.settings-group {
  display: block;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.settings-group h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.settings-segments {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.settings-segments button {
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: 14px "IBM Plex Sans", sans-serif;
  cursor: pointer;
}
.settings-segments button:hover {
  color: var(--text);
}
.settings-segments button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.settings-segments button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}
.settings-toggle span {
  display: grid;
  gap: 4px;
}
.settings-toggle b {
  font-size: 15px;
  font-weight: 600;
}
.settings-toggle small {
  color: var(--muted);
  font-size: 13px;
}
.settings-toggle input {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  transition: background-color 0.2s;
  cursor: pointer;
  appearance: none;
}
.settings-toggle input::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 0.2s, background-color 0.2s;
}
.settings-toggle input:checked {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 35%, var(--surface));
}
.settings-toggle input:checked::after {
  background: var(--green);
  transform: translateX(20px);
}
.settings-toggle input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.settings-toggle input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.settings-links {
  display: flex;
  gap: 20px;
  padding-top: 16px;
  font-size: 14px;
}
.settings-links a {
  color: var(--muted);
}
.settings-links a:hover {
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .settings-toggle input,
  .settings-toggle input::after {
    transition: none;
  }
}
