:root {
    --bg-primary: #061224;
    --bg-secondary: #0c1a36;
    --bg-tertiary: #12254a;
    --panel: rgba(11, 24, 50, 0.9);
    --panel-soft: rgba(28, 47, 76, 0.82);
    --panel-lift: rgba(61, 82, 111, 0.62);
    --surface: rgba(11, 24, 50, 0.76);
    --surface-strong: rgba(7, 18, 38, 0.9);
    --line: rgba(120, 162, 255, 0.2);
    --line-soft: rgba(126, 163, 216, 0.18);
    --text: #f3f8ff;
    --muted: rgba(218, 231, 255, 0.74);
    --accent: #78a8ff;
    --accent-2: #4ba3ff;
    --accent-3: #7eead0;
    --danger: #ff8a98;
    --shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: var(--sheetgenie-topbar-offset, 84px);
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 18%, rgba(81, 164, 255, 0.34), transparent 34%),
        radial-gradient(circle at 86% 82%, rgba(57, 215, 194, 0.2), transparent 28%),
        linear-gradient(140deg, #07152c 0%, #0b2143 46%, #123267 100%);
    position: relative;
}

button,
a {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.studio-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
}

.blob-a {
    width: 260px;
    height: 260px;
    left: 8%;
    top: 6%;
    background: #2f7cf7;
}

.blob-b {
    width: 320px;
    height: 320px;
    right: 10%;
    bottom: 6%;
    top: auto;
    background: #31cbb7;
    animation: blobDrift 14s ease-in-out infinite;
}

.blob-c {
    width: 190px;
    height: 190px;
    left: 52%;
    top: 50%;
    bottom: auto;
    background: #79b6ff;
    animation: blobDrift 16s ease-in-out infinite reverse;
}

.curve {
    position: absolute;
    border-radius: 999px;
    border: 1px solid rgba(143, 193, 255, 0.16);
}

.curve-a {
    width: 720px;
    height: 720px;
    left: -320px;
    top: 120px;
    transform: rotate(-20deg);
}

.curve-b {
    width: 900px;
    height: 540px;
    right: -420px;
    top: 240px;
    transform: rotate(8deg);
}

.geo {
    position: absolute;
    pointer-events: none;
    opacity: 0.36;
}

.geo-ring {
    border-radius: 50%;
    border: 1px solid rgba(135, 201, 255, 0.28);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.16);
}

.geo-ring-a {
    width: 120px;
    height: 120px;
    top: 16%;
    left: 54%;
    --geo-rot: 0deg;
    animation: geoFloat 12s ease-in-out infinite;
}

.geo-ring-b {
    width: 80px;
    height: 80px;
    bottom: 18%;
    left: 12%;
    --geo-rot: 0deg;
    animation: geoPulse 9s ease-in-out infinite;
}

.geo-square {
    border: 1px solid rgba(126, 189, 255, 0.3);
    border-radius: 14px;
    box-shadow: 0 0 14px rgba(0, 174, 239, 0.12);
}

.geo-square-a {
    width: 72px;
    height: 72px;
    top: 30%;
    right: 34%;
    transform: rotate(16deg);
    animation: geoSpinA 13s linear infinite;
}

.geo-square-b {
    width: 46px;
    height: 46px;
    bottom: 31%;
    right: 10%;
    --geo-rot: -22deg;
    transform: rotate(var(--geo-rot));
    animation: geoFloat 11s ease-in-out infinite reverse;
}

.geo-triangle {
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-bottom: 30px solid rgba(124, 196, 255, 0.2);
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.2));
}

.geo-triangle-a {
    top: 18%;
    right: 16%;
    transform: rotate(8deg);
    animation: geoSpinB 14s linear infinite;
}

.geo-triangle-b {
    bottom: 24%;
    left: 44%;
    transform: rotate(-14deg);
    animation: geoPulse 10s ease-in-out infinite;
}

.geo-line {
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0, 174, 239, 0.02), rgba(125, 206, 255, 0.5), rgba(0, 174, 239, 0.02));
    box-shadow: 0 0 10px rgba(0, 174, 239, 0.2);
}

.geo-line-a {
    width: 180px;
    top: 22%;
    left: 22%;
    --geo-rot: 26deg;
    transform: rotate(var(--geo-rot));
    animation: geoFloat 10s ease-in-out infinite;
}

.geo-line-b {
    width: 140px;
    bottom: 20%;
    right: 28%;
    --geo-rot: -20deg;
    transform: rotate(var(--geo-rot));
    animation: geoFloat 12s ease-in-out infinite reverse;
}

.grid-light {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(143, 193, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(143, 193, 255, 0.08) 1px, transparent 1px);
    background-size: 44px 44px;
    opacity: 0.28;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.48), transparent 76%);
}

.studio-shell {
    width: 100%;
    margin: 0 auto 28px;
}

.studio-sticky-bar {
    position: sticky;
    top: var(--sheetgenie-topbar-offset, 74px);
    z-index: 80;
    width: 100%;
    padding: 8px 0 14px;
    background:
        linear-gradient(180deg, rgba(6, 18, 36, 0.98) 0%, rgba(8, 24, 48, 0.95) 76%, rgba(8, 24, 48, 0.76) 100%);
    border-bottom: 1px solid rgba(120, 162, 255, 0.18);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.studio-sticky-bar .studio-hero {
    margin-top: 0;
}

.studio-hero,
.mode-tabs,
.mode-frame-shell,
.template-dock {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.studio-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 0;
    width: min(1540px, calc(100% - 56px));
    margin: 8px auto 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 13px;
}

.title-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: transparent;
    border: 0;
    color: var(--accent);
}

.title-icon svg {
    width: 36px;
    height: 36px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hero-actions svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1,
p {
    margin: 0;
}

.studio-hero h1 {
    font-size: clamp(1.38rem, 1.75vw, 1.74rem);
    line-height: 1.2;
    color: #f4f8ff;
}

.studio-hero p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.92rem;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
}

.utility-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 0 13px;
    border-radius: 9px;
    border: 1px solid var(--line);
    color: #eef6ff;
    background: rgba(4, 14, 30, 0.72);
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(3, 12, 24, 0.14);
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.utility-btn:hover {
    border-color: rgba(120, 168, 255, 0.42);
    background: rgba(17, 37, 74, 0.86);
    box-shadow: 0 14px 28px rgba(3, 12, 24, 0.2);
    transform: translateY(-1px);
}

.utility-btn--split {
    gap: 14px;
    min-width: 150px;
    justify-content: space-between;
}

.toggle-dot {
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: rgba(169, 191, 220, 0.42);
    position: relative;
}

.toggle-dot::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #ffffff;
    transition: transform 0.18s ease;
}

.toggle-dot.active {
    background: var(--accent-3);
}

