/* Kufic Studio V2 — professional editor shell layered over the proven renderer. */
:root {
    --v2-rail: 68px;
    --v2-inspector: clamp(330px, 24vw, 382px);
    --v2-header: 60px;
    --v2-gold: #d7b75a;
    --v2-gold-strong: #f0cf70;
    --v2-ink: #0a0b0d;
    --v2-panel: #121417;
    --v2-panel-2: #181b1f;
    --v2-line: rgba(232, 207, 137, .18);
    --v2-muted: #a9adb4;
    --v2-danger: #e46f67;
    --v2-focus: #f1d27a;
}

body.studio-v2 {
    background: #090b0e;
    color: #f3efe5;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.studio-v2 header {
    height: var(--v2-header);
    min-height: var(--v2-header);
    max-height: var(--v2-header);
    padding: 0 16px;
    background: linear-gradient(180deg, #131518 0%, #0b0d10 100%);
    border-bottom: 1px solid rgba(215, 183, 90, .32);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
    z-index: 80;
}

.v2-app-header {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto minmax(250px, 1fr);
    align-items: center;
    gap: 16px;
}

.v2-brand,
.v2-header-center,
.v2-header-actions {
    display: flex;
    align-items: center;
    min-width: 0;
}

.v2-brand { gap: 12px; }
.v2-header-center { justify-content: center; gap: 8px; }
.v2-header-actions { justify-content: flex-end; gap: 8px; }

.v2-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(215, 183, 90, .62);
    color: var(--v2-gold-strong);
    font-family: "Kufi Legacy", serif;
    font-size: 24px;
    line-height: 1;
    background: rgba(215, 183, 90, .06);
}

.v2-brand-copy { min-width: 0; }
.v2-brand-title {
    display: block;
    color: #ead897;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    letter-spacing: .08em;
    white-space: nowrap;
}
.v2-brand-subtitle {
    display: block;
    margin-top: 2px;
    color: #777d86;
    font-size: 9px;
    letter-spacing: .17em;
    text-transform: uppercase;
}

.v2-project-name {
    width: min(210px, 24vw);
    height: 36px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #eee8da;
    background: transparent;
    font: inherit;
    font-size: 12px;
    user-select: text;
}
.v2-project-name:hover,
.v2-project-name:focus { border-color: var(--v2-line); background: rgba(255, 255, 255, .035); }

