/* Theme studio panel. Deliberately independent of the site theme so it stays readable in every style. */
.mw-sw { --mw-bg: rgba(16, 18, 26, .94); --mw-fg: #eef1f7; --mw-muted: #a8b0c2; --mw-line: rgba(255, 255, 255, .12); --mw-hi: #7cc4ff; --mw-chip: rgba(255, 255, 255, .06);
  position: fixed; right: 18px; bottom: 18px; z-index: 2000; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--mw-fg); text-shadow: none; letter-spacing: normal; text-transform: none; }
.mw-sw *, .mw-compare * { box-sizing: border-box; text-shadow: none; }
.mw-sw button, .mw-sw select, .mw-sw input, .mw-sw textarea, .mw-compare button, .mw-compare select { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.mw-sw button::before, .mw-sw button::after, .mw-compare button::before, .mw-compare button::after { content: none !important; }
.mw-sw :focus-visible, .mw-compare :focus-visible { outline: 2px solid var(--mw-hi, #7cc4ff); outline-offset: 2px; }
.mw-fab { display: inline-flex; align-items: center; gap: 8px; height: 50px; padding: 0 18px 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); background: linear-gradient(135deg, #1b1f2c, #10121a); color: #fff; cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12); font-weight: 650; float: right; }
.mw-fab svg { width: 22px; height: 22px; }
.mw-fab:hover { background: linear-gradient(135deg, #252a3b, #151823); }
.mw-sw[data-open="true"] .mw-fab span { display: none; }
.mw-sw[data-open="true"] .mw-fab { padding: 0 14px; }
.mw-panel { position: absolute; right: 0; bottom: 62px; width: min(420px, calc(100vw - 24px)); max-height: min(78vh, 860px); display: flex; flex-direction: column; background: var(--mw-bg); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--mw-line); border-radius: 18px; box-shadow: 0 24px 70px rgba(0, 0, 0, .5); overflow: hidden; animation: mw-in .22s cubic-bezier(.2, .7, .2, 1); }
.mw-panel[hidden] { display: none; }
@keyframes mw-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.mw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 14px 8px 16px; }
.mw-head h2 { font: 700 16px/1.2 system-ui, sans-serif; margin: 0; color: #fff; letter-spacing: 0; }
.mw-head h2::before { content: none !important; }
.mw-current { margin: 2px 0 0; color: var(--mw-muted); font-size: 12.5px; }
.mw-head-actions { display: flex; gap: 4px; }
.mw-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--mw-line); background: var(--mw-chip); cursor: pointer; padding: 0; color: var(--mw-fg); }
.mw-icon svg { width: 17px; height: 17px; }
.mw-icon:hover { background: rgba(255, 255, 255, .12); }
.mw-icon:disabled { opacity: .4; cursor: default; }
.mw-tabs { display: flex; gap: 4px; margin: 0 14px; padding: 4px; background: rgba(255, 255, 255, .05); border-radius: 12px; }
.mw-tabs [role="tab"] { flex: 1; border: 0; background: transparent; padding: 7px 8px; border-radius: 9px; cursor: pointer; color: var(--mw-muted); font-weight: 600; }
.mw-tabs [role="tab"][aria-selected="true"] { background: rgba(255, 255, 255, .12); color: #fff; }
.mw-pane { overflow: auto; padding: 10px 14px 16px; overscroll-behavior: contain; }
.mw-pane[hidden] { display: none; }
.mw-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mw-actions { margin: 8px 0; }
.mw-note { color: var(--mw-muted); font-size: 12.5px; margin: 6px 0; }
.mw-h { font: 700 12px/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--mw-muted); margin: 16px 0 4px; }
.mw-h::before { content: none !important; }
.mw-h4 { font: 600 13px/1.2 system-ui, sans-serif; margin: 12px 0 6px; color: #fff; }
.mw-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--mw-line); background: var(--mw-chip); color: var(--mw-fg); cursor: pointer; font-weight: 600; font-size: 13px; }
.mw-btn svg { width: 16px; height: 16px; }
.mw-btn:hover { background: rgba(255, 255, 255, .12); }
.mw-btn-primary { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.mw-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: rgba(255, 255, 255, .05); border: 1px solid var(--mw-line); border-radius: 10px; }
.mw-seg button { border: 0; background: transparent; color: var(--mw-muted); padding: 5px 10px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.mw-seg button[aria-pressed="true"] { background: #fff; color: #10121a; }
.mw-tag { color: var(--mw-fg); }
.mw-styles { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.mw-styles li { display: grid; gap: 4px; }
.mw-style { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 6px; border-radius: 12px; border: 1px solid var(--mw-line); background: var(--mw-chip); cursor: pointer; }
.mw-style:hover { background: rgba(255, 255, 255, .1); }
.mw-style[aria-pressed="true"] { border-color: var(--mw-hi); box-shadow: 0 0 0 1px var(--mw-hi) inset; background: rgba(124, 196, 255, .1); }
.mw-style-text { display: grid; min-width: 0; }
.mw-style-text b { font-weight: 650; color: #fff; }
.mw-style-text small { color: var(--mw-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-mini { position: relative; flex: none; width: 74px; height: 50px; border-radius: 9px; overflow: hidden; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .1); }
.mw-mini-card { width: 54px; height: 32px; display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.mw-mini-card b { font-size: 14px; line-height: 1; }
.mw-mini-btn { width: 16px; height: 9px; display: block; }
.mw-mini-tex { position: absolute; inset: 0; pointer-events: none; }
.mw-pair { justify-self: start; display: inline-flex; align-items: center; gap: 6px; margin-left: 84px; padding: 3px 9px 3px 5px; border-radius: 999px; border: 1px dashed var(--mw-line); background: transparent; color: var(--mw-muted); cursor: pointer; font-size: 12px; }
.mw-pair:hover { color: #fff; border-style: solid; }
.mw-pair-dots { display: inline-flex; }
.mw-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255, 255, 255, .35); }
.mw-dot + .mw-dot { margin-left: -4px; }
.mw-palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-top: 6px; }
.mw-pal { display: grid; gap: 3px; text-align: left; padding: 6px; border-radius: 10px; border: 1px solid var(--mw-line); background: var(--mw-chip); cursor: pointer; }
.mw-pal:hover { background: rgba(255, 255, 255, .1); }
.mw-pal[aria-pressed="true"] { border-color: var(--mw-hi); box-shadow: 0 0 0 1px var(--mw-hi) inset; }
.mw-strip { display: flex; height: 22px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); }
.mw-strip i { flex: 1; }
.mw-strip-style { display: grid; place-items: center; font-style: normal; font-weight: 700; background: repeating-linear-gradient(45deg, #2a2f40 0 6px, #1d2130 6px 12px); color: #fff; font-size: 11px; }
.mw-pal-name { font-size: 12px; font-weight: 600; color: #fff; line-height: 1.2; }
.mw-pal-mode { font-size: 10.5px; color: var(--mw-muted); text-transform: uppercase; letter-spacing: .06em; }
.mw-sec { border: 1px solid var(--mw-line); border-radius: 12px; margin: 8px 0; background: rgba(255, 255, 255, .025); }
.mw-sec summary { cursor: pointer; padding: 10px 12px; font-weight: 650; color: #fff; list-style: none; display: flex; justify-content: space-between; }
.mw-sec summary::-webkit-details-marker { display: none; }
.mw-sec summary::after { content: "+"; color: var(--mw-muted); }
.mw-sec[open] summary::after { content: "\2212"; }
.mw-sec-body { padding: 0 12px 12px; display: grid; gap: 10px; }
.mw-field { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.mw-field > label, .mw-label { font-size: 12.5px; color: var(--mw-muted); font-weight: 600; }
.mw-field > select, .mw-field > input[type="range"], .mw-field > textarea, .mw-field > .mw-seg { grid-column: 1 / -1; }
.mw-field > select, .mw-import, .mw-hex, .mw-num { width: 100%; background: rgba(0, 0, 0, .35); border: 1px solid var(--mw-line); border-radius: 8px; padding: 6px 8px; color: var(--mw-fg); }
.mw-field > select option { background: #1b1f2c; color: #fff; }
.mw-num { width: 84px; grid-column: 1 / -1; }
.mw-out { font: 600 12px/1 ui-monospace, monospace; color: #fff; justify-self: end; }
.mw-field input[type="range"] { width: 100%; accent-color: var(--mw-hi); }
.mw-switch { grid-template-columns: 1fr auto; }
.mw-switch input { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: rgba(255, 255, 255, .15); position: relative; cursor: pointer; margin: 0; transition: background .2s; }
.mw-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.mw-switch input:checked { background: #3b82f6; }
.mw-switch input:checked::after { transform: translateX(18px); }
.mw-color { display: grid; grid-template-columns: 1fr 36px 84px 24px; gap: 6px; align-items: center; }
.mw-color label { font-size: 12.5px; color: var(--mw-muted); font-weight: 600; }
.mw-color.is-over label::after { content: " edited"; color: var(--mw-hi); font-weight: 500; }
.mw-color input[type="color"] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--mw-line); border-radius: 8px; background: none; cursor: pointer; }
.mw-hex { font: 12px ui-monospace, monospace; padding: 5px 6px; }
.mw-mini-btn-x { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--mw-line); background: transparent; color: var(--mw-muted); cursor: pointer; padding: 0; }
.mw-contrast { display: grid; gap: 4px; }
.mw-cr { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 8px; align-items: center; font-size: 12px; padding: 4px; border-radius: 8px; }
.mw-cr.is-fail { background: rgba(248, 113, 113, .14); outline: 1px solid rgba(248, 113, 113, .5); }
.mw-cr-sample { width: 30px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-weight: 700; font-size: 11px; border: 1px solid rgba(255, 255, 255, .15); }
.mw-cr-label { display: grid; color: var(--mw-fg); }
.mw-cr-label small { color: var(--mw-muted); font-size: 10.5px; }
.mw-cr b { font: 600 11.5px ui-monospace, monospace; }
.mw-grade { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 999px; background: rgba(255, 255, 255, .1); white-space: nowrap; }
.mw-grade.g-AAA, .mw-grade.g-AA { background: rgba(74, 222, 128, .18); color: #86efac; }
.mw-grade.g-AAlarge { background: rgba(251, 191, 36, .18); color: #fcd34d; }
.mw-grade.g-Fail { background: rgba(248, 113, 113, .2); color: #fca5a5; }
.mw-cr.is-fail .mw-grade { background: rgba(248, 113, 113, .25); color: #fecaca; }
.mw-code { margin: 8px 0; max-height: 330px; overflow: auto; padding: 10px 12px; border-radius: 10px; background: #0a0c12; border: 1px solid var(--mw-line); font: 11.5px/1.5 ui-monospace, "JetBrains Mono", monospace; color: #d6e2ff; white-space: pre; }
.mw-code code { font: inherit; color: inherit; }
.mw-fmt { margin-top: 4px; }
.mw-import { font: 11.5px ui-monospace, monospace; resize: vertical; }
.mw-file { font-size: 12px; color: var(--mw-muted); max-width: 210px; }
/* save and share */
.mw-name { font: 13px system-ui, sans-serif; padding: 8px 10px; grid-column: 1 / -1; }
.mw-share { flex-wrap: nowrap; }
.mw-share .mw-hex { flex: 1; min-width: 0; }
.mw-saved { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.mw-saved-item { width: 100%; height: auto; min-height: 40px; padding: 6px 10px; display: grid; justify-items: start; text-align: left; gap: 0; }
.mw-saved-item b { color: #fff; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mw-saved-item small { color: var(--mw-muted); font-weight: 500; font-size: 11.5px; }

/* tablet: keep the floating card but never taller than the screen */
@media (max-width: 1024px) { .mw-panel { max-height: min(80vh, 80dvh, 860px); } }

/* touch devices and small screens: 44px targets */
@media (max-width: 640px), (pointer: coarse), (hover: none) {
  .mw-icon { width: 44px; height: 44px; }
  .mw-btn { min-height: 44px; height: auto; padding: 0 14px; }
  .mw-tabs [role="tab"] { min-height: 44px; }
  .mw-seg button { min-height: 44px; min-width: 44px; padding: 0 12px; }
  .mw-style { min-height: 58px; }
  .mw-pal { min-height: 64px; }
  .mw-pair { min-height: 44px; padding: 6px 12px 6px 8px; }
  .mw-sec summary { min-height: 44px; align-items: center; }
  .mw-field > select, .mw-hex, .mw-num, .mw-import, .mw-name { min-height: 44px; font-size: 16px; }
  .mw-field input[type="range"] { height: 44px; }
  .mw-switch input { width: 52px; height: 30px; }
  .mw-switch input::after { width: 24px; height: 24px; }
  .mw-switch input:checked::after { transform: translateX(22px); }
  .mw-color { grid-template-columns: 1fr 44px 96px 44px; }
  .mw-color input[type="color"] { width: 44px; height: 44px; }
  .mw-mini-btn-x { width: 44px; height: 44px; }
  .mw-file { min-height: 44px; }
  .mw-fab { height: 52px; }
}

/* phones: the studio becomes a full width bottom sheet */
@media (max-width: 640px) {
  .mw-sw { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .mw-sw[data-open="true"] .mw-fab { display: none; }
  .mw-panel { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; max-height: min(88vh, 88dvh); border-radius: 20px 20px 0 0; border-left: 0; border-right: 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); animation: mw-sheet .26s cubic-bezier(.2, .7, .2, 1); }
  .mw-panel::before { content: ""; display: block; flex: none; width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28); margin: 8px auto 0; }
  .mw-head { padding-top: 8px; }
  .mw-tabs { margin: 0 12px; }
  .mw-pane { padding: 10px 12px 20px; }
  .mw-palettes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mw-pair { margin-left: 0; }
  html.mw-sheet-open, html.mw-sheet-open body { overflow: hidden; }
}
@keyframes mw-sheet { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .mw-panel { animation: none; } }

/* compare mode */
.mw-compare { position: fixed; inset: 0; z-index: 3000; background: #0b0d13; display: flex; flex-direction: column; font: 14px/1.4 system-ui, sans-serif; color: #eef1f7; }
.mw-compare[hidden] { display: none; }
.mw-cmp-bar { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, .12); flex-wrap: wrap; }
.mw-cmp-side { flex: 1; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: min(280px, 100%); }
.mw-cmp-side b { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: #fff; color: #10121a; }
.mw-cmp-side select { background: #161a24; color: #fff; border: 1px solid rgba(255, 255, 255, .15); border-radius: 8px; padding: 6px 8px; }
.mw-compare .mw-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .06); color: #fff; cursor: pointer; font-weight: 600; }
.mw-compare .mw-btn-primary { background: #3b82f6; border-color: #3b82f6; }
.mw-compare .mw-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .06); color: #fff; cursor: pointer; }
.mw-compare .mw-icon svg { width: 18px; }
.mw-cmp-frames { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: rgba(255, 255, 255, .12); min-height: 0; }
.mw-cmp-pane { background: #000; min-height: 0; }
.mw-cmp-pane iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
@media (max-width: 800px) { .mw-cmp-frames { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } }
html.mw-comparing body { overflow: hidden; }
html.mw-comparing .mw-sw { display: none; }