.toggle-dot.active::after {
    transform: translateX(14px);
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(135deg, #118ee9, #3e79f4);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(17, 142, 233, 0.28);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 44px rgba(17, 142, 233, 0.38);
}

.studio-action-status {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 4;
    max-width: min(360px, 80vw);
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(6, 18, 36, 0.96);
    color: #eef6ff;
    font-size: 0.84rem;
    font-weight: 700;
    box-shadow: 0 18px 36px rgba(3, 12, 24, 0.28);
}

.studio-action-status[data-tone="warn"] {
    color: #ffd8b3;
    border-color: rgba(244, 184, 112, 0.38);
    background: rgba(69, 38, 15, 0.9);
}

.export-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.studio-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 28% 22%, color-mix(in srgb, var(--sg-theme-accent, #2587e8) 18%, transparent), transparent 34%),
        rgba(3, 10, 22, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.studio-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.studio-loading-panel {
    position: relative;
    overflow: hidden;
    width: min(390px, 100%);
    padding: 24px 22px;
    border-radius: var(--sg-theme-radius, 14px);
    border: 1px solid color-mix(in srgb, var(--sg-theme-accent, #2587e8) 28%, rgba(184, 213, 255, 0.18));
    background:
        var(--sg-panel-bg, var(--index-v2-panel-bg, linear-gradient(165deg, color-mix(in srgb, var(--sg-theme-accent, #2587e8) 14%, rgba(255, 255, 255, 0.08)), rgba(255, 255, 255, 0.07) 48%, color-mix(in srgb, var(--sg-theme-accent-2, #ee6a5f) 10%, rgba(255, 255, 255, 0.08)))));
    box-shadow: var(--sg-theme-shadow, 0 28px 80px rgba(0, 0, 0, 0.42));
    color: var(--sg-theme-text, #f5f9ff);
    text-align: center;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.studio-loading-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sg-theme-accent, #2587e8), color-mix(in srgb, var(--sg-theme-accent-2, #ee6a5f) 58%, #ffffff), var(--sg-theme-accent-3, #1fa98d));
    opacity: 0.95;
    pointer-events: none;
}

.studio-loading-panel > * {
    position: relative;
    z-index: 1;
}

.studio-loading-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 18px;
    border-radius: 999px;
    border: 0;
    background: conic-gradient(from 0deg, transparent 0 72deg, rgba(255, 255, 255, 0.72) 78deg 96deg, var(--sg-theme-accent, #2587e8) 126deg 248deg, var(--sg-theme-accent-3, #1fa98d) 292deg 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
    box-shadow: 0 0 24px color-mix(in srgb, var(--sg-theme-accent, #2587e8) 24%, transparent);
    animation: studioLoadingSpin 0.85s linear infinite;
    will-change: transform;
}

.studio-loading-title {
    margin: 0;
    color: var(--sg-theme-text, #f5f9ff);
    font-size: 1.04rem;
    font-weight: 800;
    line-height: 1.25;
}

.studio-loading-desc {
    margin: 10px 0 0;
    color: var(--sg-theme-muted, rgba(220, 235, 255, 0.8));
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.55;
    white-space: pre-line;
}

@keyframes studioLoadingSpin {
    to {
        transform: rotate(360deg);
    }
}

.mode-tabs {
    display: grid;
    grid-template-columns: repeat(9, minmax(116px, 1fr));
    gap: 8px;
    width: min(1540px, calc(100% - 56px));
    margin: 0 auto;
    padding: 8px;
    border-radius: 8px;
    overflow-x: auto;
    border-color: rgba(132, 172, 226, 0.2);
    background:
        radial-gradient(420px 120px at 8% -12%, rgba(94, 160, 255, 0.12), transparent 70%),
        linear-gradient(180deg, rgba(19, 42, 72, 0.74), rgba(12, 28, 51, 0.8));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        0 14px 30px rgba(0, 0, 0, 0.18);
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.mode-tab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    min-height: 48px;
    min-width: 128px;
    padding: 8px 10px;
    border: 1px solid rgba(109, 144, 194, 0.18);
    border-radius: 8px;
    color: rgba(206, 222, 246, 0.78);
    background:
        linear-gradient(180deg, rgba(6, 18, 37, 0.8), rgba(1, 8, 19, 0.82));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        0 1px 0 rgba(255, 255, 255, 0.02);
    font-weight: 800;
    white-space: nowrap;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.mode-tab-icon {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(138, 196, 255, 0.34);
    border-radius: 8px;
    color: #dff2ff;
    background:
        radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.28), transparent 28%),
        linear-gradient(145deg, #347fc9, #24609e 74%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 8px 16px rgba(30, 102, 184, 0.2);
    font-weight: 800;
}

.mode-tab-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mode-tab-icon--text {
    width: auto;
    min-width: 32px;
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.76rem;
    line-height: 1;
}

.mode-tab:hover {
    border-color: rgba(122, 173, 238, 0.35);
    color: rgba(235, 244, 255, 0.92);
    background:
        linear-gradient(180deg, rgba(10, 28, 54, 0.88), rgba(2, 11, 26, 0.9));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        0 8px 18px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.mode-tab.active {
    color: #eef8ff;
    border-color: rgba(105, 176, 255, 0.58);
    background:
        radial-gradient(circle at 50% 0%, rgba(133, 203, 255, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(37, 111, 199, 0.82), rgba(17, 66, 139, 0.88));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -10px 18px rgba(5, 45, 112, 0.16),
        0 9px 20px rgba(12, 79, 170, 0.18);
}

.mode-tab.active .mode-tab-icon {
    border-color: rgba(204, 232, 255, 0.42);
    color: #ffffff;
    background:
        radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.32), transparent 30%),
        linear-gradient(145deg, #54a5f4, #2b73c6 74%);
}

.mode-tab.is-locked {
    color: rgba(218, 231, 255, 0.42);
    background: rgba(4, 14, 30, 0.45);
    cursor: not-allowed;
    transform: none;
}

.mode-tab.is-locked .mode-tab-icon {
    color: rgba(169, 191, 220, 0.45);
}

.mode-tab.is-locked::before {
    content: "LOCK";
    position: absolute;
    top: 4px;
    right: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    border: 1px solid rgba(244, 184, 112, 0.28);
    color: #ffd8b3;
    background: rgba(69, 38, 15, 0.68);
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0;
}

.mode-tab.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 5px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(126, 234, 208, 0.72), rgba(111, 176, 255, 0.86));
}

.mode-frame-shell {
    width: min(1540px, calc(100% - 56px));
    margin: 14px auto 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.mode-frame-toolbar {
    display: none;
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 0 4px 12px;
}

.mode-frame-toolbar strong {
    color: #f4f8ff;
    font-size: 1.02rem;
}

.mode-frame-toolbar span {
    color: var(--muted);
    font-size: 0.9rem;
}

.mode-frame {
    display: block;
    width: 100%;
    height: 760px;
    min-height: 760px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.mode-frame[hidden] {
    display: none !important;
}

.mode-frame-shell.is-frame-loading .mode-frame {
    visibility: hidden;
}

.template-dock {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 10px;
}

.template-dock__head,
.template-dock__tabs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.template-dock__head {
    justify-content: space-between;
    margin-bottom: 10px;
}

.template-dock__head h2 {
    margin: 0;
    color: #f4f8ff;
    font-size: 1.05rem;
}

.template-dock__head button {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(4, 14, 30, 0.72);
    color: #eef6ff;
    font-weight: 800;
}

.template-dock__tabs {
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.template-dock__tabs button,
.template-dock__tabs a {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(184, 213, 255, 0.14);
    background: rgba(4, 14, 30, 0.6);
    color: #c8dbf2;
    font-weight: 700;
}

.template-dock__tabs button.active {
    background: rgba(120, 168, 255, 0.18);
    color: #c8dcff;
    border-color: rgba(120, 168, 255, 0.34);
}

.template-dock__tabs label {
    position: relative;
    min-width: 250px;
    margin-left: auto;
}

.template-dock__tabs input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 36px 0 12px;
    color: #eef6ff;
    background: rgba(4, 14, 30, 0.72);
}

.template-dock__tabs label span {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: #c8dbf2;
}

.template-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(190px, 1fr));
    gap: 14px;
    overflow-x: auto;
}

.template-card {
    display: grid;
    gap: 7px;
    min-height: 120px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(184, 213, 255, 0.2);
    background: rgba(28, 47, 76, 0.72);
}

.template-card span {
    min-height: 62px;
    border-radius: 8px;
    border: 1px solid rgba(184, 213, 255, 0.16);
    background: rgba(244, 248, 255, 0.94);
    position: relative;
    overflow: hidden;
}

.template-card span::before {
    content: "";
    position: absolute;
    inset: 14px 18px;
    background:
        linear-gradient(#6483a4, #6483a4) 0 0 / 58% 3px no-repeat,
        repeating-linear-gradient(to bottom, #aebed0 0 2px, transparent 2px 9px);
    opacity: 0.7;
}

.template-card strong {
    color: #eef6ff;
    font-size: 0.92rem;
}

.template-card small {
    color: var(--muted);
}

.template-card.active {
    border-color: rgba(126, 234, 208, 0.58);
    box-shadow: 0 0 0 2px rgba(126, 234, 208, 0.12), 0 18px 36px rgba(3, 12, 24, 0.2);
}

@keyframes orbDrift {
    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(16px, -18px, 0);
    }
}

@keyframes blobDrift {
    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(16px, -18px, 0);
    }
}

@keyframes geoFloat {
    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(var(--geo-rot, 0deg));
    }

    50% {
        transform: translate3d(0, -12px, 0) rotate(var(--geo-rot, 0deg));
    }
}

@keyframes geoSpinA {
    from {
        transform: rotate(16deg);
    }

    to {
        transform: rotate(376deg);
    }
}

@keyframes geoSpinB {
    from {
        transform: rotate(8deg);
    }

    to {
        transform: rotate(-352deg);
    }
}

@keyframes geoPulse {
    0%,
    100% {
        opacity: 0.24;
    }

    50% {
        opacity: 0.54;
    }
}

@media (max-width: 860px) {
    body {
        padding-top: var(--sheetgenie-topbar-offset, 72px);
    }

    .studio-shell {
        width: 100%;
        margin-top: 0;
    }

    .studio-sticky-bar {
        padding: 8px 0 10px;
        top: var(--sheetgenie-topbar-offset, 64px);
    }

    .studio-hero,
    .mode-frame-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .studio-hero {
        width: min(100% - 24px, 1510px);
        gap: 12px;
    }

    .title-row {
        align-items: flex-start;
        gap: 10px;
        min-width: 0;
    }

    .title-icon {
        width: 34px;
        height: 34px;
    }

    .title-icon svg {
        width: 30px;
        height: 30px;
    }

    .studio-hero h1,
    .studio-hero p {
        overflow-wrap: anywhere;
    }

    .mode-tabs,
    .mode-frame-shell {
        width: min(100% - 24px, 1510px);
    }

    .hero-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .mode-frame {
        height: 760px;
        min-height: 760px;
    }
}

@media (max-width: 620px) {
    body {
        padding-top: var(--sheetgenie-topbar-offset, 66px);
    }

    .studio-sticky-bar {
        padding: 7px 0 8px;
    }

    .studio-hero {
        width: calc(100% - 18px);
    }

    .studio-hero h1 {
        font-size: 1.12rem;
    }

    .studio-hero p {
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .utility-btn,
    .export-btn {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        justify-content: center;
        padding: 0 10px;
        font-size: 0.86rem;
        line-height: 1.2;
    }

    .utility-btn span:not(.toggle-dot),
    .export-btn span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .utility-btn--split {
        justify-content: space-between;
        gap: 8px;
    }

    .export-btn {
        grid-column: 1 / -1;
    }

    .studio-action-status {
        left: 0;
        right: auto;
        max-width: 100%;
        border-radius: 8px;
        line-height: 1.35;
    }

    .mode-tabs {
        width: calc(100% - 18px);
        grid-template-columns: repeat(9, minmax(104px, 118px));
        gap: 6px;
        padding: 6px;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 6px;
    }

    .mode-tab {
        min-width: 0;
        min-height: 42px;
        gap: 7px;
        padding: 7px 8px;
        scroll-snap-align: start;
        font-size: 0.82rem;
    }

    .mode-tab-icon {
        width: 24px;
        height: 24px;
        border-radius: 7px;
    }

    .mode-tab-icon--text {
        min-width: 28px;
        font-size: 0.68rem;
    }

    .mode-frame-shell {
        width: calc(100% - 18px);
        margin-top: 10px;
        padding: 0;
    }

    .mode-frame {
        min-height: 640px;
    }
}

@media (max-width: 380px) {
    .hero-actions {
        grid-template-columns: 1fr;
    }

    .export-btn {
        grid-column: auto;
    }
}

/* Modes Studio V2 */
:root {
    --studio-topbar-offset: var(--sheetgenie-topbar-offset, 78px);
    --studio-page: color-mix(in srgb, var(--sgv2-bg, #f7fbff) 78%, #ffffff);
    --studio-page-2: color-mix(in srgb, var(--sgv2-bg, #f7fbff) 54%, #edf4fb);
    --studio-surface: rgba(255, 255, 255, 0.9);
    --studio-surface-solid: #ffffff;
    --studio-soft: color-mix(in srgb, var(--sgv2-bg, #f7fbff) 56%, #ffffff);
    --studio-ink: var(--sgv2-ink, #10233f);
    --studio-muted: var(--sgv2-muted, #5e718c);
    --studio-line: color-mix(in srgb, var(--sgv2-accent, #2587e8) 16%, rgba(74, 96, 124, 0.2));
    --studio-line-strong: color-mix(in srgb, var(--sgv2-accent, #2587e8) 32%, rgba(74, 96, 124, 0.22));
    --studio-accent: var(--sgv2-accent, #2587e8);
    --studio-accent-2: var(--sgv2-accent-2, #ee6a5f);
    --studio-accent-3: var(--sgv2-accent-3, #1fa98d);
    --studio-shadow-lg: 0 28px 68px rgba(35, 58, 84, 0.16);
    --studio-shadow-md: 0 18px 44px rgba(35, 58, 84, 0.12);
    --studio-shadow-sm: 0 10px 26px rgba(35, 58, 84, 0.08);
    --studio-radius-xl: 18px;
    --studio-radius-lg: 14px;
    --studio-radius-md: 10px;
    --studio-radius-sm: 8px;
}

html,
body {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.28) 38%, transparent 76%),
        linear-gradient(135deg, var(--studio-page) 0%, var(--studio-page-2) 100%);
    color: var(--studio-ink);
}

body {
    min-height: 100dvh;
    padding-top: var(--studio-topbar-offset);
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--studio-accent) 42%, #cbd6e2) transparent;
}

body::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
    background-color: color-mix(in srgb, var(--studio-accent) 34%, #cbd6e2);
}

.studio-bg {
    background:
        linear-gradient(color-mix(in srgb, var(--studio-accent) 10%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--studio-accent-3) 8%, transparent) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.16) 56%, transparent 96%);
}

.blob {
    display: none;
}

.curve,
.geo {
    opacity: 0.16;
}

.curve,
.geo-ring,
.geo-square {
    border-color: color-mix(in srgb, var(--studio-accent) 22%, transparent);
    box-shadow: none;
}

.geo-triangle {
    border-bottom-color: color-mix(in srgb, var(--studio-accent-2) 18%, transparent);
    filter: none;
}

.geo-line {
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--studio-accent) 34%, transparent), transparent);
    box-shadow: none;
}

.studio-shell {
    width: 100%;
    margin: 0 auto 34px;
}

.studio-sticky-bar {
    top: var(--studio-topbar-offset);
    z-index: 90;
    padding: 16px 0 14px;
    border-bottom: 1px solid var(--studio-line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82)),
        var(--studio-page);
    box-shadow: 0 18px 44px rgba(35, 58, 84, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.studio-hero {
    width: min(1440px, calc(100% - 44px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin: 0 auto 12px;
    padding: 18px 20px;
    border: 1px solid var(--studio-line);
    border-radius: var(--studio-radius-xl);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), color-mix(in srgb, var(--studio-page) 64%, rgba(255, 255, 255, 0.9))),
        #ffffff;
    box-shadow: var(--studio-shadow-md);
}

.title-row {
    min-width: 0;
}

.title-icon {
    width: 46px;
    height: 46px;
    border: 1px solid color-mix(in srgb, var(--studio-accent) 18%, var(--studio-line));
    border-radius: 14px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--studio-accent), var(--studio-accent-3));
    box-shadow: 0 14px 26px color-mix(in srgb, var(--studio-accent) 22%, transparent);
}

.title-icon svg {
    width: 28px;
    height: 28px;
}

.studio-hero h1 {
    color: var(--studio-ink);
    font-size: clamp(1.46rem, 1.8vw, 2.08rem);
    line-height: 1.1;
    letter-spacing: 0;
}

.studio-hero p {
    max-width: 78ch;
    margin-top: 7px;
    color: var(--studio-muted);
    font-size: 0.94rem;
    line-height: 1.58;
}

.hero-actions {
    gap: 8px;
}

.utility-btn,
.export-btn {
    min-height: 42px;
    border-radius: var(--studio-radius-md);
}

.utility-btn {
    border-color: var(--studio-line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--studio-ink);
    box-shadow: none;
}

.utility-btn:hover {
    border-color: var(--studio-line-strong);
    background: color-mix(in srgb, var(--studio-accent) 7%, #ffffff);
    box-shadow: var(--studio-shadow-sm);
}

.utility-btn--split {
    min-width: 166px;
}

.toggle-dot {
    background: color-mix(in srgb, var(--studio-muted) 22%, #ffffff);
}

.toggle-dot::after {
    box-shadow: 0 4px 10px rgba(35, 58, 84, 0.18);
}

.toggle-dot.active {
    background: linear-gradient(135deg, var(--studio-accent), var(--studio-accent-3));
}

.export-btn {
    background: linear-gradient(135deg, var(--studio-accent), color-mix(in srgb, var(--studio-accent) 70%, var(--studio-accent-3)));
    color: #ffffff;
    box-shadow: 0 14px 26px color-mix(in srgb, var(--studio-accent) 24%, transparent);
}

.export-btn:hover {
    box-shadow: 0 18px 34px color-mix(in srgb, var(--studio-accent) 28%, transparent);
}

.studio-action-status {
    top: calc(100% + 10px);
    border-radius: var(--studio-radius-md);
    border-color: var(--studio-line);
    background: #ffffff;
    color: var(--studio-ink);
    box-shadow: var(--studio-shadow-md);
}

.studio-action-status[data-tone="warn"] {
    color: #9a5b08;
    border-color: color-mix(in srgb, #e9a23b 34%, var(--studio-line));
    background: #fff8eb;
}

.mode-tabs {
    width: min(1440px, calc(100% - 44px));
    display: grid;
    grid-template-columns: repeat(9, minmax(120px, 1fr));
    gap: 6px;
    margin: 0 auto;
    padding: 6px;
    border: 1px solid var(--studio-line);
    border-radius: var(--studio-radius-lg);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--studio-shadow-sm);
}

.mode-tab {
    min-width: 0;
    min-height: 46px;
    padding: 8px 9px;
    border-radius: var(--studio-radius-md);
    border-color: transparent;
    background: transparent;
    color: var(--studio-muted);
    box-shadow: none;
    font-size: 0.88rem;
}

.mode-tab:hover {
    border-color: color-mix(in srgb, var(--studio-accent) 18%, var(--studio-line));
    background: color-mix(in srgb, var(--studio-accent) 7%, #ffffff);
    color: var(--studio-ink);
    box-shadow: none;
}

.mode-tab.active {
    color: #ffffff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--studio-accent), var(--studio-accent-3));
    box-shadow: 0 12px 24px color-mix(in srgb, var(--studio-accent) 22%, transparent);
}

.mode-tab-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border-color: color-mix(in srgb, var(--studio-accent) 20%, var(--studio-line));
    color: color-mix(in srgb, var(--studio-accent) 82%, var(--studio-ink));
    background: color-mix(in srgb, var(--studio-accent) 8%, #ffffff);
    box-shadow: none;
}

.mode-tab.active .mode-tab-icon {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.16);
}

.mode-tab.active::after {
    display: none;
}

.mode-tab.is-locked {
    color: color-mix(in srgb, var(--studio-muted) 54%, #ffffff);
    background: color-mix(in srgb, var(--studio-muted) 6%, #ffffff);
}

.mode-tab.is-locked::before {
    top: 3px;
    right: 5px;
    border-color: color-mix(in srgb, var(--studio-accent-2) 26%, var(--studio-line));
    color: color-mix(in srgb, var(--studio-accent-2) 80%, var(--studio-ink));
    background: color-mix(in srgb, var(--studio-accent-2) 8%, #ffffff);
}

.mode-frame-shell {
    width: min(1440px, calc(100% - 44px));
    margin: 16px auto 0;
    padding: 14px;
    border: 1px solid var(--studio-line);
    border-radius: var(--studio-radius-xl);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--studio-shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.mode-frame-toolbar {
    display: flex;
    min-height: 44px;
    padding: 0 4px 12px;
    justify-content: space-between;
    border-bottom: 1px solid color-mix(in srgb, var(--studio-line) 66%, transparent);
    margin-bottom: 12px;
}

.mode-frame-toolbar strong {
    color: var(--studio-ink);
    font-size: 1rem;
}

.mode-frame-toolbar span {
    color: var(--studio-muted);
    font-size: 0.88rem;
}

.mode-frame {
    min-height: 760px;
    border-radius: var(--studio-radius-lg);
    background: #ffffff;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 14px 34px rgba(35, 58, 84, 0.08);
}

.mode-frame-shell.is-frame-loading {
    min-height: 860px;
}

.studio-loading-panel {
    border-radius: var(--studio-radius-lg);
    border-color: color-mix(in srgb, var(--studio-accent) 28%, var(--studio-line));
    background: #ffffff;
    color: var(--studio-ink);
    box-shadow: var(--studio-shadow-lg);
}

.studio-loading-title {
    color: var(--studio-ink);
}

.studio-loading-desc {
    color: var(--studio-muted);
}

@media (max-width: 1180px) {
    .studio-hero {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .hero-actions {
        justify-content: flex-start;
    }

    .mode-tabs {
        grid-template-columns: repeat(9, minmax(126px, 1fr));
    }
}

@media (max-width: 860px) {
    body {
        padding-top: var(--studio-topbar-offset);
    }

    .studio-sticky-bar {
        top: var(--studio-topbar-offset);
        padding: 12px 0 10px;
    }

    .studio-hero,
    .mode-tabs,
    .mode-frame-shell {
        width: calc(100% - 24px);
    }

    .studio-hero {
        padding: 16px;
    }

    .mode-tabs {
        grid-template-columns: repeat(9, minmax(118px, 132px));
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 6px;
    }

    .mode-tab {
        scroll-snap-align: start;
    }

    .mode-frame-shell {
        padding: 12px;
    }
}

@media (max-width: 620px) {
    :root {
        --studio-topbar-offset: 70px;
    }

    body {
        padding-top: var(--studio-topbar-offset);
    }

    .studio-sticky-bar {
        padding: 10px 0 8px;
    }

    .studio-hero,
    .mode-tabs,
    .mode-frame-shell {
        width: calc(100% - 18px);
    }

    .studio-hero h1 {
        font-size: 1.28rem;
    }

    .studio-hero p {
        font-size: 0.86rem;
    }

    .hero-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mode-frame-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .mode-frame {
        min-height: 640px;
    }
}

@media (max-width: 380px) {
    .hero-actions {
        grid-template-columns: 1fr;
    }
}

/* Modes Studio aligned with Index V2 surfaces */
html[data-index-v2-theme],
html[data-index-v2-theme] body,
body {
    --studio-topbar-offset: var(--sheetgenie-topbar-offset, 82px);
    --studio-accent: var(--accent, var(--sgv2-accent, #2587e8));
    --studio-accent-2: var(--accent-2, var(--sgv2-accent-2, #ee6a5f));
    --studio-accent-3: var(--sgv2-accent-3, #1fa98d);
    --studio-page: var(--bg-primary, color-mix(in srgb, var(--studio-accent) 14%, #07152c));
    --studio-page-2: var(--bg-secondary, color-mix(in srgb, var(--studio-accent) 16%, #0b2143));
    --studio-page-3: var(--bg-tertiary, color-mix(in srgb, var(--studio-accent-3) 16%, #123267));
    --studio-surface: var(--index-v2-panel-bg, linear-gradient(165deg, color-mix(in srgb, var(--studio-accent) 22%, rgba(14, 30, 50, 0.76)), color-mix(in srgb, var(--studio-accent-3) 12%, rgba(16, 36, 58, 0.64)) 48%, color-mix(in srgb, var(--studio-accent-2) 15%, rgba(14, 28, 47, 0.7))));
    --studio-surface-solid: rgba(13, 28, 48, 0.9);
    --studio-soft: var(--index-v2-card-bg, linear-gradient(165deg, color-mix(in srgb, var(--studio-accent) 20%, rgba(14, 30, 50, 0.82)), rgba(255, 255, 255, 0.08) 48%, color-mix(in srgb, var(--studio-accent-2) 14%, rgba(13, 25, 42, 0.78))));
    --studio-ink: #f3f8ff;
    --studio-muted: #aec6e9;
    --studio-line: color-mix(in srgb, var(--studio-accent) 24%, rgba(184, 213, 255, 0.16));
    --studio-line-strong: color-mix(in srgb, var(--studio-accent) 42%, rgba(184, 213, 255, 0.22));
    --studio-shadow-lg: 0 28px 72px rgba(3, 10, 18, 0.42);
    --studio-shadow-md: 0 22px 56px rgba(0, 0, 0, 0.24);
    --studio-shadow-sm: 0 16px 36px rgba(4, 18, 36, 0.2);
    --studio-radius-xl: 8px;
    --studio-radius-lg: 8px;
    --studio-radius-md: 8px;
    --studio-radius-sm: 8px;
}

html[data-index-v2-theme],
html[data-index-v2-theme] body,
body {
    color: var(--studio-ink);
    background:
        radial-gradient(circle at 12% 18%, var(--index-v2-glow-a, color-mix(in srgb, var(--studio-accent) 42%, transparent)), transparent 34%),
        radial-gradient(circle at 86% 82%, var(--index-v2-glow-b, color-mix(in srgb, var(--studio-accent-2) 28%, transparent)), transparent 28%),
        linear-gradient(140deg, var(--studio-page) 0%, var(--studio-page-2) 46%, var(--studio-page-3) 100%);
}

html {
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    padding-top: var(--studio-topbar-offset);
    overflow-x: clip;
    overflow-y: visible;
    scrollbar-color: color-mix(in srgb, var(--studio-accent) 42%, rgba(174, 198, 233, 0.48)) transparent;
}

.studio-bg {
    background:
        radial-gradient(circle at 18% 14%, color-mix(in srgb, var(--studio-accent) 18%, transparent), transparent 32%),
        radial-gradient(circle at 84% 72%, color-mix(in srgb, var(--studio-accent-3) 16%, transparent), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 58%);
    background-size: auto;
    opacity: 0.72;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.86), transparent 78%);
}

.blob {
    display: block;
    opacity: 0.45;
}

.blob-a {
    background: var(--studio-accent);
}

.blob-b {
    background: var(--studio-accent-3);
}

.blob-c {
    background: color-mix(in srgb, var(--studio-accent) 62%, #ffffff);
}

.curve,
.geo {
    opacity: 0.24;
}

.curve,
.geo-ring,
.geo-square {
    border-color: color-mix(in srgb, var(--studio-accent) 22%, transparent);
}

.geo-triangle {
    border-bottom-color: color-mix(in srgb, var(--studio-accent-2) 20%, transparent);
}

.geo-line {
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--studio-accent) 34%, transparent), transparent);
}

.studio-shell {
    margin-bottom: 34px;
}

.studio-sticky-bar {
    top: var(--studio-topbar-offset);
    border-bottom-color: var(--studio-line);
    background:
        radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--studio-accent) 18%, transparent), transparent 50%),
        linear-gradient(180deg, rgba(8, 20, 38, 0.86), rgba(8, 20, 38, 0.72));
    box-shadow: 0 18px 44px rgba(2, 8, 18, 0.28);
}

.studio-hero,
.mode-tabs,
.mode-frame-shell,
.studio-loading-panel {
    border-color: var(--studio-line);
    border-radius: var(--studio-radius-xl);
    background: var(--studio-surface);
    box-shadow: var(--studio-shadow-md);
}

.studio-hero {
    width: min(1440px, calc(100% - 44px));
    background: var(--studio-surface);
}

.title-icon,
.mode-tab.active,
.export-btn,
.toggle-dot.active {
    border-color: color-mix(in srgb, var(--studio-accent) 46%, rgba(255, 255, 255, 0.34));
    background: linear-gradient(135deg, var(--studio-accent), color-mix(in srgb, var(--studio-accent) 64%, var(--studio-accent-2)));
    box-shadow: 0 14px 28px color-mix(in srgb, var(--studio-accent) 24%, rgba(4, 12, 24, 0.32));
}

.studio-hero h1,
.mode-frame-toolbar strong,
.template-dock__head h2,
.template-card strong,
.studio-loading-title {
    color: var(--studio-ink);
    letter-spacing: 0;
}

.studio-hero p,
.mode-frame-toolbar span,
.template-card small,
.studio-loading-desc {
    color: var(--studio-muted);
}

.utility-btn,
.studio-action-status,
.template-dock__head button,
.template-dock__tabs button,
.template-dock__tabs a,
.template-dock__tabs input {
    border-color: color-mix(in srgb, var(--studio-accent) 24%, rgba(162, 205, 255, 0.18));
    background: color-mix(in srgb, var(--studio-accent) 12%, rgba(255, 255, 255, 0.08));
    color: var(--studio-ink);
    box-shadow: none;
}

.utility-btn:hover,
.template-dock__head button:hover,
.template-dock__tabs button:hover,
.template-dock__tabs a:hover {
    border-color: var(--studio-line-strong);
    background: color-mix(in srgb, var(--studio-accent) 20%, rgba(255, 255, 255, 0.1));
    box-shadow: var(--studio-shadow-sm);
}

.export-btn:hover {
    box-shadow: 0 18px 34px color-mix(in srgb, var(--studio-accent) 30%, rgba(4, 12, 24, 0.36));
}

.mode-tabs {
    width: min(1440px, calc(100% - 44px));
    background: var(--studio-soft);
}

.mode-tab {
    border-color: transparent;
    background: transparent;
    color: var(--studio-muted);
    box-shadow: none;
}

.mode-tab:hover {
    border-color: color-mix(in srgb, var(--studio-accent) 24%, rgba(162, 205, 255, 0.18));
    background: color-mix(in srgb, var(--studio-accent) 12%, rgba(255, 255, 255, 0.08));
    color: var(--studio-ink);
    box-shadow: none;
}

.mode-tab-icon {
    border-color: color-mix(in srgb, var(--studio-accent) 22%, rgba(162, 205, 255, 0.2));
    color: color-mix(in srgb, var(--studio-accent) 64%, #ffffff);
    background: color-mix(in srgb, var(--studio-accent) 13%, transparent);
    box-shadow: none;
}

.mode-tab.active {
    color: #ffffff;
}

.mode-tab.active .mode-tab-icon {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.16);
}

.mode-tab.is-locked {
    color: color-mix(in srgb, var(--studio-muted) 56%, transparent);
    background: color-mix(in srgb, var(--studio-accent) 7%, rgba(255, 255, 255, 0.04));
}

.mode-tab.is-locked::before,
.studio-action-status[data-tone="warn"] {
    border-color: color-mix(in srgb, var(--studio-accent-2) 34%, var(--studio-line));
    background: color-mix(in srgb, var(--studio-accent-2) 12%, rgba(255, 255, 255, 0.08));
    color: color-mix(in srgb, var(--studio-accent-2) 72%, #ffffff);
}

.mode-frame-shell {
    background: var(--studio-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.mode-frame-toolbar {
    border-bottom-color: color-mix(in srgb, var(--studio-line) 66%, transparent);
}

.mode-frame {
    border-radius: var(--studio-radius-lg);
    background:
        radial-gradient(circle at 26% 0%, color-mix(in srgb, var(--studio-accent) 12%, transparent), transparent 34%),
        rgba(2, 10, 22, 0.38);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--studio-accent) 18%, transparent);
}

.studio-loading-overlay {
    background:
        radial-gradient(circle at center, color-mix(in srgb, var(--studio-accent) 18%, rgba(0, 0, 0, 0.2)), transparent 42%),
        rgba(2, 8, 18, 0.66);
}

.template-dock {
    border: 1px solid var(--studio-line);
    background: var(--studio-surface);
    box-shadow: var(--studio-shadow-sm);
}

.template-card {
    border-color: color-mix(in srgb, var(--studio-accent) 30%, rgba(184, 213, 255, 0.16));
    background: var(--studio-soft);
}

.template-card span {
    background: rgba(244, 248, 255, 0.94);
}

.template-card.active {
    border-color: color-mix(in srgb, var(--studio-accent-3) 58%, rgba(184, 213, 255, 0.2));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--studio-accent-3) 12%, transparent), var(--studio-shadow-sm);
}

@media (max-width: 860px) {
    .studio-hero,
    .mode-tabs,
    .mode-frame-shell {
        width: calc(100% - 24px);
    }
}

@media (max-width: 620px) {
    :root {
        --studio-topbar-offset: var(--sheetgenie-topbar-offset, 74px);
    }

    .studio-hero,
    .mode-tabs,
    .mode-frame-shell {
        width: calc(100% - 18px);
    }
}

/* Single Worksheet Studio */
html[data-index-v2-theme] {
    --studio-v3-topbar-offset: var(--sheetgenie-topbar-offset, 82px);
    --studio-v3-accent: var(--accent, var(--sgv2-accent, #2587e8));
    --studio-v3-accent-2: var(--accent-2, var(--sgv2-accent-2, #ee6a5f));
    --studio-v3-accent-3: var(--sgv2-accent-3, #1fa98d);
    --studio-v3-bg-a: var(--bg-primary, #07152c);
    --studio-v3-bg-b: var(--bg-secondary, #0b2143);
    --studio-v3-bg-c: var(--bg-tertiary, #123267);
    --studio-v3-ink: #f3f8ff;
    --studio-v3-muted: #b6cbea;
    --studio-v3-line: color-mix(in srgb, var(--studio-v3-accent) 24%, rgba(184, 213, 255, 0.16));
    --studio-v3-line-strong: color-mix(in srgb, var(--studio-v3-accent) 44%, rgba(184, 213, 255, 0.26));
    --studio-v3-panel:
        linear-gradient(165deg, color-mix(in srgb, var(--studio-v3-bg-a) 76%, rgba(255, 255, 255, 0.08)), color-mix(in srgb, var(--studio-v3-bg-b) 76%, rgba(255, 255, 255, 0.06)) 48%, color-mix(in srgb, var(--studio-v3-bg-c) 70%, rgba(255, 255, 255, 0.05))),
        color-mix(in srgb, var(--studio-v3-bg-a) 86%, rgba(255, 255, 255, 0.04));
    --studio-v3-panel-strong:
        linear-gradient(165deg, color-mix(in srgb, var(--studio-v3-bg-a) 82%, rgba(255, 255, 255, 0.08)), color-mix(in srgb, var(--studio-v3-bg-b) 80%, rgba(255, 255, 255, 0.06)) 52%, color-mix(in srgb, var(--studio-v3-accent-3) 8%, color-mix(in srgb, var(--studio-v3-bg-c) 84%, rgba(255, 255, 255, 0.05)))),
        color-mix(in srgb, var(--studio-v3-bg-b) 88%, rgba(255, 255, 255, 0.04));
    --studio-v3-panel-soft: color-mix(in srgb, var(--studio-v3-accent) 10%, rgba(255, 255, 255, 0.08));
    --studio-v3-field: color-mix(in srgb, var(--studio-v3-bg-a) 82%, rgba(255, 255, 255, 0.08));
    --studio-v3-shadow: 0 28px 72px rgba(3, 10, 18, 0.42);
    --studio-v3-radius: 8px;
}

html[data-index-v2-theme] body {
    background:
        radial-gradient(circle at 12% 18%, var(--index-v2-glow-a, color-mix(in srgb, var(--studio-v3-accent) 38%, transparent)), transparent 34%),
        radial-gradient(circle at 88% 78%, var(--index-v2-glow-b, color-mix(in srgb, var(--studio-v3-accent-2) 28%, transparent)), transparent 30%),
        linear-gradient(140deg, var(--studio-v3-bg-a) 0%, var(--studio-v3-bg-b) 48%, var(--studio-v3-bg-c) 100%);
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] {
    background: transparent;
}

html[data-index-v2-theme] body.index-v2-legacy {
    background:
        radial-gradient(circle at 12% 18%, var(--index-v2-glow-a), transparent 34%),
        radial-gradient(circle at 86% 82%, var(--index-v2-glow-b), transparent 28%),
        linear-gradient(140deg, var(--bg-primary) 0%, var(--bg-secondary) 46%, var(--bg-tertiary) 100%);
    background-attachment: scroll;
}

html[data-index-v2-theme] .studio-bg {
    background: none;
    opacity: 1;
    mask-image: none;
    -webkit-mask-image: none;
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .blob {
    opacity: 0.45;
    filter: blur(80px);
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .blob-a {
    background: #2f7cf7;
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .blob-b {
    background: #31cbb7;
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .blob-c {
    background: #79b6ff;
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .curve {
    opacity: 1;
    border-color: rgba(143, 193, 255, 0.16);
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .geo {
    opacity: 0.36;
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .geo-ring {
    border-color: rgba(135, 201, 255, 0.28);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.16);
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .geo-square {
    border-color: rgba(126, 189, 255, 0.3);
    box-shadow: 0 0 14px rgba(0, 174, 239, 0.12);
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .geo-triangle {
    border-bottom-color: rgba(124, 196, 255, 0.2);
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.2));
}

html[data-index-v2-theme] body.index-v2-legacy .background-scene .geo-line {
    background: linear-gradient(90deg, rgba(0, 174, 239, 0.02), rgba(125, 206, 255, 0.5), rgba(0, 174, 239, 0.02));
    box-shadow: 0 0 10px rgba(0, 174, 239, 0.2);
}

.studio-v3-shell {
    width: min(1760px, calc(100% - 28px));
    margin: 0 auto;
    padding: clamp(12px, 1.4vw, 18px) 0 42px;
}

.studio-card,
.hero-panel {
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    background: var(--studio-v3-panel);
    box-shadow: var(--studio-v3-shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.studio-v3-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px;
}

.studio-v3-title {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    min-width: 0;
}

.studio-v3-title-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--studio-v3-radius);
    background: linear-gradient(135deg, var(--studio-v3-accent), color-mix(in srgb, var(--studio-v3-accent) 62%, var(--studio-v3-accent-3)));
    box-shadow: 0 16px 34px color-mix(in srgb, var(--studio-v3-accent) 24%, transparent);
}

.studio-v3-title-icon svg,
.studio-v3-actions svg,
.studio-output-actions svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.studio-v3-title h1,
.studio-section-head h2,
.studio-preview-head h2 {
    margin: 0;
    color: var(--studio-v3-ink);
    font-size: clamp(1.12rem, 1.7vw, 1.72rem);
    line-height: 1.18;
}

.studio-v3-title p,
.studio-section-head p,
.studio-preview-head p,
.studio-step-note,
.studio-preview-summary {
    margin: 6px 0 0;
    color: var(--studio-v3-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.studio-v3-actions,
.studio-preview-actions,
.studio-page-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.studio-cta,
.studio-secondary-btn,
.studio-ghost-link,
.studio-icon-btn {
    position: relative;
    overflow: hidden;
    min-height: 42px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    color: var(--studio-v3-ink);
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(3, 10, 20, 0.28),
        0 10px 20px rgba(3, 10, 20, 0.16);
}

.studio-cta::before,
.studio-secondary-btn::before,
.studio-ghost-link::before,
.studio-icon-btn::before,
.studio-mobile-tab::before,
.mode-card::before,
.studio-template-selection-card::before,
.studio-template-fallback-card::before,
.studio-template-card::before,
.studio-advanced-card > summary::before,
.studio-chip::before,
.studio-segment-btn::before,
.studio-check-row::before {
    content: "";
    position: absolute;
    inset: 1px 1px auto 1px;
    height: 48%;
    border-radius: calc(var(--studio-v3-radius) - 2px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
    opacity: 0.72;
    pointer-events: none;
}

.studio-cta {
    border-color: transparent;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
        linear-gradient(135deg, var(--studio-v3-accent), color-mix(in srgb, var(--studio-v3-accent) 62%, var(--studio-v3-accent-2)));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.34),
        inset 0 -2px 0 color-mix(in srgb, var(--studio-v3-accent) 54%, rgba(0, 0, 0, 0.36)),
        0 18px 34px color-mix(in srgb, var(--studio-v3-accent) 28%, transparent);
}

.studio-secondary-btn,
.studio-ghost-link,
.studio-icon-btn {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02) 50%, rgba(3, 10, 20, 0.12)),
        color-mix(in srgb, var(--studio-v3-accent) 12%, rgba(255, 255, 255, 0.08));
}

.studio-cta:hover,
.studio-secondary-btn:hover,
.studio-ghost-link:hover,
.studio-icon-btn:hover {
    transform: translateY(-1px);
    border-color: var(--studio-v3-line-strong);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -2px 0 rgba(3, 10, 20, 0.3),
        0 14px 26px color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(3, 10, 20, 0.22));
}

.studio-secondary-btn:hover,
.studio-ghost-link:hover,
.studio-icon-btn:hover {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 52%, rgba(3, 10, 20, 0.1)),
        color-mix(in srgb, var(--studio-v3-accent) 20%, rgba(255, 255, 255, 0.1));
}

.studio-cta:active,
.studio-secondary-btn:active,
.studio-ghost-link:active,
.studio-icon-btn:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 5px rgba(3, 10, 20, 0.32),
        0 6px 12px rgba(3, 10, 20, 0.18);
}

.studio-cta:focus-visible,
.studio-secondary-btn:focus-visible,
.studio-ghost-link:focus-visible,
.studio-icon-btn:focus-visible,
.mode-card:focus-visible,
.studio-template-card:focus-visible,
.studio-template-selection-card:focus-visible,
.studio-advanced-card > summary:focus-visible,
.studio-chip:focus-within,
.studio-segment-btn:focus-visible,
.studio-check-row:focus-within,
.studio-mobile-tab:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--studio-v3-accent) 36%, rgba(255, 255, 255, 0.42));
    outline-offset: 3px;
}

.studio-secondary-btn--compact,
.studio-icon-btn {
    width: 42px;
    padding: 0;
}

.studio-icon-btn--text {
    width: auto;
    padding: 0 13px;
}

.studio-action-status {
    max-width: 280px;
    min-height: 36px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    display: inline-flex;
    align-items: center;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--studio-v3-accent) 11%, rgba(255, 255, 255, 0.08));
    color: var(--studio-v3-ink);
    font-size: 0.82rem;
    font-weight: 700;
}

.studio-action-status[data-tone="warn"] {
    border-color: color-mix(in srgb, var(--studio-v3-accent-2) 38%, var(--studio-v3-line));
    color: color-mix(in srgb, var(--studio-v3-accent-2) 72%, #ffffff);
}

.studio-mode-strip {
    margin-top: 16px;
    padding: 14px;
}

.studio-section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.studio-mode-rail,
.studio-mode-grid {
    display: grid;
    gap: 10px;
}

.studio-mode-rail {
    grid-template-columns: repeat(8, minmax(112px, 1fr));
}

.studio-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 78px;
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 20%, rgba(184, 213, 255, 0.14));
    border-radius: var(--studio-v3-radius);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: color-mix(in srgb, var(--studio-v3-accent) 8%, rgba(255, 255, 255, 0.06));
    color: var(--studio-v3-muted);
    text-align: left;
    cursor: pointer;
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(3, 10, 20, 0.2),
        0 10px 22px rgba(3, 10, 20, 0.12);
}

.mode-card--rail {
    grid-template-columns: 1fr;
    justify-items: start;
}

.mode-card:hover {
    transform: translateY(-2px);
    border-color: var(--studio-v3-line-strong);
    background: color-mix(in srgb, var(--studio-v3-accent) 14%, rgba(255, 255, 255, 0.09));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(3, 10, 20, 0.24),
        0 16px 30px color-mix(in srgb, var(--studio-v3-accent) 14%, rgba(3, 10, 20, 0.2));
}

.mode-card.is-active {
    border-color: color-mix(in srgb, var(--studio-v3-accent) 58%, rgba(255, 255, 255, 0.18));
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 44%),
        linear-gradient(135deg, color-mix(in srgb, var(--studio-v3-accent) 72%, rgba(255, 255, 255, 0.08)), color-mix(in srgb, var(--studio-v3-accent-3) 38%, rgba(255, 255, 255, 0.1)));
    color: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -2px 0 color-mix(in srgb, var(--studio-v3-accent) 42%, rgba(0, 0, 0, 0.34)),
        0 18px 34px color-mix(in srgb, var(--studio-v3-accent) 24%, transparent);
}

.mode-card:active {
    transform: translateY(1px);
}

.mode-card__icon,
.studio-summary-icon {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    border-radius: var(--studio-v3-radius);
    background: color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(255, 255, 255, 0.1));
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 900;
}

.mode-card__body {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.mode-card__body strong,
.studio-template-name,
.studio-summary-pill {
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.2;
}

.mode-card__body small {
    min-width: 0;
    color: color-mix(in srgb, currentColor 68%, transparent);
    font-size: 0.74rem;
    line-height: 1.25;
}

.mode-card__body em {
    min-width: 0;
    color: color-mix(in srgb, currentColor 78%, transparent);
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 800;
    line-height: 1.2;
}

.mode-card.is-locked {
    cursor: not-allowed;
    opacity: 0.78;
    border-color: rgba(209, 176, 94, 0.34);
    background:
        linear-gradient(180deg, rgba(209, 176, 94, 0.08), transparent 58%),
        color-mix(in srgb, var(--studio-v3-accent) 5%, rgba(255, 255, 255, 0.05));
}

.mode-card.is-locked .mode-card__body em {
    justify-self: start;
    max-width: 100%;
    padding: 2px 7px;
    border: 1px solid rgba(234, 199, 120, 0.34);
    border-radius: 999px;
    background: rgba(234, 179, 8, 0.14);
    color: #ffe3a3;
    white-space: normal;
}

.mode-card.is-locked:hover {
    transform: none;
    box-shadow: var(--studio-v3-shadow-sm);
}

#studioModeSummary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#studioModeSummary span:not(.studio-summary-icon):not(.studio-summary-pill) {
    display: grid;
    gap: 2px;
}

#studioModeSummary strong {
    color: var(--studio-v3-ink);
}

#studioModeSummary small {
    color: var(--studio-v3-muted);
}

.studio-summary-pill {
    border: 1px solid var(--studio-v3-line);
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--studio-v3-ink);
}

.studio-v3-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(700px, 720px) minmax(320px, 1fr);
    justify-content: stretch;
    gap: 14px;
    align-items: start;
    margin-top: 18px;
}

.studio-builder-column,
.studio-preview-column,
.studio-output-column {
    min-width: 0;
    padding: 16px;
}

.studio-builder-column,
.studio-output-column {
    display: grid;
    gap: 14px;
}

.studio-preview-column,
.studio-output-column {
    position: sticky;
    top: calc(var(--studio-v3-topbar-offset, 82px) + 14px);
}

.studio-preview-column {
    display: grid;
    gap: 12px;
}

.studio-output-column {
    align-content: start;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: calc(100dvh - var(--studio-v3-topbar-offset, 82px) - 28px);
    overflow: hidden;
    overscroll-behavior: contain;
}

.studio-step-card {
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(184, 213, 255, 0.14));
    border-radius: var(--studio-v3-radius);
    padding: 12px;
    background: var(--studio-v3-panel-soft);
}

.studio-step-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.studio-step-head span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--studio-v3-accent), var(--studio-v3-accent-3));
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
}

.studio-step-head strong {
    color: var(--studio-v3-ink);
    font-size: 0.94rem;
}

.studio-template-search {
    display: grid;
    gap: 7px;
    margin: 8px 0 12px;
}

.studio-template-search span {
    color: var(--studio-v3-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.studio-template-search input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--studio-v3-accent) 10%, rgba(255, 255, 255, 0.04)), transparent 46%),
        var(--studio-v3-field);
    color: var(--studio-v3-ink);
    font: inherit;
    font-weight: 800;
    outline: none;
    padding: 0 12px;
}

.studio-template-search input::placeholder {
    color: color-mix(in srgb, var(--studio-v3-muted) 72%, transparent);
}

.studio-template-search input:focus {
    border-color: var(--studio-v3-line-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--studio-v3-accent) 20%, transparent);
}

.studio-template-selection {
    display: grid;
    margin: 8px 0 12px;
}

.studio-template-selection-card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    width: 100%;
    min-height: 68px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: var(--studio-v3-ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 52%, rgba(3, 10, 20, 0.12)),
        color-mix(in srgb, var(--studio-v3-accent) 12%, rgba(255, 255, 255, 0.08));
    font: inherit;
    text-align: left;
    cursor: pointer;
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(3, 10, 20, 0.22),
        0 10px 22px rgba(3, 10, 20, 0.12);
}

.studio-template-selection-card:hover {
    transform: translateY(-1px);
    border-color: var(--studio-v3-line-strong);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 52%, rgba(3, 10, 20, 0.1)),
        color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(255, 255, 255, 0.09));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -1px 0 rgba(3, 10, 20, 0.24),
        0 16px 30px color-mix(in srgb, var(--studio-v3-accent) 15%, rgba(3, 10, 20, 0.18));
}

.studio-template-selection-card:active {
    transform: translateY(1px);
}

.studio-template-selection-card.is-expanded {
    border-color: var(--studio-v3-line-strong);
}

.studio-template-selection-icon {
    width: 38px;
    height: 38px;
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 30%, rgba(255, 255, 255, 0.18));
    border-radius: var(--studio-v3-radius);
    display: inline-grid;
    place-items: center;
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--studio-v3-accent), color-mix(in srgb, var(--studio-v3-accent) 58%, var(--studio-v3-accent-3)));
    box-shadow: 0 10px 18px color-mix(in srgb, var(--studio-v3-accent) 20%, rgba(3, 10, 20, 0.2));
}

.studio-template-selection-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.studio-template-selection-copy small {
    color: var(--studio-v3-muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: none;
}

.studio-template-selection-copy strong {
    min-width: 0;
    color: var(--studio-v3-ink);
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.studio-template-selection-action {
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 24%, rgba(255, 255, 255, 0.18));
    border-radius: 999px;
    padding: 7px 9px;
    color: #ffffff;
    background: color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(255, 255, 255, 0.08));
    font-size: 0.76rem;
    font-weight: 900;
    white-space: nowrap;
}

.studio-template-drawer {
    display: grid;
}

.studio-template-drawer[hidden] {
    display: none !important;
}

.studio-template-step.is-template-collapsed .studio-template-selection {
    margin-bottom: 0;
}

.studio-template-fallback {
    display: grid;
    margin-bottom: 12px;
}

.studio-template-fallback-card {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    min-height: 78px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--studio-v3-muted);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02) 52%, rgba(3, 10, 20, 0.1)),
        color-mix(in srgb, var(--studio-v3-accent) 10%, rgba(255, 255, 255, 0.06));
    text-align: left;
    cursor: pointer;
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(3, 10, 20, 0.22),
        0 10px 22px rgba(3, 10, 20, 0.12);
}

.studio-template-fallback-card:hover {
    transform: translateY(-1px);
    border-color: var(--studio-v3-line-strong);
    color: var(--studio-v3-ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03) 54%, rgba(3, 10, 20, 0.1)),
        color-mix(in srgb, var(--studio-v3-accent) 16%, rgba(255, 255, 255, 0.08));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(3, 10, 20, 0.24),
        0 16px 30px color-mix(in srgb, var(--studio-v3-accent) 14%, rgba(3, 10, 20, 0.18));
}

.studio-template-fallback-card:active {
    transform: translateY(1px);
}

.studio-template-fallback-card.is-active {
    border-color: var(--studio-v3-line-strong);
    color: var(--studio-v3-ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 48%),
        color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(255, 255, 255, 0.08));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -2px 0 rgba(3, 10, 20, 0.26),
        0 16px 28px color-mix(in srgb, var(--studio-v3-accent) 16%, rgba(3, 10, 20, 0.2));
}

.studio-template-fallback-card:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--studio-v3-accent) 36%, rgba(255, 255, 255, 0.42));
    outline-offset: 3px;
}

.studio-template-fallback-icon {
    width: 44px;
    height: 44px;
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 24%, rgba(255, 255, 255, 0.18));
    border-radius: var(--studio-v3-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 900;
    background: linear-gradient(135deg, var(--studio-v3-accent), color-mix(in srgb, var(--studio-v3-accent) 62%, var(--studio-v3-accent-3)));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        0 10px 18px color-mix(in srgb, var(--studio-v3-accent) 22%, rgba(3, 10, 20, 0.22));
}

.studio-template-fallback-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.studio-template-fallback-copy strong {
    color: var(--studio-v3-ink);
    font-weight: 900;
    line-height: 1.2;
}

.studio-template-fallback-copy small {
    color: var(--studio-v3-muted);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.35;
}

.studio-template-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    grid-auto-rows: max-content;
    align-items: stretch;
    max-height: clamp(280px, 40dvh, 360px);
    overflow-y: auto;
    overscroll-behavior: auto;
    padding: 1px 8px 1px 1px;
    scrollbar-gutter: stable;
    align-content: start;
    container-type: inline-size;
    --studio-template-thumb-scale: 0.19;
}

.studio-template-gallery::-webkit-scrollbar {
    width: 8px;
}

.studio-template-gallery::-webkit-scrollbar-track {
    background: color-mix(in srgb, var(--studio-v3-accent) 7%, transparent);
    border-radius: 999px;
}

.studio-template-gallery::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--studio-v3-accent) 42%, rgba(255, 255, 255, 0.22));
    border-radius: 999px;
}

.studio-template-card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 198px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 9px;
    background: color-mix(in srgb, var(--studio-v3-accent) 8%, rgba(255, 255, 255, 0.06));
    color: var(--studio-v3-muted);
    text-align: center;
    cursor: pointer;
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(3, 10, 20, 0.2),
        0 10px 22px rgba(3, 10, 20, 0.12);
}

.studio-template-card.is-active {
    border-color: var(--studio-v3-line-strong);
    color: var(--studio-v3-ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 48%),
        color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(255, 255, 255, 0.08));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -2px 0 rgba(3, 10, 20, 0.26),
        0 16px 28px color-mix(in srgb, var(--studio-v3-accent) 16%, rgba(3, 10, 20, 0.2));
}

.studio-template-card:hover:not(.studio-template-card--message) {
    transform: translateY(-2px);
    border-color: var(--studio-v3-line-strong);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(3, 10, 20, 0.24),
        0 16px 30px color-mix(in srgb, var(--studio-v3-accent) 14%, rgba(3, 10, 20, 0.18));
}

.studio-template-card:active:not(.studio-template-card--message) {
    transform: translateY(1px);
}

.studio-template-card--gallery-action {
    position: sticky;
    bottom: 0;
    z-index: 2;
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 46px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    place-items: center;
    text-align: center;
    font-weight: 900;
    color: var(--studio-v3-ink);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--studio-v3-panel) 92%, transparent), color-mix(in srgb, var(--studio-v3-accent) 16%, var(--studio-v3-panel))),
        var(--studio-v3-panel);
    box-shadow: 0 -10px 24px rgba(4, 16, 34, 0.18);
}

