:root,
[data-theme="forest"] {
  --q-border: #bdcbc2;
  --q-surface: #f7f9f6;
  --q-selected: #e9f0e7;
  --q-hover: #eef3ec;
  --q-placeholder: #738078;
  --q-key-border: #aabfb0;
  --q-button-text: #fff;
  --q-focus: #9b681b;
}
[data-theme="ocean"] {
  --paper: #fff;
  --canvas: #f4f7fa;
  --ink: #18334e;
  --forest: #245e91;
  --muted: #596e81;
  --line: #dbe4ec;
  --mint: #e8f1f8;
  --q-border: #aebfce;
  --q-surface: #f1f6f9;
  --q-selected: #dfeefa;
  --q-hover: #e8f1f8;
  --q-placeholder: #647b90;
  --q-key-border: #a3bacd;
  --q-button-text: #fff;
  --q-focus: #245e91;
}
[data-theme="iris"] {
  --paper: #fff;
  --canvas: #f8f6fb;
  --ink: #3b3059;
  --forest: #6849a1;
  --muted: #716580;
  --line: #e3dcec;
  --mint: #eee7f8;
  --q-border: #c2b3d5;
  --q-surface: #f7f4fa;
  --q-selected: #eee7f8;
  --q-hover: #f1ecf8;
  --q-placeholder: #82738f;
  --q-key-border: #b7a5cf;
  --q-button-text: #fff;
  --q-focus: #6849a1;
}
[data-theme="midnight"] {
  --paper: #172620;
  --canvas: #172620;
  --ink: #eff5ef;
  --forest: #c4db8e;
  --muted: #b1c1b4;
  --line: #405347;
  --mint: #304c37;
  --lilac: #354736;
  --q-border: #668072;
  --q-surface: #22382c;
  --q-selected: #304c37;
  --q-hover: #2d4435;
  --q-placeholder: #a4b7a9;
  --q-key-border: #6d8576;
  --q-button-text: #172620;
  --q-focus: #c4db8e;
  --error: #ffb8b8;
  color-scheme: dark;
}
/* Theme values are chosen from this fixed set; no arbitrary CSS is accepted. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  border: 0;
  padding: 0;
  margin: 24px 0;
  min-width: 0;
}
.theme-grid legend {
  font-size: 14px;
  margin-bottom: 14px;
}
.theme-choice {
  position: relative;
  display: block;
  cursor: pointer;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
/* Selected and focus states work without :has() (Chrome 105); workspace.js
   sets is-checked. The :has() rules are extras. Keep them as separate rules:
   a browser without :has() drops any rule that uses it. */
.theme-choice.is-checked {
  border-color: #254e42;
  box-shadow: 0 0 0 1px #254e42;
}
/* Enhancement: the same selected state before workspace.js runs. */
.theme-choice:has(input:checked) {
  border-color: #254e42;
  box-shadow: 0 0 0 1px #254e42;
}
.theme-choice:focus-within {
  outline: 3px solid #ad7b20;
  outline-offset: 3px;
}
/* Enhancement: where :has() works, a click shows no ring; the keyboard
   still does. */
.theme-choice:has(input:focus:not(:focus-visible)) {
  outline: none;
}
.theme-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.theme-swatch {
  background: var(--paper);
  border: 1px solid var(--q-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 70px;
  padding: 14px;
  color: var(--ink);
}
.theme-swatch b {
  font-size: 24px;
  font-weight: 550;
}
.theme-swatch i {
  display: block;
  width: 20px;
  height: 20px;
  background: var(--forest);
  border-radius: 50%;
  margin-left: auto;
}
.theme-choice > span:last-child {
  display: block;
  font-size: 13px;
  padding: 10px 5px 4px;
}
.theme-preview {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
.theme-preview > p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 25px;
}
.theme-preview h3 {
  font-size: 30px;
  font-weight: 500;
  margin: 0 0 26px;
}
.theme-preview-rating {
  display: flex;
  gap: 8px;
}
.theme-preview-rating span {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 6px;
  color: var(--forest);
  background: var(--q-surface);
  border: 1px solid var(--q-border);
}
.theme-preview-rating span:last-child {
  background: var(--q-selected);
  border-color: var(--forest);
}
.theme-preview > strong {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 18px;
  border-radius: 6px;
  background: var(--forest);
  color: var(--q-button-text);
  font-size: 14px;
}
@media (max-width: 700px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .theme-preview {
    padding: 23px;
  }
  .theme-preview h3 {
    font-size: 25px;
  }
}
