:root {
    color-scheme: dark;
    --ps-bg: #070708;
    --ps-panel: #111216;
    --ps-panel-2: #17191e;
    --ps-panel-3: #202228;
    --ps-line: rgba(255, 255, 255, .11);
    --ps-line-strong: rgba(255, 255, 255, .23);
    --ps-text: #f8f8f9;
    --ps-muted: #a9acb4;
    --ps-red: #ef334a;
    --ps-red-dark: #9e1025;
    --ps-green: #5ce0a5;
    --ps-gold: #ffc86a;
    --ps-focus: #ff7383;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ps-bg); }
body { min-height: 100vh; margin: 0; color: var(--ps-text); background: radial-gradient(circle at 10% -10%, rgba(239, 51, 74, .19), transparent 30rem), radial-gradient(circle at 95% 12%, rgba(111, 17, 36, .15), transparent 35rem), var(--ps-bg); }
button, input, select, textarea { font: inherit; }
button, select, input[type="range"] { accent-color: var(--ps-red); }
button, a, input, select, textarea, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--ps-focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.ps-site-header { min-height: 70px; position: sticky; z-index: 50; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px clamp(14px, 3vw, 48px); border-bottom: 1px solid var(--ps-line); background: rgba(7, 7, 8, .91); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.ps-brand { min-width: 0; display: inline-flex; align-items: center; gap: 11px; color: var(--ps-text); text-decoration: none; }
.ps-brand-mark { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 13px; background: linear-gradient(145deg, var(--ps-red), var(--ps-red-dark)); box-shadow: 0 12px 35px rgba(239,51,74,.25); font-weight: 950; }
.ps-brand strong, .ps-brand small { display: block; }
.ps-brand strong { font-size: .95rem; letter-spacing: -.02em; }
.ps-brand small { margin-top: 2px; color: var(--ps-muted); font-size: .66rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.ps-header-actions { display: flex; align-items: center; gap: 9px; }
.ps-header-actions > * { min-height: 38px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--ps-line); border-radius: 999px; font-size: .72rem; font-weight: 850; }
.ps-header-actions a { color: #fff; text-decoration: none; background: rgba(255,255,255,.04); }
.ps-private-badge { color: #c9f7df; background: rgba(47,157,105,.12); }

.ps-shell { width: min(1820px, calc(100% - 28px)); margin: 0 auto; padding: 34px 0 64px; }
.ps-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 20px; }
.ps-kicker { margin: 0 0 7px; color: #ff6879; font-size: .68rem; font-weight: 950; letter-spacing: .18em; text-transform: uppercase; }
.ps-hero h1 { margin: 0; font-size: clamp(2.4rem, 5vw, 4.9rem); line-height: .92; letter-spacing: -.066em; }
.ps-hero > div > p:last-child { max-width: 780px; margin: 13px 0 0; color: var(--ps-muted); line-height: 1.6; }
.ps-trust { max-width: 520px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.ps-trust span { padding: 8px 11px; border: 1px solid var(--ps-line); border-radius: 999px; color: #d4d5da; background: rgba(255,255,255,.03); font-size: .66rem; font-weight: 800; }

.ps-workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(410px, .65fr); gap: 16px; align-items: start; }
.ps-stage-card, .ps-dock { min-width: 0; overflow: hidden; border: 1px solid var(--ps-line); border-radius: 23px; background: rgba(16,17,20,.95); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.ps-stage-toolbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 15px; border-bottom: 1px solid var(--ps-line); background: var(--ps-panel-2); }
.ps-file-summary { min-width: 0; }
.ps-file-summary strong, .ps-file-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-file-summary strong { font-size: .82rem; }
.ps-file-summary small { margin-top: 4px; color: var(--ps-muted); font-size: .67rem; }
.ps-toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ps-button, .ps-button-grid button, .ps-tool-grid button, .ps-wide-button, .ps-card-grid button { border: 1px solid var(--ps-line); color: #fff; cursor: pointer; background: rgba(255,255,255,.045); }
.ps-button { min-height: 36px; padding: 0 10px; border-radius: 9px; font-size: .69rem; font-weight: 850; }
button:hover:not(:disabled) { border-color: var(--ps-line-strong); filter: brightness(1.08); }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .38; cursor: not-allowed; }

.ps-stage { min-height: clamp(510px, 68vh, 900px); position: relative; display: grid; place-items: center; padding: 16px; overflow: hidden; background-color: #090a0c; background-image: linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,.025) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255,255,255,.025) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.025) 75%); background-size: 28px 28px; background-position: 0 0, 0 14px, 14px -14px, -14px 0; }
.ps-stage.is-brushing { cursor: crosshair; touch-action: none; }
.ps-drop-zone { width: min(620px, 100%); min-height: 350px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 32px; border: 1px dashed rgba(255,255,255,.25); border-radius: 23px; text-align: center; cursor: pointer; background: linear-gradient(145deg, rgba(255,255,255,.04), rgba(255,255,255,.012)); transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.ps-drop-zone:hover, .ps-drop-zone.is-dragging { transform: translateY(-2px); border-color: rgba(239,51,74,.76); background: rgba(239,51,74,.07); }
.ps-upload-icon { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 8px; border: 1px solid rgba(239,51,74,.5); border-radius: 19px; background: linear-gradient(145deg, var(--ps-red), #700b1d); box-shadow: 0 18px 42px rgba(239,51,74,.22); font-size: 2rem; font-weight: 300; }
.ps-drop-zone strong { font-size: 1.2rem; }
.ps-drop-zone small { max-width: 390px; margin-top: 9px; color: var(--ps-muted); line-height: 1.5; }
.ps-canvas-shell { max-width: 100%; max-height: calc(68vh - 32px); position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 11px; box-shadow: 0 24px 70px rgba(0,0,0,.58); }
#previewCanvas { display: block; max-width: 100%; max-height: calc(68vh - 32px); width: auto; height: auto; object-fit: contain; touch-action: pan-y pinch-zoom; }
.ps-stage.is-brushing #previewCanvas { touch-action: none; }
.ps-rendering { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; align-content: center; gap: 7px; padding: 25px; text-align: center; background: rgba(4,4,5,.82); -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px); }
.ps-rendering small { color: #cbcdd2; }
.ps-rendering progress { width: min(360px, 82%); height: 9px; margin-top: 9px; overflow: hidden; border: 0; border-radius: 999px; accent-color: var(--ps-red); background: rgba(255,255,255,.14); }
.ps-rendering progress::-webkit-progress-bar { border-radius: 999px; background: rgba(255,255,255,.14); }
.ps-rendering progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--ps-red), #ff6178); transition: width .18s ease; }
.ps-rendering progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--ps-red), #ff6178); }
.ps-rendering-step { min-height: 1.2em; font-variant-numeric: tabular-nums; }
.ps-spinner { width: 38px; height: 38px; margin-bottom: 7px; border: 3px solid rgba(255,255,255,.17); border-top-color: var(--ps-red); border-radius: 50%; animation: ps-spin .8s linear infinite; }
@keyframes ps-spin { to { transform: rotate(360deg); } }
.ps-status { min-height: 48px; display: flex; align-items: center; padding: 10px 15px; border-top: 1px solid var(--ps-line); color: var(--ps-muted); background: var(--ps-panel-2); font-size: .73rem; line-height: 1.45; }
.ps-status.is-ok { color: #8cebbc; background: rgba(48,157,107,.11); }
.ps-status.is-error { color: #ff9eaa; background: rgba(164,22,44,.12); }

.ps-dock { max-height: calc(100vh - 86px); position: sticky; top: 80px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.ps-tabs { display: flex; gap: 5px; padding: 9px; overflow-x: auto; border-bottom: 1px solid var(--ps-line); background: #0d0e10; scrollbar-width: thin; }
.ps-tab { min-height: 40px; flex: 0 0 auto; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; color: var(--ps-muted); cursor: pointer; background: transparent; font-size: .68rem; font-weight: 850; white-space: nowrap; }
.ps-tab[aria-selected="true"] { border-color: rgba(239,51,74,.48); color: #fff; background: rgba(239,51,74,.13); }
.ps-panels { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #484b52 transparent; }
.ps-panel { padding: 18px; }
.ps-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.ps-section-head p, .ps-section-head h2 { margin: 0; }
.ps-section-head p { color: #ff697a; font-size: .61rem; font-weight: 950; letter-spacing: .15em; text-transform: uppercase; }
.ps-section-head h2 { margin-top: 4px; font-size: 1.05rem; letter-spacing: -.025em; }
.ps-section-head > span { color: var(--ps-gold); font-size: .68rem; font-weight: 850; }
.ps-text-button { padding: 0; border: 0; color: #ff8996; cursor: pointer; background: none; font-size: .69rem; font-weight: 850; }
.ps-help { margin: 0 0 14px; color: var(--ps-muted); font-size: .69rem; line-height: 1.55; }
.ps-subsection { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ps-line); }
.ps-subsection h3 { margin: 0 0 7px; font-size: .82rem; }

.ps-presets { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin-bottom: 16px; }
.ps-preset { min-height: 57px; padding: 9px; border: 1px solid var(--ps-line); border-radius: 11px; color: #fff; text-align: left; cursor: pointer; background: linear-gradient(145deg, #30333a, #121317); font-size: .67rem; font-weight: 900; }
.ps-preset.is-active { border-color: #ff6678; box-shadow: 0 0 0 1px #ff6678 inset; }
.ps-control-list { display: grid; gap: 3px; }
.ps-control { padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.055); }
.ps-control:last-child { border-bottom: 0; }
.ps-control-head { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 9px; align-items: center; margin-bottom: 7px; }
.ps-control-head label { font-size: .7rem; font-weight: 800; }
.ps-control-head output { min-width: 60px; color: var(--ps-gold); text-align: right; font-size: .68rem; font-variant-numeric: tabular-nums; }
.ps-control-head button { width: 25px; height: 25px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ps-line); border-radius: 7px; color: var(--ps-muted); cursor: pointer; background: rgba(255,255,255,.03); }
.ps-control input[type="range"] { width: 100%; height: 21px; margin: 0; cursor: pointer; }

.ps-field, .ps-two label { display: grid; gap: 6px; margin: 11px 0; color: #dedfe3; font-size: .68rem; font-weight: 800; }
.ps-field input:not([type="range"]):not([type="color"]), .ps-field select, .ps-field textarea, .ps-two input, .ps-two select, .ps-fieldset input[type="number"] { width: 100%; min-height: 41px; padding: 8px 10px; border: 1px solid var(--ps-line); border-radius: 9px; color: #fff; background: #0b0c0e; }
.ps-field textarea { resize: vertical; }
.ps-field input[type="color"], .ps-two input[type="color"] { width: 100%; height: 42px; padding: 3px; border: 1px solid var(--ps-line); border-radius: 9px; background: #0b0c0e; }
.ps-two { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ps-fieldset { margin: 14px 0 0; padding: 12px; border: 1px solid var(--ps-line); border-radius: 11px; }
.ps-fieldset legend { padding: 0 6px; color: #e1e2e5; font-size: .68rem; font-weight: 850; }
.ps-check { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: var(--ps-muted); font-size: .67rem; }
.ps-button-grid, .ps-tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 10px 0; }
.ps-button-grid button, .ps-tool-grid button, .ps-wide-button { min-height: 42px; padding: 8px 10px; border-radius: 9px; font-size: .67rem; font-weight: 850; }
.ps-tool-grid button.is-active { border-color: #ff6678; color: #fff; background: rgba(239,51,74,.16); }
.ps-wide-button { width: 100%; margin: 7px 0; }

.ps-item-list { display: grid; gap: 7px; margin-top: 12px; }
.ps-item { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 9px 10px; border: 1px solid var(--ps-line); border-radius: 9px; background: rgba(255,255,255,.03); }
.ps-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .68rem; white-space: nowrap; }
.ps-item button, .ps-item a { flex: 0 0 auto; padding: 6px 8px; border: 1px solid var(--ps-line); border-radius: 7px; color: #fff; background: rgba(255,255,255,.04); font-size: .63rem; text-decoration: none; }
.ps-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ps-card-grid button { min-height: 86px; display: grid; align-content: end; gap: 4px; padding: 11px; border-radius: 12px; text-align: left; }
.ps-card-grid strong { font-size: .72rem; }
.ps-card-grid small { color: var(--ps-muted); font-size: .62rem; line-height: 1.4; }
.ps-card-grid button.is-active { border-color: #ff6678; background: rgba(239,51,74,.12); }
.ps-secondary-canvas { width: 100%; max-height: 360px; display: block; margin: 13px auto; object-fit: contain; border: 1px solid var(--ps-line); border-radius: 9px; background: #090a0b; }
input[type="file"]:not([hidden]) { width: 100%; margin: 7px 0 12px; padding: 9px; border: 1px dashed var(--ps-line-strong); border-radius: 9px; color: var(--ps-muted); background: #0c0d0f; font-size: .66rem; }

.ps-export { padding: 15px 17px 17px; border-top: 1px solid var(--ps-line); background: linear-gradient(145deg, rgba(239,51,74,.07), #111216 60%); }
.ps-export .ps-section-head { margin-bottom: 8px; }
.ps-export .ps-two { align-items: end; }
.ps-download { width: 100%; min-height: 52px; margin-top: 11px; padding: 9px 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 11px; color: #fff; cursor: pointer; background: linear-gradient(100deg, var(--ps-red), var(--ps-red-dark)); box-shadow: 0 14px 38px rgba(239,51,74,.19); font-weight: 950; }
.ps-noscript { margin: 20px; padding: 18px; border: 1px solid #a2283b; color: #fff; background: #48101b; text-align: center; }
@media (max-width: 1240px) {
    .ps-workspace { grid-template-columns: 1fr; }
    .ps-dock { max-height: none; position: static; display: block; }
    .ps-panels { max-height: none; overflow: visible; }
}

@media (max-width: 760px) {
    .ps-site-header { min-height: 62px; padding: 9px 11px; }
    .ps-private-badge { display: none; }
    .ps-brand small { display: none; }
    .ps-header-actions > * { min-height: 35px; padding: 0 9px; font-size: .66rem; }
    .ps-shell { width: min(100% - 14px, 1820px); padding-top: 23px; }
    .ps-hero { align-items: flex-start; flex-direction: column; gap: 15px; }
    .ps-trust { justify-content: flex-start; }
    .ps-stage-toolbar { align-items: flex-start; flex-direction: column; }
    .ps-toolbar-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
    .ps-stage { min-height: 430px; padding: 7px; }
    .ps-drop-zone { min-height: 310px; padding: 21px; }
    .ps-canvas-shell, #previewCanvas { max-height: 66vh; }
    .ps-tab { min-height: 44px; }
    .ps-panel { padding: 15px; }
}

@media (max-width: 440px) {
    .ps-presets { grid-template-columns: 1fr 1fr; }
    .ps-two, .ps-card-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