.studio-template-card--gallery-action:hover {
    border-color: var(--studio-v3-line-strong);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--studio-v3-accent) 18%, var(--studio-v3-panel)), color-mix(in srgb, var(--studio-v3-accent-3) 16%, var(--studio-v3-panel))),
        var(--studio-v3-panel);
}

.studio-template-card--message {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 56px;
    display: grid;
    place-items: center;
    color: var(--studio-v3-muted);
    font-weight: 900;
    cursor: default;
    background: color-mix(in srgb, var(--studio-v3-accent-2) 10%, rgba(255, 255, 255, 0.05));
}

.studio-template-thumb {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 210 / 297;
    min-height: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(12, 31, 56, 0.1);
}

.studio-template-thumb .review-template-page,
.studio-template-thumb-page {
    position: absolute !important;
    left: 50%;
    top: 50%;
    margin: 0 !important;
    transform: translate(-50%, -50%) scale(var(--studio-template-thumb-scale));
    transform-origin: center center;
    box-shadow: none !important;
    border-radius: 0 !important;
    pointer-events: none;
}

.studio-template-thumb-fallback {
    display: block;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(#edf4ff 0 0) 11px 16px / 30px 4px no-repeat,
        linear-gradient(#d7e6f8 0 0) 10px 30px / 34px 3px no-repeat,
        linear-gradient(#d7e6f8 0 0) 10px 40px / 28px 3px no-repeat,
        #ffffff;
}

.studio-template-name {
    display: -webkit-box;
    min-width: 0;
    min-height: 2.35em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-wrap: balance;
}

@media (max-width: 560px) {
    .studio-template-gallery {
        --studio-template-thumb-scale: 0.326;
    }

    .studio-template-thumb {
        width: min(100%, 290px);
        justify-self: center;
    }
}

.studio-settings-panel {
    display: grid;
    gap: 12px;
}

.studio-advanced-card {
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(184, 213, 255, 0.14));
    border-radius: var(--studio-v3-radius);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--studio-v3-accent) 8%, rgba(255, 255, 255, 0.06)), rgba(255, 255, 255, 0.035)),
        var(--studio-v3-panel-soft);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 10px 24px rgba(3, 10, 20, 0.1);
}