.v2-header-btn,
.v2-icon-btn,
.v2-tool,
.v2-tab,
.v2-action,
.v2-layer-action,
.v2-sheet-close {
    appearance: none;
    border: 1px solid var(--v2-line);
    color: #d8dbe0;
    background: #14171b;
    cursor: pointer;
    font: inherit;
    transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.v2-header-btn,
.v2-icon-btn {
    min-width: 38px;
    min-height: 36px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
    font-size: 11px;
}
.v2-icon-btn { width: 38px; padding: 0; }
.v2-header-btn:hover:not(:disabled),
.v2-icon-btn:hover:not(:disabled),
.v2-action:hover:not(:disabled),
.v2-layer-action:hover:not(:disabled) { color: #fff3c8; border-color: rgba(215, 183, 90, .6); background: rgba(215, 183, 90, .09); }
.v2-header-btn:disabled,
.v2-icon-btn:disabled,
.v2-action:disabled { opacity: .34; cursor: not-allowed; }

.v2-app-header svg,
.v2-tool svg,
.v2-action svg,
.v2-layer-action svg,
.v2-sheet-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.studio-v2 .language-switch {
    margin: 0;
    border-color: var(--v2-line);
    background: #14171b;
}
.studio-v2 .language-switch button { min-height: 34px; }

.studio-v2 .workspace {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: grid;
    grid-template-columns: var(--v2-rail) minmax(0, 1fr) var(--v2-inspector);
    grid-template-areas: "rail stage inspector";
    direction: ltr;
    overflow: hidden;
    background: #090b0e;
}

.v2-tool-rail {
    grid-area: rail;
    position: relative;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 9px 7px 10px;
    gap: 5px;
    background: linear-gradient(90deg, #101216, #0c0e11);
    border-right: 1px solid var(--v2-line);
    overflow-y: auto;
    scrollbar-width: none;
}
.v2-tool-rail::-webkit-scrollbar { display: none; }

.v2-tool {
    min-width: 52px;
    min-height: 54px;
    padding: 6px 3px;
    border-color: transparent;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #b9bdc3;
    background: transparent;
    font-size: 9px;
    line-height: 1.15;
}
.v2-tool svg { width: 21px; height: 21px; }
.v2-tool:hover,
.v2-tool.is-active {
    color: #f3d77c;
    border-color: rgba(215, 183, 90, .42);
    background: linear-gradient(145deg, rgba(215, 183, 90, .16), rgba(215, 183, 90, .05));
}
.v2-tool[data-action="delete"] { margin-top: auto; color: #cd8a85; }
.v2-tool[data-action="delete"]:hover { color: #ffaaa3; border-color: rgba(228, 111, 103, .42); background: rgba(228, 111, 103, .08); }

.studio-v2 .stage-area {
    grid-area: stage;
    min-width: 0;
    min-height: 0;
    width: auto;
    background:
        radial-gradient(circle at 50% 45%, rgba(215, 183, 90, .055), transparent 44%),
        linear-gradient(135deg, #101318 0%, #080a0d 100%);
    direction: ltr;
}

.studio-v2 .controls-panel {
    grid-area: inspector;
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0;
    border-left: 1px solid rgba(215, 183, 90, .24);
    border-right: 0;
    background: linear-gradient(180deg, #15181c, #101216);
    direction: ltr;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.v2-inspector-tabs {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #101216;
    border-bottom: 1px solid var(--v2-line);
}
.v2-tab {
    min-height: 48px;
    padding: 0 4px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #aeb2ba;
    font-size: 11px;
}
.v2-tab:hover,
.v2-tab.is-active {
    color: #f5df99;
    border-bottom-color: var(--v2-gold);
    background: linear-gradient(180deg, rgba(215, 183, 90, .08), transparent);
}
.v2-sheet-close { display: none; }

.v2-inspector-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(215, 183, 90, .35) transparent;
    scrollbar-width: thin;
}
.v2-inspector-body::-webkit-scrollbar { width: 8px; }
.v2-inspector-body::-webkit-scrollbar-track { background: #0c0e11; }
.v2-inspector-body::-webkit-scrollbar-thumb { border-radius: 8px; background: rgba(215, 183, 90, .28); }
.v2-pane { display: none; padding: 12px 12px 28px; }
.v2-pane.is-active { display: block; }

.studio-v2 .controls-panel > .tool-section,
.studio-v2 .v2-pane > .tool-section {
    padding: 13px 2px 15px;
    border-bottom: 1px solid var(--v2-line);
}
.studio-v2 .tool-section.is-collapsed > *:not(.section-title) { display: revert; }
.studio-v2 .tool-section > .section-title {
    min-height: 0;
    margin: 0 0 12px;
    padding: 0;
    color: #d9c98d;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .1em;
    text-transform: uppercase;
    cursor: default;
}
.studio-v2 .tool-section > .section-title::before { display: none; }

.v2-context-card {
    margin-bottom: 10px;
    padding: 13px;
    border: 1px solid var(--v2-line);
    border-radius: 10px;
    background: linear-gradient(150deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
    box-shadow: 0 10px 26px rgba(0,0,0,.16);
}
.v2-context-kicker { color: #8d939c; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }
.v2-context-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.v2-context-title strong { color: #f3e9ce; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-context-preview {
    min-height: 72px;
    margin-top: 10px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 7px;
    background: radial-gradient(circle, #2a2721, #111316 72%);
    color: #090807;
    font-family: "Kufi Legacy", serif;
    font-size: 42px;
    overflow: hidden;
}
.v2-empty-context { color: #8d929a; font-size: 12px; line-height: 1.6; text-align: center; }

.v2-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.v2-field { display: grid; gap: 5px; min-width: 0; }
.v2-field > span { color: #aeb2b8; font-size: 10px; }
.v2-field input,
.v2-field select,
.v2-number,
.v2-export-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 7px;
    padding: 0 9px;
    color: #f2ede2;
    background: #0d0f12;
    font: inherit;
    font-size: 12px;
    user-select: text;
}
.v2-field-wide { grid-column: 1 / -1; }
.v2-field input[type="range"] { padding: 0; min-height: 28px; accent-color: var(--v2-gold); }

.v2-group-label {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--v2-line);
    color: #d7c88f;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.v2-action-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
.v2-action-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v2-action {
    min-height: 40px;
    padding: 7px 8px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 10px;
}
.v2-action.is-active { color: #f4d982; border-color: rgba(215,183,90,.58); background: rgba(215,183,90,.1); }
.v2-action.danger { color: #df9690; border-color: rgba(228,111,103,.22); }

.v2-switch-row {
    min-height: 44px;
    margin-top: 10px;
    padding: 8px 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 7px;
    color: #c7c9cd;
    font-size: 10px;
    background: #101216;
}
.v2-switch-row input { width: 18px; height: 18px; accent-color: var(--v2-gold); }

.v2-word-strip {
    position: absolute;
    top: 62px;
    left: 18px;
    right: 18px;
    z-index: 26;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    border: 1px solid var(--v2-line);
    border-radius: 10px;
    background: rgba(10, 12, 15, .9);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
    overflow-x: auto;
}
.v2-word-strip[hidden] { display: none; }
.v2-word-strip-label { flex: 0 0 auto; color: #8e949c; font-size: 9px; letter-spacing: .11em; text-transform: uppercase; }
.v2-word-strip .word-layer-picker { display: flex; flex-wrap: nowrap; gap: 6px; width: auto; margin: 0; }
.v2-word-strip .word-layer-chip { min-height: 31px; flex: 0 0 auto; }
.v2-all-words { min-height: 31px; flex: 0 0 auto; padding: 0 10px; border: 1px solid var(--v2-line); border-radius: 16px; color: #c9cbd0; background: #15181c; font-size: 10px; cursor: pointer; }

.studio-v2 .stage-top-bar {
    top: 10px;
    left: 18px;
    right: 18px;
    width: auto;
    transform: none;
    min-height: 42px;
    padding: 5px 7px;
    border-radius: 10px;
    background: rgba(11, 13, 16, .9);
    backdrop-filter: blur(12px);
    border-color: var(--v2-line);
    direction: ltr;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.studio-v2 .stage-top-bar::-webkit-scrollbar { display: none; }
.studio-v2 .stage-top-bar .stage-bar-group { flex: 0 0 auto; }
.studio-v2 .stage-tool-btn { min-height: 30px; }
.studio-v2 .stage-viewport-box { padding-top: 54px; }
.studio-v2.word-layout-active .stage-viewport-box { padding-top: 100px; }
.studio-v2 .frame-wrapper { flex: 0 0 auto; box-shadow: 0 20px 60px rgba(0,0,0,.48); }
.studio-v2 .manuscript-board { flex: 0 0 auto; }
.studio-v2 .calligraphy-word.is-locked,
.studio-v2 .board-ornament.is-locked { cursor: not-allowed; }

.v2-selection-box {
    position: absolute;
    z-index: 900;
    pointer-events: none;
    border: 1px solid rgba(215, 183, 90, .95);
    box-shadow: 0 0 0 1px rgba(20, 16, 5, .5), 0 0 18px rgba(215,183,90,.1);
    transform-origin: center;
}
.v2-selection-box[hidden] { display: none; }
.v2-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #171205;
    background: var(--v2-gold-strong);
    box-shadow: 0 0 0 1px var(--v2-gold-strong);
    pointer-events: auto;
    touch-action: none;
    cursor: nwse-resize;
}
.v2-handle.nw { left: -7px; top: -7px; }
.v2-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.v2-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.v2-handle.se { right: -7px; bottom: -7px; }
.v2-rotate-stem { position: absolute; left: 50%; top: -32px; width: 1px; height: 25px; background: var(--v2-gold); }
.v2-handle.rotate { left: calc(50% - 8px); top: -46px; width: 17px; height: 17px; border-radius: 50%; cursor: grab; }

.v2-guide {
    position: absolute;
    z-index: 850;
    pointer-events: none;
    display: none;
    background: rgba(232, 91, 77, .82);
    box-shadow: 0 0 5px rgba(232,91,77,.45);
}
.v2-guide.is-visible { display: block; }
.v2-guide.x { top: 0; bottom: 0; width: 1px; }
.v2-guide.y { left: 0; right: 0; height: 1px; }

.v2-layers-drawer {
    position: absolute;
    z-index: 70;
    top: 62px;
    left: 14px;
    width: min(310px, calc(100% - 28px));
    max-height: calc(100% - 84px);
    border: 1px solid rgba(215,183,90,.28);
    border-radius: 11px;
    background: rgba(15,17,20,.96);
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px rgba(0,0,0,.48);
    overflow: hidden;
    transform: translateX(calc(-100% - 22px));
    opacity: 0;
    visibility: hidden;
    transition: transform .22s ease, opacity .2s ease, visibility .2s;
}
.v2-layers-drawer.is-open { transform: translateX(0); opacity: 1; visibility: visible; }
.v2-drawer-head { min-height: 48px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--v2-line); }
.v2-drawer-head strong { font-size: 12px; color: #eadcae; }
.v2-layer-list { max-height: min(520px, calc(100vh - 190px)); padding: 7px; overflow-y: auto; }
.v2-layer-section { padding: 7px 7px 4px; color: #777e87; font-size: 8px; letter-spacing: .14em; text-transform: uppercase; }
.v2-layer-row {
    min-height: 45px;
    margin-bottom: 4px;
    padding: 5px 6px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) repeat(3, 30px);
    align-items: center;
    gap: 4px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #c8cbd0;
    background: rgba(255,255,255,.025);
}
.v2-layer-row.is-selected { border-color: rgba(215,183,90,.48); background: rgba(215,183,90,.08); }
.v2-layer-row.is-hidden { opacity: .48; }
.v2-layer-check { width: 18px; height: 18px; accent-color: var(--v2-gold); }
.v2-layer-name {
    min-width: 0;
    padding: 0 4px;
    overflow: hidden;
    border: 0;
    appearance: none;
    color: inherit;
    background: transparent;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}
.v2-layer-action { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border-radius: 6px; background: transparent; }
.v2-layer-action svg { width: 15px; height: 15px; }
.v2-multi-tools { padding: 8px; border-top: 1px solid var(--v2-line); background: #101216; }

.v2-template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 10px 0 14px; }
.v2-template { min-height: 64px; padding: 8px; border: 1px solid var(--v2-line); border-radius: 8px; color: #cdd0d4; background: #101216; cursor: pointer; text-align: left; }
.v2-template:hover { border-color: rgba(215,183,90,.55); background: rgba(215,183,90,.07); }
.v2-template strong { display: block; color: #eee4c6; font-size: 11px; }
.v2-template span { display: block; margin-top: 5px; color: #80868e; font-size: 9px; }

.v2-export-dock {
    position: relative;
    z-index: 5;
    padding: 10px 11px;
    border-top: 1px solid rgba(215,183,90,.35);
    background: linear-gradient(180deg, #13161a, #0c0e11);
    box-shadow: 0 -10px 30px rgba(0,0,0,.22);
}
.v2-export-top { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: center; margin-bottom: 8px; }
.v2-export-dock .v2-switch-row { margin: 0; min-height: 36px; padding: 4px 8px; }
.v2-export-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.v2-export-primary,
.v2-export-secondary {
    min-height: 43px;
    border-radius: 7px;
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}
.v2-export-primary { border: 1px solid #e4c76e; color: #171205; background: linear-gradient(135deg, #f0d47d, #bc922f); }
.v2-export-secondary { border: 1px solid rgba(215,183,90,.48); color: #ead590; background: #111317; }
.v2-more-export { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }

.studio-v2 .export-box { display: none; }
.studio-v2 .paper-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.studio-v2 .paper-option { min-height: 84px; }
.studio-v2 .paper-preview { height: 52px; }
.studio-v2 .option-grid-4 { grid-template-columns: repeat(3, minmax(0,1fr)); }

.v2-dialog {
    width: min(680px, calc(100vw - 28px));
    max-height: min(760px, calc(100vh - 28px));
    margin: auto;
    padding: 0;
    border: 1px solid rgba(215,183,90,.38);
    border-radius: 14px;
    color: #e9e5dc;
    background: #111419;
    box-shadow: 0 30px 100px rgba(0,0,0,.72);
    overflow: auto;
}
.v2-dialog::backdrop { background: rgba(2,3,5,.78); backdrop-filter: blur(8px); }
.v2-dialog-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--v2-line); }
.v2-dialog-head h2 { color: #f0dfaa; font: 500 22px Georgia, serif; }
.v2-dialog-body { padding: 20px; }
.v2-onboarding-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.v2-onboarding-step { padding: 14px; border: 1px solid var(--v2-line); border-radius: 9px; background: rgba(255,255,255,.025); }
.v2-onboarding-step b { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 10px; border-radius: 50%; color: #181204; background: var(--v2-gold); }
.v2-onboarding-step strong { display: block; color: #eee4c6; font-size: 12px; }
.v2-onboarding-step p { margin-top: 7px; color: #9ca1a9; font-size: 11px; line-height: 1.6; }
.v2-shortcuts { margin-top: 18px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 18px; }
.v2-shortcut { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #b8bcc3; font-size: 11px; }
.v2-shortcut kbd { padding: 4px 7px; border: 1px solid rgba(255,255,255,.14); border-bottom-width: 2px; border-radius: 5px; color: #ead99e; background: #080a0d; font: 10px ui-monospace, monospace; }

.v2-save-indicator { color: #777e87; font-size: 9px; white-space: nowrap; }
.v2-save-indicator.is-saving { color: #d8bd69; }
.v2-save-indicator.is-saved { color: #83b997; }

.v2-status-bar {
    position: absolute;
    z-index: 25;
    left: 18px;
    bottom: 12px;
    display: flex;
    gap: 6px;
    pointer-events: none;
}
.v2-status-pill { padding: 5px 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; color: #949aa2; background: rgba(9,11,14,.82); backdrop-filter: blur(8px); font-size: 9px; }

.studio-v2 *:focus-visible {
    outline: 2px solid var(--v2-focus) !important;
    outline-offset: 2px;
}

.studio-v2 .ratio-a4 { aspect-ratio: 210 / 297; width: min(610px, 80vw); height: auto; }

@media (max-width: 1120px) {
    :root { --v2-inspector: 330px; --v2-rail: 62px; }
    .v2-brand-subtitle, .v2-header-btn span, .v2-save-indicator { display: none; }
    .v2-app-header { grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr); }
    .v2-header-btn { width: 38px; padding: 0; }
}

@media (max-width: 760px) {
    :root { --v2-header: 54px; }
    .studio-v2 header { padding: 0 8px; }
    .v2-app-header { grid-template-columns: 1fr auto; gap: 7px; }
    .v2-brand { gap: 8px; }
    .v2-mark { width: 34px; height: 34px; font-size: 21px; }
    .v2-brand-title { font-size: 13px; letter-spacing: .05em; }
    .v2-brand-subtitle, .v2-header-center, .v2-project-name, .v2-save-indicator { display: none; }
    .v2-header-actions { gap: 5px; }
    .v2-header-actions .v2-header-btn[data-mobile-hide="true"] { display: none; }
    .studio-v2 .language-switch button { min-width: 34px; min-height: 34px; padding: 0 6px; }

    .studio-v2 .workspace {
        display: block;
        position: relative;
        min-height: 0;
        overflow: hidden;
    }
    .studio-v2 .stage-area {
        position: absolute;
        inset: 0 0 calc(64px + env(safe-area-inset-bottom)) 0;
        width: auto;
        height: auto;
    }
    .v2-tool-rail {
        position: fixed;
        z-index: 110;
        left: 0;
        right: 0;
        bottom: 0;
        height: calc(64px + env(safe-area-inset-bottom));
        padding: 5px 6px env(safe-area-inset-bottom);
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(54px, 1fr);
        gap: 3px;
        border-top: 1px solid rgba(215,183,90,.28);
        border-right: 0;
        overflow-x: auto;
        overflow-y: hidden;
        background: rgba(11,13,16,.97);
        backdrop-filter: blur(14px);
    }
    .v2-tool { min-width: 52px; min-height: 52px; padding: 4px 2px; font-size: 8px; }
    .v2-tool svg { width: 19px; height: 19px; }
    .v2-tool[data-action="delete"] { margin-top: 0; }

    .studio-v2 .controls-panel {
        position: fixed;
        z-index: 105;
        left: 0;
        right: 0;
        bottom: calc(64px + env(safe-area-inset-bottom));
        width: 100%;
        height: min(68vh, 640px);
        display: grid;
        border: 1px solid rgba(215,183,90,.32);
        border-bottom: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -24px 70px rgba(0,0,0,.65);
        transform: translateY(calc(100% + 8px));
        visibility: hidden;
        transition: transform .26s cubic-bezier(.2,.8,.2,1), visibility .26s;
    }
    .studio-v2.v2-sheet-open .controls-panel { transform: translateY(0); visibility: visible; }
    .v2-inspector-tabs { grid-template-columns: repeat(4, minmax(0,1fr)) 42px; }
    .v2-sheet-close { display: grid; place-items: center; min-width: 42px; border: 0; border-left: 1px solid var(--v2-line); border-radius: 0; background: transparent; color: #b8bdc4; }
    .v2-tab { min-height: 50px; font-size: 10px; }
    .v2-pane { padding: 10px 12px 34px; }
    .v2-export-dock { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

    .studio-v2 .stage-top-bar {
        top: 7px;
        left: 7px;
        right: 7px;
        min-height: 40px;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        scrollbar-width: none;
    }
    .studio-v2 .stage-top-bar::-webkit-scrollbar { display: none; }
    .studio-v2 .stage-top-bar .stage-bar-divider { display: none; }
    .studio-v2 .stage-top-bar .stage-bar-group { flex: 0 0 auto; }
    .studio-v2 #toggleSidebarBtn { display: none; }
    .v2-word-strip { top: 54px; left: 7px; right: 7px; min-height: 40px; }
    .studio-v2 .stage-viewport-box { padding: 52px 7px 12px; }
    .studio-v2.word-layout-active .stage-viewport-box { padding-top: 96px; }
    .studio-v2 .frame-wrapper { max-width: none; }
    .v2-layers-drawer { position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); width: auto; max-height: 58vh; transform: translateY(calc(100% + 90px)); }
    .v2-layers-drawer.is-open { transform: translateY(0); }
    .v2-layer-list { max-height: 44vh; }
    .v2-status-bar { left: 8px; bottom: 7px; }
    .v2-onboarding-grid { grid-template-columns: 1fr; }
    .v2-shortcuts { grid-template-columns: 1fr; }
    .v2-dialog-body { padding: 15px; }
    .v2-handle { width: 18px; height: 18px; }
    .v2-handle.nw { left: -9px; top: -9px; }
    .v2-handle.ne { right: -9px; top: -9px; }
    .v2-handle.sw { left: -9px; bottom: -9px; }
    .v2-handle.se { right: -9px; bottom: -9px; }
    .v2-handle.rotate { left: calc(50% - 10px); width: 20px; height: 20px; }
}

@media (max-width: 420px) {
    .v2-brand-copy { display: none; }
    .v2-app-header { grid-template-columns: auto 1fr; }
    .v2-field-grid { grid-template-columns: 1fr 1fr; }
    .v2-action-row.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .v2-export-buttons { grid-template-columns: 1fr 1fr; }
}

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