.controller-studio {
  --cs-ui-bg: #f4f1e8;
  --cs-ui-ink: #304037;
  --cs-ui-muted: #7b8376;
  --cs-ui-line: #d5d8cb;
  --cs-ui-accent: #647a54;
  color: var(--cs-ui-ink);
  background: var(--cs-ui-bg);
  border: 1px solid #cbd0c0;
  border-radius: 22px;
  padding: 22px;
  margin: 0 0 24px;
  font: 13px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: left;
  color-scheme: light;
  overflow: clip;
}
.controller-studio *, .controller-studio *::before, .controller-studio *::after { box-sizing: border-box; }
.controller-studio button, .controller-studio input, .controller-studio select { font: inherit; letter-spacing: 0; }
.controller-studio button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.controller-studio button:focus-visible, .controller-studio input:focus-visible, .controller-studio select:focus-visible, .controller-studio summary:focus-visible {
  outline: 3px solid #9baf77; outline-offset: 3px;
}
.cs-header { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.cs-eyebrow { color: #8b927f; font-size: 8px; font-weight: 750; letter-spacing: .16em; }
.controller-studio h3 { font-size: clamp(21px, 5vw, 29px); font-weight: 650; letter-spacing: -.055em; line-height: 1.15; margin: 4px 0 0; color: var(--cs-ui-ink); }
.cs-saved-pill { border: 1px solid #d1dac4; color: #61764e; background: #e9eedf; border-radius: 30px; padding: 5px 9px; white-space: nowrap; font-size: 8px; }
.cs-context { font-size: 10px; color: var(--cs-ui-muted); margin: 8px 0 20px; }
.cs-preview { height: 258px; max-width: 350px; width: 100%; margin: 0 auto 13px; position: relative; border-radius: 30px 30px 56px 30px;
  background: var(--cs-shell); background-size: cover; background-position: center; border: 1px solid var(--cs-edge); color: var(--cs-ink);
  box-shadow: inset 0 2px 1px #ffffff80, inset 0 -8px 0 #00000010, 0 13px 24px -15px #29342c60; transition: background-color .18s; }
.cs-preview::after { content: ''; position: absolute; right: 23px; bottom: 22px; width: 35px; height: 24px; opacity: .3; transform: rotate(-22deg);
  background: repeating-linear-gradient(90deg, transparent 0 5px, var(--cs-ink) 5px 7px); pointer-events: none; border-radius: 5px; }
.cs-preview[data-finish="glass"] { box-shadow: inset 0 0 0 5px #ffffff20, inset 0 12px 16px #ffffff30, inset 0 -8px 0 #00000015, 0 13px 24px -15px #29342c60; }
.cs-preview[data-finish="metal"] { background-image: linear-gradient(115deg, #ffffff20, transparent 35%, #00000010 70%, #ffffff18); }
.cs-preview[data-finish="gloss"]::before { content: ''; position: absolute; inset: 0 0 60%; border-radius: 30px 30px 80% 0; background: linear-gradient(#ffffff55, #ffffff05); pointer-events: none; }
.cs-preview-screen { height: 95px; width: 68%; position: absolute; left: 16%; top: 23px; background: #27352f; border: 8px solid var(--cs-panel); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 2px #0c181f40; color: #dbe6c7; }
.cs-preview-screen > span { font-size: 13px; letter-spacing: .22em; font-weight: 650; }
.cs-preview-screen small { font-size: 6px; color: #a9ba95; margin-top: 6px; letter-spacing: .09em; }
.cs-preview-control { position: absolute; margin: 0; padding: 0 4px; border: 1px solid #ffffff15; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0;
  background: var(--cs-faceA); color: var(--cs-ink); font-weight: 750; box-shadow: inset 0 2px #ffffff30, 0 3px 0 #00000025; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-preview-control[data-shape="circle"] { border-radius: 50%; }
.cs-preview-control[data-shape="rounded"] { border-radius: 12px; }
.cs-preview-control[data-shape="pill"] { border-radius: 50px; }
.cs-preview-control[data-shape="diamond"] { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.cs-preview-control[data-shape="hex"] { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.cs-preview-control.selected { outline: 2px solid var(--cs-accent); outline-offset: 5px; }
.cs-preview-control.cs-hidden { opacity: .22 !important; border-style: dashed; }
.cs-preview-a { width: 45px; height: 45px; right: 22px; top: 143px; font-size: 14px; }
.cs-preview-b { width: 45px; height: 45px; right: 76px; top: 169px; background: var(--cs-faceB); font-size: 14px; }
.cs-preview-dpad { width: 64px; height: 64px; left: 26px; top: 144px; font-size: 44px; line-height: 1; background: var(--cs-dpad); color: var(--cs-shell); }
.cs-preview-l, .cs-preview-r { height: 13px; width: 35px; top: 4px; font-size: 7px; box-shadow: none; }
.cs-preview-l { left: 28px; } .cs-preview-r { right: 28px; }
.cs-preview-select, .cs-preview-start { height: 13px; width: 36px; top: 220px; font-size: 6px; background: var(--cs-dpad); color: var(--cs-shell); }
.cs-preview-select { left: calc(50% - 43px); } .cs-preview-start { left: calc(50% + 3px); }
.cs-preview-brand { position: absolute; top: 126px; left: 17%; font-size: 5px; font-weight: 750; letter-spacing: .2em; opacity: .6; }
.controller-studio .cs-preview-dpad { font-size: 38px; }
.cs-preview[data-dpad-shape="cross"] .cs-preview-dpad { clip-path: polygon(33% 0,67% 0,67% 33%,100% 33%,100% 67%,67% 67%,67% 100%,33% 100%,33% 67%,0 67%,0 33%,33% 33%); border-radius: 0; font-size: 0; }
.cs-preview[data-dpad-shape="disc"] .cs-preview-dpad, .cs-preview[data-dpad-shape="stick"] .cs-preview-dpad { border-radius: 50%; }
.controller-studio .cs-preview-l, .controller-studio .cs-preview-r { font-size: 7px; }
.controller-studio .cs-preview-select, .controller-studio .cs-preview-start { font-size: 6px; }
.cs-toolbar { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 12px; margin: 10px 0 21px; }
.cs-tool, .cs-link-button { background: none; border: 0; padding: 8px 0; color: #727e68; min-height: 32px; font-size: 9px !important; text-decoration: none; }
.cs-tool:disabled { opacity: .35; cursor: default; }
.cs-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid #d6dacd; border-radius: 14px; padding: 4px; background: #e9e9df; gap: 2px; }
.cs-tab { border: 0; border-radius: 10px; background: none; min-height: 38px; padding: 6px 4px; font-size: 10px !important; color: #7a8173; white-space: nowrap; }
.cs-tab[aria-selected="true"] { background: #fffdf6; color: #3d5137; box-shadow: 0 1px 4px #333c2920; font-weight: 650; }
.cs-section { padding: 20px 0; border-bottom: 1px solid var(--cs-ui-line); }
.controller-studio h4 { font-size: 15px; font-weight: 650; letter-spacing: -.025em; margin: 0 0 9px; color: #344534; }
.cs-hint { color: #858b7d; font-size: 10px; line-height: 1.65; margin: 4px 0 14px; }
.cs-theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.cs-theme-card { border: 1px solid #d9ddcf; border-radius: 12px; padding: 6px; background: #fffdf7; display: flex; flex-direction: column; gap: 7px; color: #6e7966; min-width: 0; transition: border-color .15s, transform .15s; }
.cs-theme-card[aria-pressed="true"] { border-color: #78945f; box-shadow: 0 0 0 1px #78945f; background: #f1f6e8; }
.cs-theme-card:hover { transform: translateY(-2px); }
.cs-theme-name { font-size: 8px; font-weight: 650; padding: 0 0 3px; }
.cs-theme-art { display: block; width: 100%; aspect-ratio: 1.35; position: relative; border-radius: 8px 8px 16px 8px; background: var(--theme-shell); box-shadow: inset 0 1px #ffffff40, inset 0 -4px #00000010; }
.cs-theme-screen { position: absolute; inset: 14% 20% 43%; border-radius: 3px; background: #203129; box-shadow: 0 0 0 3px #ffffff20; }
.cs-theme-dpad { position: absolute; width: 22%; height: 29%; top: 61%; left: 15%; background: var(--theme-pad); clip-path: polygon(33% 0,67% 0,67% 33%,100% 33%,100% 67%,67% 67%,67% 100%,33% 100%,33% 67%,0 67%,0 33%,33% 33%); }
.cs-theme-a, .cs-theme-b { position: absolute; width: 16%; aspect-ratio: 1; background: var(--theme-a); border-radius: 50%; top: 62%; right: 12%; box-shadow: 0 2px #00000020; }
.cs-theme-b { background: var(--theme-b); top: 73%; right: 31%; }
.cs-setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 0; border-bottom: 1px solid #d9ddcf70; }
.cs-setting-label { font-size: 11px; flex: 1; min-width: 0; }
.cs-setting-label small { display: block; max-width: 230px; font-size: 9px; color: #89907f; margin-top: 3px; line-height: 1.5; }
.cs-select, .cs-text { color: #43513b; background: #fffdf8; border: 1px solid #d2d8c7; border-radius: 9px; padding: 9px 10px; min-height: 38px; min-width: 0; max-width: 62%; outline-offset: 1px; }
.cs-select { font-size: 10px !important; } .cs-text { font-size: 12px !important; }
.cs-switch { appearance: none; -webkit-appearance: none; width: 34px; height: 21px; min-width: 34px; border-radius: 20px; background: #d5d9cc; position: relative; margin: 0; border: 0; cursor: pointer; }
.cs-switch::after { content: ''; width: 15px; height: 15px; position: absolute; left: 3px; top: 3px; background: #fffef7; border-radius: 50%; box-shadow: 0 1px 3px #0002; transition: transform .15s; }
.cs-switch:checked { background: #819866; } .cs-switch:checked::after { transform: translateX(13px); }
.cs-color-field { display: flex; align-items: center; gap: 8px; }
.cs-color-field input[type="color"] { appearance: none; width: 34px; height: 29px; padding: 0; border: 1px solid #c9cebd; border-radius: 7px; background: none; cursor: pointer; overflow: hidden; }
.cs-color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; } .cs-color-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.cs-color-reset { border: 0; background: none; color: #8c957f; font-size: 8px !important; padding: 4px; min-height: 28px; }
.cs-image-upload { margin: 14px 0 0; padding: 16px; border: 1px dashed #bdc7ad; border-radius: 12px; background: #ecefe3; }
.cs-image-upload strong { font-size: 11px; display: block; } .cs-image-upload small { color: #88917b; font-size: 9px; display: block; margin: 3px 0 11px; }
.cs-file { display: block; width: 100%; font-size: 9px !important; color: #7a846e; margin: 10px 0 0; max-width: 100%; }
.cs-file::file-selector-button { background: #fffdf7; color: #5b714a; border: 1px solid #c2ceb3; border-radius: 8px; padding: 8px 11px; margin-right: 8px; font: inherit; cursor: pointer; }
.cs-range-row { margin: 17px 0; } .cs-range-label { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; margin-bottom: 8px; }
.cs-range-label output { color: #7d8e69; font-variant-numeric: tabular-nums; font-size: 9px; }
.cs-range-row input[type="range"] { appearance: auto; -webkit-appearance: auto; width: 100%; height: 22px; accent-color: #7f9668; padding: 0; margin: 0; background: transparent; touch-action: pan-y; }
.cs-control-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.cs-control-chip, .cs-preset, .cs-combo-key { border: 1px solid #d0d8c5; background: #fffdf6; border-radius: 9px; padding: 8px 12px; min-height: 34px; font-size: 10px !important; color: #738466; }
.cs-control-chip[aria-pressed="true"], .cs-combo-key[aria-pressed="true"] { background: #dde8ce; border-color: #95aa7a; color: #405a32; }
.cs-control-chip.cs-add { border-style: dashed; }
.cs-actions, .cs-preset-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.cs-primary, .cs-secondary, .cs-danger { border-radius: 9px; min-height: 38px; padding: 9px 13px; border: 1px solid #8fa474; color: #fffdf6; background: #768f5f; font-size: 10px !important; }
.cs-secondary { background: #fffdf6; border-color: #c5cfb7; color: #627951; } .cs-danger { background: transparent; border-color: #d9bdb1; color: #a97865; }
.cs-preset { font-size: 8px !important; padding: 6px 9px; text-transform: capitalize; }
.cs-details { margin: 14px 0; padding: 13px 14px; border: 1px solid #d0d7c4; border-radius: 12px; background: #edf0e5; }
.cs-details > summary { color: #637a52; font-size: 10px; cursor: pointer; min-height: 22px; }
.cs-details > .cs-hint { margin-top: 12px; }
.cs-combo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 12px; }
.cs-combo-key { padding: 8px 0; font-size: 8px !important; }
.cs-save-profile { display: flex; gap: 8px; margin-top: 15px; } .cs-save-profile .cs-text { flex: 1; max-width: 100%; }
.cs-save-profile .cs-primary { white-space: nowrap; }
.cs-profiles { margin-top: 12px; display: grid; gap: 9px; }
.cs-profile-card { padding: 14px; border: 1px solid #d2dac7; border-radius: 12px; background: #fffdf7; }
.cs-profile-title { display: flex; gap: 6px; justify-content: space-between; align-items: baseline; flex-wrap: wrap; }
.cs-profile-title strong { font-size: 12px; } .cs-profile-badge { font-size: 6px; color: #8b9a79; letter-spacing: .06em; }
.cs-profile-actions { display: flex; gap: 9px; align-items: flex-start; margin-top: 12px; }
.cs-profile-more { flex: 1; color: #879675; font-size: 9px; } .cs-profile-more summary { padding: 10px 3px; cursor: pointer; }
.cs-profile-more .cs-text { width: 100%; max-width: 100%; margin: 8px 0; } .cs-profile-more button { margin: 4px 4px 0 0; font-size: 8px !important; }
.cs-profile-count { color: #8c997e; font-size: 8px; margin: 14px 0 0; }
.cs-status { color: #8d957f; font-size: 9px; text-align: center; line-height: 1.6; padding-top: 15px; margin: 0; }
@media (max-width: 380px) {
  .controller-studio { padding: 16px 12px; border-radius: 17px; }
  .cs-saved-pill { display: none; } .cs-preview { height: 248px; } .cs-tabs { gap: 0; } .cs-tab { font-size: 9px !important; }
  .cs-theme-grid { gap: 6px; } .cs-theme-name { font-size: 7px; } .cs-select { max-width: 58%; }
}
@media (prefers-reduced-motion: reduce) { .controller-studio * { transition: none !important; } }