.studio-advanced-card > summary {
    position: relative;
    overflow: hidden;
    min-height: 62px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--studio-v3-ink);
    cursor: pointer;
    list-style: none;
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease;
}

.studio-advanced-card > summary::-webkit-details-marker {
    display: none;
}

.studio-advanced-card > summary:hover {
    background: color-mix(in srgb, var(--studio-v3-accent) 12%, rgba(255, 255, 255, 0.04));
}

.studio-advanced-card > summary:active {
    transform: translateY(1px);
}

.studio-advanced-icon {
    width: 36px;
    height: 36px;
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 28%, rgba(255, 255, 255, 0.18));
    border-radius: var(--studio-v3-radius);
    display: inline-grid;
    place-items: center;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--studio-v3-accent), color-mix(in srgb, var(--studio-v3-accent) 58%, var(--studio-v3-accent-3)));
    box-shadow: 0 10px 18px color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(3, 10, 20, 0.2));
}

.studio-advanced-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.studio-advanced-copy strong {
    color: var(--studio-v3-ink);
    font-size: 0.92rem;
    font-weight: 900;
    line-height: 1.2;
}

.studio-advanced-copy small {
    color: var(--studio-v3-muted);
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.35;
}

.studio-advanced-caret {
    width: 30px;
    height: 30px;
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 22%, rgba(255, 255, 255, 0.16));
    border-radius: var(--studio-v3-radius);
    display: inline-grid;
    place-items: center;
    color: var(--studio-v3-ink);
    background: color-mix(in srgb, var(--studio-v3-accent) 10%, rgba(255, 255, 255, 0.06));
    font-weight: 900;
    transition: transform 0.16s ease;
}

