.traffic-choice {
  --traffic-ink: #39362f;
  --traffic-muted: #5f5a50;
  --traffic-rule: #d7cfc2;
  box-sizing: border-box;
  position: fixed;
  z-index: 40;
  left: max(20px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  width: min(21rem, calc(100vw - 40px));
  max-height: calc(100dvh - 32px);
  padding: 12px 17px 2px;
  border: 1px solid #c8bfb1;
  border-radius: 6px;
  background: #f9f6ef;
  box-shadow: 0 6px 28px #302b221b;
  color: var(--traffic-ink);
  color-scheme: light;
  text-align: left;
  font: 400 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: normal;
}
.traffic-choice *, .traffic-choice *::before, .traffic-choice *::after { box-sizing: border-box; }
.traffic-choice .traffic-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; }
.traffic-choice .traffic-title { margin: 0; color: var(--traffic-ink); font: 400 23px/1.15 Ivar, Georgia, serif; letter-spacing: -.025em; text-transform: none; }
.traffic-choice .traffic-close {
  position: relative; flex: none; width: 44px; height: 44px; margin: -6px -12px -4px 0;
  border: 0; padding: 0; background: transparent; color: var(--traffic-muted); cursor: pointer;
}
.traffic-close::before, .traffic-close::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 1.5px;
  background: currentColor; transform: translate(-50%, -50%) rotate(45deg);
}
.traffic-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.traffic-choice .traffic-reading {
  min-height: 0; max-height: min(35dvh, 12rem); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; padding: 2px 0 5px;
}
.traffic-choice .traffic-reading p { display: block; margin: 0; color: var(--traffic-muted); font: inherit; letter-spacing: normal; }
.traffic-choice .traffic-reading .traffic-note { font-size: .8125rem; line-height: 1.4; }
.traffic-choice .traffic-details { margin: 0; padding: 0; border: 0; background: transparent; }
.traffic-choice .traffic-details summary {
  display: list-item; width: fit-content; margin: 0; padding: 4px 0 2px;
  color: var(--traffic-ink); font: 400 .75rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer;
}
.traffic-choice .traffic-details p { margin: 4px 0; font-size: 13px; }
.traffic-choice .traffic-details a { display: inline-block; margin-bottom: 6px; color: var(--traffic-ink); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.traffic-choice .traffic-setting {
  position: relative; display: flex; flex: none; align-items: center; gap: 8px; min-height: 45px;
  margin: 0; padding: 0; border-top: 1px solid var(--traffic-rule); color: var(--traffic-ink);
  font: 500 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer;
}
.traffic-setting input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit;
}
.traffic-setting .traffic-state { margin-left: auto; color: var(--traffic-muted); font-size: 12px; }
.traffic-track { position: relative; width: 36px; height: 22px; border: 1px solid #847d70; border-radius: 20px; background: #e4ded3; }
.traffic-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px;
  border-radius: 50%; background: #6d665a; transition: transform 140ms ease;
}
.traffic-setting input:checked ~ .traffic-track { background: #414a3c; border-color: #414a3c; }
.traffic-setting input:checked ~ .traffic-track::after { background: #faf7ef; transform: translateX(14px); }
.traffic-choice :focus-visible, .traffic-setting input:focus-visible ~ .traffic-track { outline: 2px solid #695238; outline-offset: 2px; }
.traffic-setting:has(input:disabled) { cursor: default; }
#signals .traffic-choice { position: static; max-height: none; margin: 16px 0 0; width: min(100%, 29rem); box-shadow: none; }
#signals .traffic-reading { max-height: none; }
.traffic-choice[inert] { visibility: hidden; }
@media (max-width: 1000px) {
  .traffic-choice[role="dialog"] {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 14px;
    width: min(calc(100% - 32px), 42rem);
    max-height: none;
    margin: 12px auto;
    padding: 6px 14px 5px;
    box-shadow: none;
  }
  .traffic-choice[role="dialog"] .traffic-head { grid-column: 1 / -1; }
  .traffic-choice[role="dialog"] .traffic-title { font-size: 20px; }
  .traffic-choice[role="dialog"] .traffic-reading { max-height: none; overflow: visible; }
  .traffic-choice[role="dialog"] .traffic-details summary { min-height: 24px; }
  .traffic-choice[role="dialog"] .traffic-setting { align-self: start; gap: 6px; border: 0; font-size: 13px; }
  .traffic-choice[role="dialog"] .traffic-state { display: none; }
  .traffic-choice[role="dialog"]:has(details[open]) .traffic-reading { grid-column: 1 / -1; }
  .traffic-choice[role="dialog"]:has(details[open]) .traffic-setting { grid-column: 1 / -1; border-top: 1px solid var(--traffic-rule); }
  .traffic-choice[role="dialog"]:has(details[open]) .traffic-track { margin-left: auto; }
  .traffic-choice[role="dialog"][inert] { visibility: visible; }
  .traffic-choice[role="dialog"][inert] :is(.traffic-close, .traffic-details, .traffic-setting) { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .traffic-track::after { transition: none; }
}
@media (forced-colors: active) {
  .traffic-close::before, .traffic-close::after, .traffic-track::after { background: ButtonText; }
  .traffic-setting input:checked ~ .traffic-track::after { background: Highlight; }
}
