#sheet:has(.theme-picker) {
  --sheet-bg: var(--words, var(--surface));
  --sheet-ink: var(--room, var(--ink));
  border: 0;
  border-radius: 12px;
  background: var(--sheet-bg);
  color: var(--sheet-ink);
  box-shadow: 0 10px 32px #19192238;
}

#sheet:has(.theme-picker) .sheet-head {
  border-color: color-mix(in srgb, var(--sheet-ink) 16%, transparent);
  background: var(--sheet-bg);
}

#sheet:has(.theme-picker) .sheet-head h2 { text-transform: lowercase; }
#sheet:has(.theme-picker) .round-close { min-width: 44px; min-height: 44px; background: transparent; color: inherit; border-color: currentColor; }
#sheet:has(.theme-picker) .feedback-link { display: inline-flex; align-items: center; min-height: 44px; }

.theme-options {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.theme-options legend {
  padding: 0;
  margin: 0 0 10px;
  font: 700 .8rem/1.4 var(--mono, monospace);
}

.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(4px, 1.35vw, 10px); }

.theme-option {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 4px 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.theme-option:has(input:checked) {
  box-shadow: inset 0 0 0 2px var(--sheet-ink);
}

.theme-option input {
  position: absolute;
  z-index: 1;
  top: 10px;
  right: 10px;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--sheet-bg);
  color-scheme: dark;
  cursor: pointer;
}

.theme-option:has(input:focus-visible) {
  outline: 2px solid var(--sheet-ink);
  outline-offset: 2px;
}

.theme-swatch {
  display: flex;
  align-items: flex-end;
  min-height: clamp(68px, 16vw, 91px);
  padding: 7px;
  border-radius: 5px;
  color: var(--preview-room);
  background: var(--preview-room);
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px 5px;
  border-radius: 2px;
  background: var(--preview-action);
  font: 900 18px/1 var(--display, sans-serif);
}

.theme-chip::before {
  content: '';
  width: 0;
  height: 0;
  border-block: 4px solid transparent;
  border-left: 6px solid currentColor;
}

.swatch-newsprint { --preview-room: #191922; --preview-action: #dbff46; }
.swatch-night { --preview-room: #171625; --preview-action: #d8d0ff; }
.swatch-bubblegum { --preview-room: #3f173a; --preview-action: #ffdf83; }

.theme-name, .theme-tier { padding-inline: 3px; }
.theme-name { margin-top: 3px; font: 900 clamp(18px, 4.4vw, 23px)/1.05 var(--display, sans-serif); overflow-wrap: anywhere; }
.theme-tier { font: 700 10px/1.35 var(--mono, monospace); }
@media (max-width: 359px) {
  .theme-name { padding-inline: 0; font-size: 16px; }
}

.theme-pack {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--sheet-ink) 20%, transparent);
}

.theme-pack h3 { margin: 0 0 4px; font: 900 25px/1 var(--display, sans-serif); }
.theme-description, .theme-status { margin: 0; font: 400 .94rem/1.45 var(--sans, system-ui), sans-serif; }
.theme-status:not(:empty) { margin-top: 10px; }

.theme-picker .theme-action, .theme-picker .theme-retry { min-height: 44px; font: 700 .9rem/1.2 var(--sans, system-ui), sans-serif; cursor: pointer; }
.theme-picker .theme-action {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--sheet-ink);
  color: var(--sheet-bg);
}
.theme-picker .theme-action:disabled {
  border-color: color-mix(in srgb, var(--sheet-ink) 28%, transparent);
  background: transparent;
  color: var(--sheet-ink);
  cursor: default;
}

.theme-retry {
  padding: 3px 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.theme-retry[hidden] { display: none; }
@media (forced-colors: active) {
  .theme-option:has(input:checked), .theme-chip { outline: 1px solid CanvasText; }
}