.studio-advanced-card[open] .studio-advanced-caret {
    transform: rotate(180deg);
}

.studio-advanced-body {
    display: grid;
    gap: 12px;
    padding: 0 12px 12px;
}

.studio-advanced-group {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    background: rgba(255, 255, 255, 0.045);
}

.studio-advanced-group h3 {
    margin: 0;
    color: var(--studio-v3-ink);
    font-size: 0.88rem;
    line-height: 1.25;
}

.studio-output-summary {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-content: start;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.studio-output-summary-item {
    min-width: 0;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    display: grid;
    gap: 4px;
    padding: 10px;
    background: color-mix(in srgb, var(--studio-v3-accent) 10%, rgba(255, 255, 255, 0.06));
}

.studio-output-summary-item--wide {
    grid-column: 1 / -1;
}

.studio-output-summary-item span {
    color: var(--studio-v3-muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.studio-output-summary-item strong {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--studio-v3-ink);
    font-size: 0.92rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.studio-output-summary-item i {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    border-radius: var(--studio-v3-radius);
    background: linear-gradient(135deg, var(--studio-v3-accent), var(--studio-v3-accent-3));
    color: #ffffff;
    font-style: normal;
    font-size: 0.72rem;
}

.studio-action-card {
    position: static;
    z-index: 1;
    align-self: stretch;
    border-color: color-mix(in srgb, var(--studio-v3-accent) 36%, rgba(255, 255, 255, 0.18));
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--studio-v3-panel) 92%, transparent), color-mix(in srgb, var(--studio-v3-accent) 12%, var(--studio-v3-panel)) 62%, var(--studio-v3-panel)),
        var(--studio-v3-panel);
    box-shadow:
        0 -16px 34px rgba(3, 10, 20, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.studio-shared-card {
    min-height: 0;
    overflow: visible;
    overscroll-behavior: contain;
}

.studio-output-actions {
    display: grid;
    gap: 10px;
}

.studio-output-btn {
    width: 100%;
}

.studio-export-rng-check {
    width: 100%;
}

.studio-output-btn--primary {
    min-height: 58px;
    font-size: 1rem;
    letter-spacing: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.34),
        inset 0 -2px 0 color-mix(in srgb, var(--studio-v3-accent) 44%, rgba(0, 0, 0, 0.42)),
        0 18px 34px color-mix(in srgb, var(--studio-v3-accent) 32%, rgba(3, 10, 20, 0.22));
}

#studioExportBtn.studio-output-btn--primary {
    min-height: 58px;
    padding-block: 0;
}

.studio-output-actions .studio-action-status {
    position: static;
    inset: auto;
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    justify-content: center;
    text-align: center;
}

.studio-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.studio-settings-group {
    display: grid;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.studio-settings-group:first-child {
    padding-top: 0;
    border-top: 0;
}

.studio-settings-group h3 {
    margin: 0;
    color: var(--studio-v3-ink);
    font-size: 0.82rem;
    font-weight: 900;
}

.studio-field {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.studio-field--wide {
    grid-column: 1 / -1;
}

.studio-field > span,
.studio-check-row span {
    color: var(--studio-v3-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.studio-field input,
.studio-field select,
.studio-page-input-label input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    background: var(--studio-v3-field);
    color: var(--studio-v3-ink);
    font: inherit;
    font-weight: 700;
    padding: 0 11px;
    outline: none;
}

.studio-field input:focus,
.studio-field select:focus,
.studio-page-input-label input:focus {
    border-color: var(--studio-v3-line-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--studio-v3-accent) 24%, transparent);
}

.studio-chip-grid,
.studio-segment {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.studio-chip-grid--operations,
.studio-chip-grid--fraction-types {
    gap: 10px;
}

.studio-chip,
.studio-segment-btn,
.studio-check-row {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--studio-v3-accent) 8%, rgba(255, 255, 255, 0.06));
    color: var(--studio-v3-muted);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transform: translateY(0);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        background 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(3, 10, 20, 0.2),
        0 8px 18px rgba(3, 10, 20, 0.1);
}

.studio-chip input,
.studio-check-row input {
    accent-color: var(--studio-v3-accent);
}

.studio-chip--operation-symbol {
    width: 68px;
    min-height: 52px;
    display: inline-grid;
    place-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    border-radius: 8px;
}

.studio-chip--fraction-type.studio-chip--operation-symbol {
    width: 86px;
    min-height: 64px;
    grid-template-rows: 28px auto;
    align-content: center;
    gap: 3px;
    padding: 6px 7px;
}

.studio-chip--operation-symbol input {
    position: absolute;
    opacity: 0;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    cursor: pointer;
}

.studio-operation-symbol {
    position: relative;
    z-index: 1;
    pointer-events: none;
    display: block;
    width: 28px;
    height: 28px;
    color: currentColor;
    font-size: 0;
    line-height: 0;
    filter: drop-shadow(0 2px 5px rgba(3, 10, 20, 0.2));
}

.studio-chip--fraction-type .studio-operation-symbol {
    width: 25px;
    height: 25px;
}

.studio-operation-symbol[data-operation-symbol="div"] {
    background:
        radial-gradient(circle at 50% 23%, currentColor 0 3px, transparent 3.2px),
        linear-gradient(currentColor, currentColor),
        radial-gradient(circle at 50% 77%, currentColor 0 3px, transparent 3.2px);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%, 22px 4px, 100% 100%;
}

.studio-operation-caption {
    position: relative;
    z-index: 1;
    pointer-events: none;
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: currentColor;
    font-size: 0.56rem;
    font-weight: 900;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-operation-symbol::before,
.studio-operation-symbol::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.studio-operation-symbol[data-operation-symbol="add"]::before,
.studio-operation-symbol[data-operation-symbol="sub"]::before,
.studio-operation-symbol[data-operation-symbol="div"]::before {
    width: 24px;
    height: 4px;
}

.studio-operation-symbol[data-operation-symbol="add"]::after {
    width: 4px;
    height: 24px;
}

.studio-operation-symbol[data-operation-symbol="mul"]::before,
.studio-operation-symbol[data-operation-symbol="mul"]::after {
    width: 26px;
    height: 4px;
}

.studio-operation-symbol[data-operation-symbol="mul"]::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.studio-operation-symbol[data-operation-symbol="mul"]::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.studio-operation-symbol[data-operation-symbol="div"]::after {
    top: 4.25px;
    width: 5.5px;
    height: 5.5px;
    transform: translateX(-50%);
    box-shadow: 0 14px 0 currentColor;
}

.studio-operation-symbol[data-operation-symbol="div"]::before,
.studio-operation-symbol[data-operation-symbol="div"]::after {
    display: none;
}

.studio-operation-symbol[data-operation-symbol="compare"]::before,
.studio-operation-symbol[data-operation-symbol="compare"]::after {
    width: 11px;
    height: 11px;
    background: transparent;
    border-radius: 2px;
    border-top: 4px solid currentColor;
    border-right: 4px solid currentColor;
}

.studio-operation-symbol[data-operation-symbol="compare"]::before {
    transform: translate(-88%, -50%) rotate(-135deg);
}

.studio-operation-symbol[data-operation-symbol="compare"]::after {
    transform: translate(-12%, -50%) rotate(45deg);
}

.studio-operation-symbol[data-operation-symbol="simplify"]::before,
.studio-operation-symbol[data-operation-symbol="simplify"]::after {
    width: 23px;
    height: 4px;
}

.studio-operation-symbol[data-operation-symbol="simplify"]::before {
    top: 10px;
    transform: translateX(-50%);
}

.studio-operation-symbol[data-operation-symbol="simplify"]::after {
    top: 18px;
    transform: translateX(-50%);
}

.studio-chip:has(input:checked),
.studio-check-row:has(input:checked),
.studio-segment-btn.is-active {
    border-color: color-mix(in srgb, var(--studio-v3-accent) 58%, rgba(255, 255, 255, 0.16));
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 46%),
        linear-gradient(135deg, color-mix(in srgb, var(--studio-v3-accent) 72%, rgba(255, 255, 255, 0.08)), color-mix(in srgb, var(--studio-v3-accent-3) 34%, rgba(255, 255, 255, 0.1)));
    color: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -2px 0 rgba(3, 10, 20, 0.26),
        0 12px 24px color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(3, 10, 20, 0.18));
}

.studio-segment-btn.is-template-unsupported {
    cursor: not-allowed;
    opacity: 0.72;
    border-color: color-mix(in srgb, #f59e0b 42%, var(--studio-v3-line));
    color: color-mix(in srgb, var(--studio-v3-muted) 72%, #f59e0b);
}

.studio-segment-btn.is-template-unsupported:hover {
    transform: none;
    background: color-mix(in srgb, #f59e0b 12%, var(--studio-v3-panel-soft));
}

.studio-chip:hover,
.studio-segment-btn:hover,
.studio-check-row:hover {
    transform: translateY(-1px);
    border-color: var(--studio-v3-line-strong);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03) 52%, rgba(3, 10, 20, 0.1)),
        color-mix(in srgb, var(--studio-v3-accent) 16%, rgba(255, 255, 255, 0.08));
}

.studio-chip:active,
.studio-segment-btn:active,
.studio-check-row:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 5px rgba(3, 10, 20, 0.28),
        0 5px 10px rgba(3, 10, 20, 0.12);
}

.studio-chip small {
    font-size: 0.72rem;
    color: currentColor;
}

.studio-preview-head,
.studio-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.studio-preview-toolbar {
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    padding: 10px;
    background: color-mix(in srgb, var(--studio-v3-accent) 9%, rgba(255, 255, 255, 0.06));
}

.studio-page-input-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    padding: 0 9px;
    background: rgba(3, 12, 25, 0.42);
    color: var(--studio-v3-muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.studio-page-input-label input {
    width: 58px;
    min-height: 32px;
    padding: 0 8px;
    text-align: center;
}

.studio-preview-workspace {
    min-height: 680px;
    border: 1px solid color-mix(in srgb, var(--studio-v3-accent) 22%, rgba(184, 213, 255, 0.14));
    border-radius: var(--studio-v3-radius);
    background:
        linear-gradient(color-mix(in srgb, var(--studio-v3-accent) 9%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--studio-v3-accent-3) 8%, transparent) 1px, transparent 1px),
        rgba(2, 9, 20, 0.72);
    background-size: 32px 32px;
    overflow: auto;
}

.studio-preview-stage {
    --studio-preview-scale: 0.78;
    box-sizing: border-box;
    width: max-content;
    min-width: 100%;
    min-height: 660px;
    display: grid;
    justify-items: center;
    align-content: center;
    padding: 16px;
}

.studio-preview-paper-wrap {
    position: relative;
    width: calc(210mm * var(--studio-preview-scale));
    height: calc(297mm * var(--studio-preview-scale));
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
}

.studio-preview-paper-wrap .review-template-page {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    transform: scale(var(--studio-preview-scale));
    transform-origin: top left;
    box-shadow: none;
}

.studio-preview-paper-wrap:has([data-template-item-id="robot_user_blank_background_underlay"]) {
    overflow: hidden;
}

.studio-preview-paper-wrap:has([data-template-item-id="robot_user_blank_background_underlay"]) .review-template-page {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: top left;
}

.studio-empty-state {
    min-height: 360px;
    display: grid;
    place-items: center;
    gap: 6px;
    color: var(--studio-v3-muted);
    text-align: center;
}

.studio-empty-state strong {
    color: var(--studio-v3-ink);
}

.studio-mobile-tabs {
    display: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.studio-mobile-tab {
    position: relative;
    overflow: hidden;
    min-height: 44px;
    border: 1px solid var(--studio-v3-line);
    border-radius: var(--studio-v3-radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 50%, rgba(3, 10, 20, 0.12)),
        color-mix(in srgb, var(--studio-v3-accent) 10%, rgba(255, 255, 255, 0.08));
    color: var(--studio-v3-muted);
    font: inherit;
    font-weight: 900;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(3, 10, 20, 0.22),
        0 10px 20px rgba(3, 10, 20, 0.14);
}

body[data-studio-view="settings"] #studioMobileSettingsTab,
body[data-studio-view="preview"] #studioMobilePreviewTab,
body[data-studio-view="output"] #studioMobileOutputTab {
    border-color: transparent;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 46%),
        linear-gradient(135deg, var(--studio-v3-accent), color-mix(in srgb, var(--studio-v3-accent) 62%, var(--studio-v3-accent-2)));
    color: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 0 rgba(3, 10, 20, 0.28),
        0 14px 26px color-mix(in srgb, var(--studio-v3-accent) 22%, rgba(3, 10, 20, 0.16));
}

.studio-pdf-render-root .review-template-page {
    margin: 0;
    box-shadow: none !important;
}

html[data-index-v2-theme] .mode-card,
html[data-index-v2-theme] .studio-step-card,
html[data-index-v2-theme] .studio-template-selection-card,
html[data-index-v2-theme] .studio-template-fallback-card,
html[data-index-v2-theme] .studio-template-card,
html[data-index-v2-theme] .studio-advanced-card,
html[data-index-v2-theme] .studio-advanced-group,
html[data-index-v2-theme] .studio-output-summary-item,
html[data-index-v2-theme] .studio-preview-toolbar,
html[data-index-v2-theme] .studio-page-input-label,
html[data-index-v2-theme] .studio-action-card,
html[data-index-v2-theme] .studio-mobile-tab {
    border-color: var(--studio-v3-line);
    background: var(--studio-v3-panel-soft);
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] .studio-step-card,
html[data-index-v2-theme] .studio-action-card {
    background: var(--studio-v3-panel-strong);
}

html[data-index-v2-theme] .studio-template-card--gallery-action,
html[data-index-v2-theme] .studio-template-card--message {
    background: var(--studio-v3-panel-soft);
}

html[data-index-v2-theme] .mode-card:hover,
html[data-index-v2-theme] .studio-template-selection-card:hover,
html[data-index-v2-theme] .studio-template-fallback-card:hover,
html[data-index-v2-theme] .studio-template-card:hover:not(.studio-template-card--message),
html[data-index-v2-theme] .studio-chip:hover,
html[data-index-v2-theme] .studio-segment-btn:hover,
html[data-index-v2-theme] .studio-check-row:hover {
    border-color: var(--studio-v3-line-strong);
    background: color-mix(in srgb, var(--studio-v3-accent) 16%, rgba(255, 255, 255, 0.1));
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] .studio-template-selection-card.is-expanded,
html[data-index-v2-theme] .studio-template-fallback-card.is-active,
html[data-index-v2-theme] .studio-template-card.is-active {
    border-color: var(--studio-v3-line-strong);
    background: color-mix(in srgb, var(--studio-v3-accent) 16%, rgba(255, 255, 255, 0.1));
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] .studio-field input,
html[data-index-v2-theme] .studio-field select,
html[data-index-v2-theme] .studio-page-input-label input,
html[data-index-v2-theme] .studio-template-search input {
    border-color: var(--studio-v3-line);
    background: var(--studio-v3-field);
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] .studio-chip,
html[data-index-v2-theme] .studio-segment-btn,
html[data-index-v2-theme] .studio-check-row,
html[data-index-v2-theme] .studio-output-summary-item,
html[data-index-v2-theme] .studio-summary-pill {
    border-color: var(--studio-v3-line);
    background: var(--studio-v3-panel-soft);
    color: var(--studio-v3-muted);
}

html[data-index-v2-theme] .studio-chip:has(input:checked),
html[data-index-v2-theme] .studio-check-row:has(input:checked),
html[data-index-v2-theme] .studio-segment-btn.is-active,
html[data-index-v2-theme] .mode-card.is-active {
    border-color: color-mix(in srgb, var(--studio-v3-accent) 58%, rgba(255, 255, 255, 0.16));
    background: linear-gradient(135deg, var(--studio-v3-accent), color-mix(in srgb, var(--studio-v3-accent) 64%, var(--studio-v3-accent-2)));
    color: #ffffff;
}

html[data-index-v2-theme] .mode-card.is-locked {
    border-color: color-mix(in srgb, var(--studio-v3-accent) 24%, rgba(184, 213, 255, 0.14));
    background: color-mix(in srgb, var(--studio-v3-bg-a) 78%, rgba(255, 255, 255, 0.06));
}

html[data-index-v2-theme] .studio-preview-workspace {
    border-color: var(--studio-v3-line);
    background:
        linear-gradient(color-mix(in srgb, var(--studio-v3-accent) 8%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--studio-v3-accent-3) 7%, transparent) 1px, transparent 1px),
        color-mix(in srgb, var(--studio-v3-bg-a) 90%, rgba(255, 255, 255, 0.03));
    background-size: 32px 32px;
}

html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-account-menu,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-mobile-menu {
    border-color: var(--studio-v3-line);
    background: var(--studio-v3-panel);
    color: var(--studio-v3-ink);
    box-shadow: var(--studio-v3-shadow);
}

html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-menu-summary,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-mobile-account,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-mobile-theme,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-mobile-lang {
    border-color: var(--studio-v3-line);
    background: var(--studio-v3-panel-strong);
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-menu-item,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-mobile-menu a,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-mobile-logout {
    border-color: color-mix(in srgb, var(--studio-v3-accent) 18%, rgba(184, 213, 255, 0.12));
    background: var(--studio-v3-panel-soft);
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-menu-summary strong,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-menu-item-label {
    color: var(--studio-v3-ink);
}

html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-menu-email,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-menu-item-arrow,
html[data-index-v2-theme] body.has-site-topbar-v2 .sgv2-mobile-label {
    color: var(--studio-v3-muted);
}

@media (min-width: 1421px) {
    .studio-v3-workspace {
        height: auto;
        max-height: none;
        grid-template-rows: auto;
        align-items: start;
        overflow: visible;
    }

    .studio-builder-column {
        min-height: 0;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .studio-preview-column,
    .studio-output-column {
        min-height: 0;
        height: calc(100dvh - var(--studio-v3-topbar-offset, 82px) - 28px);
        max-height: calc(100dvh - var(--studio-v3-topbar-offset, 82px) - 28px);
    }

    .studio-builder-column {
        align-content: start;
        overscroll-behavior: auto;
    }

    .studio-template-gallery {
        max-height: clamp(280px, 40dvh, 360px);
        overflow-y: auto;
        overscroll-behavior: auto;
        padding-right: 8px;
        scrollbar-gutter: stable;
    }

    .studio-preview-column,
    .studio-output-column {
        position: sticky;
        top: calc(var(--studio-v3-topbar-offset, 82px) + 14px);
        overflow: clip;
        overscroll-behavior: contain;
    }

    .studio-preview-column {
        grid-template-rows: auto auto minmax(0, 1fr);
    }

    .studio-preview-workspace {
        min-height: 0;
    }

    .studio-preview-stage {
        min-height: 100%;
    }

    .studio-output-summary {
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 4px;
        scrollbar-gutter: stable;
    }

    .studio-output-column {
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .studio-action-card {
        align-self: stretch;
    }
}

@media (max-width: 1420px) {
    .studio-v3-workspace {
        grid-template-columns: minmax(320px, 1fr) minmax(700px, 720px);
    }

    .studio-output-column {
        grid-column: 2;
        position: static;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
        grid-template-rows: auto auto;
        align-items: start;
        max-height: none;
        overflow: visible;
    }

    .studio-shared-card {
        overflow: visible;
    }

    .studio-output-column > .studio-section-head {
        grid-column: 1 / -1;
    }

    .studio-output-summary {
        grid-column: 1;
        grid-row: 2;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        padding-right: 0;
    }

    .studio-action-card {
        grid-column: 2;
        grid-row: 2;
        align-self: start;
    }

    .studio-output-summary-item--wide {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1420px) {
    .studio-mode-rail {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .studio-v3-workspace {
        grid-template-columns: 1fr;
    }

    .studio-preview-column,
    .studio-output-column {
        position: static;
    }

    .studio-output-column,
    .studio-output-summary {
        grid-template-columns: 1fr;
    }

    .studio-output-column {
        grid-column: 1;
        max-height: none;
        overflow: visible;
    }

    .studio-output-summary,
    .studio-action-card {
        grid-row: auto;
    }

    .studio-shared-card,
    .studio-action-card,
    .studio-output-summary-item--wide {
        grid-column: 1;
    }

    .studio-mobile-tabs {
        display: grid;
    }

    body[data-studio-view="settings"] .studio-preview-column,
    body[data-studio-view="settings"] .studio-output-column,
    body[data-studio-view="preview"] .studio-builder-column,
    body[data-studio-view="preview"] .studio-output-column,
    body[data-studio-view="output"] .studio-builder-column,
    body[data-studio-view="output"] .studio-preview-column {
        display: none;
    }
}

@media (max-width: 1060px) {
    .studio-v3-shell {
        width: min(100% - 24px, 980px);
        padding-top: 12px;
    }

    .studio-v3-hero,
    .studio-section-head,
    .studio-preview-head,
    .studio-preview-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .studio-v3-hero {
        grid-template-columns: 1fr;
    }

    .studio-v3-actions {
        width: 100%;
    }

    .studio-cta,
    .studio-secondary-btn,
    .studio-ghost-link {
        flex: 1 1 auto;
    }

    .studio-mode-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .studio-v3-workspace {
        grid-template-columns: 1fr;
    }

    .studio-preview-column,
    .studio-output-column {
        position: static;
    }

    .studio-output-column,
    .studio-output-summary {
        grid-template-columns: 1fr;
    }

    .studio-output-summary,
    .studio-action-card {
        grid-row: auto;
    }

    .studio-shared-card,
    .studio-action-card,
    .studio-output-summary-item--wide {
        grid-column: 1;
    }

    .studio-mobile-tabs {
        display: grid;
    }

    body[data-studio-view="settings"] .studio-preview-column,
    body[data-studio-view="settings"] .studio-output-column,
    body[data-studio-view="preview"] .studio-builder-column,
    body[data-studio-view="preview"] .studio-output-column,
    body[data-studio-view="output"] .studio-builder-column,
    body[data-studio-view="output"] .studio-preview-column {
        display: none;
    }
}

@media (max-width: 560px) {
    .studio-v3-shell {
        width: min(100% - 16px, 480px);
    }

    .studio-v3-title {
        grid-template-columns: 1fr;
    }

    .studio-mode-grid,
    .studio-template-gallery,
    .studio-field-grid {
        grid-template-columns: 1fr;
    }

    .studio-mode-rail {
        grid-auto-flow: column;
        grid-auto-columns: minmax(116px, 132px);
        grid-template-columns: none;
        grid-template-rows: 1fr;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        padding-bottom: 4px;
    }

    .studio-mode-rail .mode-card {
        scroll-snap-align: start;
    }

    body[data-studio-view="preview"] .studio-mode-strip,
    body[data-studio-view="output"] .studio-mode-strip {
        padding: 12px;
    }

    body[data-studio-view="preview"] .studio-mode-strip .studio-section-head,
    body[data-studio-view="output"] .studio-mode-strip .studio-section-head {
        margin-bottom: 0;
    }

    body[data-studio-view="preview"] .studio-mode-rail,
    body[data-studio-view="output"] .studio-mode-rail {
        display: none;
    }

    .studio-preview-column {
        padding: 12px;
    }

    .studio-preview-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .studio-preview-actions .studio-icon-btn {
        width: 100%;
    }

    .studio-preview-toolbar {
        gap: 8px;
        padding: 8px;
    }

    .studio-preview-workspace {
        min-height: 520px;
    }

    .studio-preview-stage {
        --studio-preview-scale: 0.42;
        min-height: 500px;
        padding: 14px 6px;
    }

    .studio-page-switcher {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        width: 100%;
        gap: 8px;
        justify-content: stretch;
    }

    .studio-page-switcher .studio-secondary-btn {
        min-width: 0;
        width: 44px;
        padding: 0;
    }

    .studio-page-input-label {
        min-width: 0;
        width: 100%;
        justify-content: center;
        gap: 5px;
        padding: 0 6px;
        white-space: nowrap;
    }

    .studio-page-input-label span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .studio-page-input-label input {
        flex: 0 0 46px;
        width: 46px;
        min-width: 46px;
        padding: 0 6px;
    }
}

@media (max-width: 380px) {
    .studio-preview-column {
        padding: 10px;
    }

    .studio-preview-stage {
        --studio-preview-scale: 0.38;
        padding-inline: 4px;
    }

    .studio-page-switcher {
        grid-template-columns: 40px minmax(0, 1fr) 40px;
        gap: 6px;
    }

    .studio-page-switcher .studio-secondary-btn {
        width: 40px;
    }
}
