:root {
    --bg: #f4ede3;
    --surface: rgba(255, 250, 244, 0.88);
    --line: rgba(54, 45, 34, 0.14);
    --text: #201a14;
    --muted: #726757;
    --accent: #bb5f2a;
    --accent-strong: #8d431b;
    --accent-soft: rgba(187, 95, 42, 0.14);
    --shadow: 0 24px 64px rgba(48, 31, 13, 0.12);
    --radius-xl: 24px;
    --radius-md: 12px;
    --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(242, 211, 182, 0.8), transparent 26%),
        radial-gradient(circle at bottom right, rgba(205, 228, 213, 0.7), transparent 22%),
        linear-gradient(180deg, #faf3ea 0%, #f0e7db 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.studio-shell {
    position: relative;
    padding: 20px;
}

/* file input: display:none 조상 밖에 둠 — 탭 숨김과 무관하게 .click()·보안 정책 통과 */
.ias-api-key-form {
    margin: 0;
    padding: 0;
    border: 0;
}

.studio-hidden-inputs {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.studio-topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: var(--accent-strong);
}

.studio-topbar h1 {
    margin: 0;
    font-size: clamp(1.55rem, 2.35vw, 2.65rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.topbar-copy {
    margin: 6px 0 0;
    max-width: 720px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.topbar-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.topbar-pill,
.status-pill,
.mini-note {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(54, 45, 34, 0.08);
    color: var(--muted);
    font-size: 0.76rem;
}

.status-ok {
    background: rgba(52, 125, 88, 0.12);
    color: #275f43;
}

.status-warn {
    background: rgba(187, 95, 42, 0.12);
    color: var(--accent-strong);
}

.studio-grid {
    display: grid;
    grid-template-columns: minmax(288px, 348px) minmax(0, 1fr) minmax(260px, 312px);
    gap: 14px;
    min-height: calc(100vh - 172px);
}

.studio-sidebar,
.studio-inspector,
.studio-main {
    min-width: 0;
}

.studio-sidebar,
.studio-inspector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Canva式: 좁은 레일 + 선택된 도구만 패널 표시 */
.studio-sidebar.studio-sidebar-canva {
    flex-direction: row;
    align-items: stretch;
    gap: 0;
}

.studio-rail {
    flex: 0 0 54px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 5px;
    background: rgba(255, 252, 248, 0.94);
    border: 1px solid rgba(54, 45, 34, 0.1);
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    box-shadow: 0 4px 18px rgba(48, 31, 13, 0.05);
}

.studio-rail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 56px;
    padding: 8px 2px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.studio-rail-btn:hover {
    background: rgba(187, 95, 42, 0.1);
    color: var(--accent-strong);
}

.studio-rail-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    box-shadow: inset 0 0 0 1px rgba(187, 95, 42, 0.22);
}

.studio-rail-btn:focus-visible {
    outline: 2px solid rgba(187, 95, 42, 0.55);
    outline-offset: 2px;
}

.studio-rail-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.studio-rail-label {
    display: block;
    text-align: center;
    max-width: 52px;
    word-break: keep-all;
}

.studio-panel-stack {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 0 0 10px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.studio-tool-panel {
    flex: 1 1 auto;
    min-height: 0;
}

.studio-tool-panel:not(.hidden) {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    padding: 15px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.panel-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body.hidden {
    display: none;
}

.panel h2,
.panel h3 {
    margin: 0;
}

.panel h2 {
    font-size: 0.98rem;
    font-weight: 700;
}

.panel h3 {
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 9px;
}

.field > span {
    font-size: 0.76rem;
    color: var(--muted);
}

.field .field-label-spacer {
    font-size: 0.76rem;
    color: var(--muted);
}

.field-grid {
    display: grid;
    gap: 9px;
}

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

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.92);
    padding: 9px 11px;
    font-size: 0.88rem;
    color: var(--text);
}

.field textarea {
    resize: vertical;
    min-height: 72px;
    line-height: 1.4;
}

.field input[type="color"] {
    min-height: 40px;
    padding: 4px;
}

.color-control {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.color-control__top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.color-control input[type="color"] {
    flex: 0 0 auto;
}

.color-control__hex {
    min-width: 0;
    width: 92px;
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(54, 45, 34, 0.15);
    background: #fff;
    color: var(--text);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.color-control__pick {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid rgba(54, 45, 34, 0.14);
    background: rgba(255, 255, 255, 0.84);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.color-control__pick.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: rgba(187, 95, 42, 0.24);
}

.color-control__pick:disabled,
.color-control__hex:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.field input[type="range"] {
    padding: 0;
}

.checkbox-field {
    flex-direction: row;
    align-items: center;
}

.checkbox-field input {
    width: auto;
}

.stacked-actions {
    display: grid;
    gap: 8px;
}

.elements-upload-btn {
    width: 100%;
    margin-top: 4px;
}

.elements-tool-launcher {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.element-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 8px;
    text-align: center;
    line-height: 1.2;
}

.element-tool-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #bb5f2a;
}

.element-tool-icon::before,
.element-tool-icon::after {
    content: "";
    position: absolute;
    box-sizing: border-box;
}

.element-tool-icon.is-draw::before {
    inset: 8px 13px;
    border-radius: 999px 999px 8px 8px;
    border: 3px solid currentColor;
    border-bottom-width: 11px;
    transform: rotate(24deg);
}

.element-tool-icon.is-draw::after {
    width: 18px;
    height: 4px;
    right: 4px;
    bottom: 7px;
    background: currentColor;
    border-radius: 999px;
    transform: rotate(-32deg);
}

.element-tool-icon.is-text,
.element-tool-icon.is-textbox {
    font-size: 1.4rem;
    font-weight: 800;
    font-family: Georgia, "Times New Roman", serif;
}

.element-tool-icon.is-textbox::before {
    inset: 4px;
    border-radius: 12px;
    background: rgba(187, 95, 42, 0.14);
    border: 2px solid currentColor;
}

.element-tool-icon.is-textbox::after,
.element-tool-icon.is-text::after {
    content: none;
}

.element-tool-icon.is-shape::before {
    inset: 4px 5px 18px;
    border-radius: 12px;
    background: currentColor;
}

.element-tool-icon.is-shape::after {
    left: 7px;
    right: 7px;
    bottom: 4px;
    height: 14px;
    background: currentColor;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.element-tool-icon.is-crop::before {
    left: 7px;
    top: 8px;
    width: 19px;
    height: 19px;
    border-top: 4px solid currentColor;
    border-left: 4px solid currentColor;
    border-radius: 3px 0 0 0;
}

.element-tool-icon.is-crop::after {
    right: 7px;
    bottom: 8px;
    width: 19px;
    height: 19px;
    border-right: 4px solid currentColor;
    border-bottom: 4px solid currentColor;
    border-radius: 0 0 3px 0;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.chip-btn {
    border: none;
    border-radius: var(--radius-md);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    font-size: 0.88rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    padding: 10px 12px;
    box-shadow: 0 12px 28px rgba(141, 67, 27, 0.24);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    padding: 10px 12px;
    border: 1px solid rgba(54, 45, 34, 0.08);
}

.secondary-btn.tool-active {
    background: rgba(187, 95, 42, 0.14);
    border-color: rgba(187, 95, 42, 0.4);
    color: var(--accent-strong);
}

.ghost-btn {
    background: rgba(255, 255, 255, 0.6);
    padding: 8px 10px;
    font-size: 0.84rem;
    color: var(--muted);
}

.ghost-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
}

.ghost-btn.danger {
    color: #9b1c1c;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.chip-btn:hover {
    transform: translateY(-1px);
}

.shape-picker-panel {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 252, 248, 0.95);
    border: 1px solid rgba(187, 95, 42, 0.2);
    box-shadow: 0 8px 24px rgba(33, 24, 12, 0.08);
}

.shape-picker-panel.hidden,
.draw-tool-block.hidden,
.elements-crop-block.hidden {
    display: none;
}

.shape-picker-title {
    margin: 0 0 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.shape-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

@media (min-width: 520px) {
    .shape-picker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.shape-picker-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 104px;
    padding: 12px 10px;
    border-radius: 10px;
    border: 1px solid rgba(54, 45, 34, 0.12);
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    cursor: pointer;
    line-height: 1.25;
}

.shape-picker-btn:hover {
    border-color: rgba(187, 95, 42, 0.45);
    background: rgba(255, 243, 232, 0.95);
}

.shape-picker-visual {
    position: relative;
    display: block;
    width: 56px;
    height: 44px;
    color: #bb5f2a;
}

.shape-picker-label {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
    word-break: keep-all;
}

.shape-picker-visual::before,
.shape-picker-visual::after {
    content: "";
    position: absolute;
    inset: 0;
}

.shape-preview-rect::before {
    inset: 4px 2px;
    border-radius: 14px;
    background: currentColor;
}

.shape-preview-circle::before {
    inset: 2px 8px;
    border-radius: 999px;
    background: currentColor;
}

.shape-preview-triangle::before {
    inset: 2px 8px 0;
    background: currentColor;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.shape-preview-diamond::before {
    inset: 3px 10px;
    background: currentColor;
    transform: rotate(45deg);
}

.shape-preview-hexagon::before {
    inset: 3px 6px;
    background: currentColor;
    clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

.shape-preview-bubble::before {
    inset: 4px 4px 10px 10px;
    border-radius: 14px;
    background: currentColor;
}

.shape-preview-bubble::after {
    inset: auto auto 2px 3px;
    width: 16px;
    height: 14px;
    background: currentColor;
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

.shape-preview-star::before {
    inset: 1px 6px;
    background: currentColor;
    clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 39% 35%);
}

.shape-preview-badge::before {
    inset: 2px 6px;
    background: currentColor;
    clip-path: polygon(50% 0, 62% 7%, 75% 3%, 83% 14%, 96% 18%, 94% 32%, 100% 44%, 92% 56%, 94% 70%, 83% 74%, 75% 85%, 62% 81%, 50% 88%, 38% 81%, 25% 85%, 17% 74%, 4% 70%, 6% 56%, 0 44%, 8% 32%, 4% 18%, 17% 14%, 25% 3%, 38% 7%);
}

.shape-preview-arrow::before {
    inset: 12px 4px;
    background: currentColor;
    clip-path: polygon(0 25%, 58% 25%, 58% 0, 100% 50%, 58% 100%, 58% 75%, 0 75%);
}

.shape-picker-close {
    margin-top: 10px;
    width: 100%;
}

.panel-subtitle {
    font-size: 0.82rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text);
}

.elements-crop-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.elements-ocr-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.ocr-status-pill {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    text-align: left;
}

.ocr-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(114, 103, 87, 0.55);
    flex: 0 0 10px;
}

.ocr-status-pill.is-checking .ocr-status-dot {
    background: #bb5f2a;
}

.ocr-status-pill.is-available .ocr-status-dot {
    background: #2c8a57;
}

.ocr-status-pill.is-unavailable .ocr-status-dot {
    background: #b23a3a;
}

.draw-tool-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.draw-mode-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 8px 0 10px;
}

.brush-cursor {
    position: absolute;
    left: 0;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1.5px solid rgba(32, 26, 20, 0.78);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42);
    transform: translate(-9999px, -9999px);
    transform-origin: center center;
    pointer-events: none;
    z-index: 6;
    mix-blend-mode: difference;
}

.brush-cursor.is-highlight {
    border-color: rgba(208, 84, 31, 0.9);
    background: rgba(255, 207, 79, 0.18);
    mix-blend-mode: normal;
}

.brush-cursor.is-erase {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.16);
    mix-blend-mode: normal;
}

.brush-cursor.is-hidden {
    opacity: 0;
}

.draw-mode-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: rgba(187, 95, 42, 0.24);
}

.crop-shape-actions,
.crop-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 8px 0 10px;
}

.crop-quick-actions.crop-quick-actions--inspector {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.crop-quick-actions--inspector .crop-quick-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 8px 4px;
    min-height: 40px;
    color: var(--muted);
}

.crop-quick-actions--inspector .crop-quick-icon-btn:hover:not(:disabled) {
    color: var(--accent-strong);
}

.crop-quick-actions--inspector .crop-quick-icon-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: block;
}

.crop-shape-actions .ghost-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: rgba(187, 95, 42, 0.24);
}

.helper-copy.tight {
    margin: 0 0 10px;
    font-size: 0.75rem;
    line-height: 1.4;
}

.helper-copy,
.message-box {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.42;
}

.message-box {
    padding: 9px 11px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.7);
    border: 1px dashed rgba(54, 45, 34, 0.16);
}

.message-box.is-empty {
    display: none;
}

.crop-actionbar button.crop-action-icon {
    min-width: 32px;
    width: 32px;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 800;
}

.crop-actionbar button[aria-disabled="true"],
.crop-actionbar button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.message-box.is-error {
    color: #9b1c1c;
    background: rgba(228, 52, 52, 0.08);
    border-style: solid;
}

.message-box.is-success {
    color: #275f43;
    background: rgba(52, 125, 88, 0.08);
    border-style: solid;
}

.message-box.is-loading {
    color: #5b3d15;
    background: rgba(191, 127, 46, 0.1);
    border-style: solid;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-box.is-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(91, 61, 21, 0.22);
    border-top-color: #b36c1d;
    animation: ias-spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.chip-btn {
    background: var(--accent-soft);
    color: var(--accent-strong);
    padding: 7px 10px;
    font-size: 0.8rem;
}

.reference-list {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.reference-item {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(54, 45, 34, 0.08);
}

.reference-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.reference-item strong,
.reference-item small {
    display: block;
}

.reference-item small {
    color: var(--muted);
}

.studio-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.studio-inspector,
.studio-sidebar {
    min-height: 0;
}

.studio-inspector {
    max-height: calc(100vh - 172px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.workspace-meta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 12px 14px;
    background: rgba(255, 250, 244, 0.78);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
    overflow: visible;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.workspace-label {
    margin: 0 0 4px;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
}

.workspace-meta h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.workspace-mini {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.workspace-tools {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.workspace-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 96px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(84, 64, 45, 0.18);
    background: rgba(255, 248, 240, 0.96);
    color: #4e4032;
    box-shadow: 0 4px 14px rgba(40, 28, 17, 0.06);
}

.workspace-tool-btn:hover {
    background: rgba(255, 243, 232, 0.98);
    border-color: rgba(187, 95, 42, 0.3);
    color: var(--accent-strong);
}

.workspace-tool-btn.tool-active {
    background: linear-gradient(135deg, rgba(187, 95, 42, 0.18) 0%, rgba(141, 67, 27, 0.12) 100%);
    border-color: rgba(187, 95, 42, 0.42);
    color: var(--accent-strong);
    box-shadow: 0 8px 20px rgba(141, 67, 27, 0.12);
}

.workspace-tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.workspace-tool-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.workspace-tool-label {
    display: inline-block;
    line-height: 1;
    white-space: nowrap;
}

.workspace-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#selectedLayerBadge {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
}

.stage-viewport {
    position: relative;
    flex: 1;
    min-height: min(640px, calc(100vh - 320px));
    padding: 16px;
    /* 캔버스(아트보드)보다 넓은 작업 영역 외곽만 둥글게 (.stage는 직각 유지로 꼭지점 편집 유리) */
    border-radius: var(--radius-xl);
    overflow: hidden;
    background:
        linear-gradient(45deg, rgba(103, 84, 61, 0.06) 25%, transparent 25%) -12px 0/24px 24px,
        linear-gradient(-45deg, rgba(103, 84, 61, 0.06) 25%, transparent 25%) -12px 0/24px 24px,
        linear-gradient(45deg, transparent 75%, rgba(103, 84, 61, 0.06) 75%) -12px 0/24px 24px,
        linear-gradient(-45deg, transparent 75%, rgba(103, 84, 61, 0.06) 75%) -12px 0/24px 24px,
        linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(247, 239, 230, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
}

.stage-viewport.ocr-busy .stage-board,
.stage-viewport.ocr-busy .stage,
.stage-viewport.ocr-busy .stage-overlay,
.stage-viewport.ocr-busy .draw-preview-canvas {
    pointer-events: none;
}

.stage-viewport.ocr-busy::after {
    content: 'OCR 추출 중';
    position: absolute;
    top: 28px;
    right: 28px;
    z-index: 20;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(34, 24, 14, 0.82);
    color: #fff7eb;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 12px 30px rgba(34, 24, 14, 0.18);
}

@keyframes ias-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.text-float-toolbar {
    pointer-events: auto;
    width: 100%;
    max-width: none;
    position: relative;
    z-index: 12;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    min-height: 74px;
}

.text-float-toolbar-inner {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-width: max-content;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 252, 248, 0.97);
    border: 1px solid rgba(187, 95, 42, 0.24);
    box-shadow: 0 12px 40px rgba(33, 24, 12, 0.16);
    overflow: visible;
}

.text-float-toolbar.is-inactive .text-float-toolbar-inner {
    opacity: 0.62;
}

.text-float-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
}

.text-float-row + .text-float-row {
    margin-top: 0;
    padding-top: 0;
    padding-left: 10px;
    border-top: none;
    border-left: 1px solid rgba(54, 45, 34, 0.08);
}

.text-float-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.text-float-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.64rem;
    color: var(--muted);
    flex: 0 0 auto;
}

.text-float-field span {
    white-space: nowrap;
}

.text-float-field--stacked {
    gap: 4px;
}

.text-float-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.62rem;
}

.text-float-inline-check input[type="checkbox"] {
    margin: 0;
}

.text-color-popover {
    position: relative;
}

.text-color-popover__summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(54, 45, 34, 0.15);
    background: #fff;
    color: var(--ink, #2b2218);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.text-color-popover__summary::-webkit-details-marker {
    display: none;
}

.text-color-popover__swatch {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(54, 45, 34, 0.18);
    background: #fff4d6;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.text-color-popover__label {
    font-size: 0.72rem;
    white-space: nowrap;
}

.text-color-popover__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    display: grid;
    gap: 8px;
    min-width: 132px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(187, 95, 42, 0.18);
    background: rgba(255, 252, 248, 0.98);
    box-shadow: 0 12px 32px rgba(33, 24, 12, 0.16);
}

.text-color-popover__check {
    justify-content: flex-start;
}

.text-float-field input[type="number"],
.text-float-field select {
    min-width: 0;
    font-size: 0.76rem;
    padding: 3px 5px;
    border-radius: 8px;
    border: 1px solid rgba(54, 45, 34, 0.15);
    background: #fff;
    color: var(--ink, #2b2218);
}

.text-float-field input[type="number"] {
    width: 64px;
}

.text-float-field select {
    width: 88px;
}

.text-float-field input[type="color"] {
    width: 32px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.text-float-field .color-control {
    width: 100%;
    min-width: 108px;
    gap: 4px;
}

.text-float-field .color-control__top {
    gap: 4px;
}

.text-float-field .color-control__hex {
    width: 100%;
    min-height: 26px;
    padding: 3px 6px;
    font-size: 0.72rem;
}

.text-float-field .color-control__pick {
    min-height: 26px;
    padding: 0 7px;
    font-size: 0.64rem;
}

.text-float-field--range {
    min-width: 108px;
}

.text-float-field--range input[type="range"] {
    width: 108px;
}

.stage-board {
    position: absolute;
    top: 0;
    left: 50%;
    transform-origin: top left;
}

.stage-board.is-color-picking,
.stage-board.is-color-picking .stage,
.stage-board.is-color-picking .stage-overlay {
    cursor: crosshair;
}

.stage {
    position: relative;
    z-index: 1;
    /* 편집: 꼭지점·핸들까지 직사각형 히트 영역 (보내기는 캔버스 API, 이 스타일과 무관) */
    border-radius: 0;
    overflow: visible;
    box-shadow: 0 28px 80px rgba(33, 24, 12, 0.2);
    background: #fff8ee;
}

.stage-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.draw-preview-canvas {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.stage-guide {
    position: absolute;
    background: rgba(0, 164, 120, 0.9);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.stage-guide.is-vertical {
    top: 0;
    width: 1px;
    height: 100%;
}

.stage-guide.is-horizontal {
    left: 0;
    width: 100%;
    height: 1px;
}

.stage-tool-hint {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(32, 26, 20, 0.84);
    color: #fff;
    font-size: 0.76rem;
    letter-spacing: 0.01em;
}

.crop-focus-mask {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 0;
    box-shadow: 0 0 0 9999px rgba(23, 18, 14, 0.46);
    pointer-events: none;
}

.crop-focus-mask.is-circle {
    border-radius: 999px;
}

.crop-selection-box {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255, 255, 255, 0.98);
    border-radius: inherit;
    box-shadow:
        0 0 0 1px rgba(187, 95, 42, 0.92),
        0 12px 24px rgba(23, 18, 14, 0.16);
    pointer-events: auto;
}

.crop-focus-rule {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
}

.crop-rule-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.54);
}

.crop-rule-line.is-vertical {
    top: 0;
    bottom: 0;
    width: 1px;
}

.crop-rule-line.is-vertical:nth-child(1) {
    left: 33.333%;
}

.crop-rule-line.is-vertical:nth-child(2) {
    left: 66.666%;
}

.crop-rule-line.is-horizontal {
    left: 0;
    right: 0;
    height: 1px;
}

.crop-rule-line.is-horizontal:nth-child(3) {
    top: 33.333%;
}

.crop-rule-line.is-horizontal:nth-child(4) {
    top: 66.666%;
}

.crop-selection-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid #fff;
    background: var(--accent);
    box-shadow: 0 6px 12px rgba(32, 26, 20, 0.22);
    pointer-events: auto;
}

.crop-selection-handle[data-handle="nw"] {
    top: -7px;
    left: -7px;
    cursor: nwse-resize;
}

.crop-selection-handle[data-handle="ne"] {
    top: -7px;
    right: -7px;
    cursor: nesw-resize;
}

.crop-selection-handle[data-handle="sw"] {
    left: -7px;
    bottom: -7px;
    cursor: nesw-resize;
}

.crop-selection-handle[data-handle="se"] {
    right: -7px;
    bottom: -7px;
    cursor: nwse-resize;
}

.crop-actionbar {
    position: absolute;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transform: translate(-50%, -100%) scale(var(--crop-ui-scale, 1));
    transform-origin: center bottom;
    padding: 7px;
    border-radius: 999px;
    background: rgba(18, 14, 11, 0.88);
    box-shadow: 0 18px 36px rgba(18, 14, 11, 0.26);
    pointer-events: auto;
}

.crop-actionbar.is-below {
    transform: translate(-50%, 0) scale(var(--crop-ui-scale, 1));
    transform-origin: center top;
}

.crop-actionbar button {
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.76rem;
    font-weight: 700;
}

.crop-actionbar button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.selection-outline {
    position: absolute;
    top: 0;
    left: 0;
    border: 1px dashed rgba(187, 95, 42, 0.9);
    border-radius: 12px;
    transform-origin: top left;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75) inset;
}

.selection-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid #fff;
    background: var(--accent);
    box-shadow: 0 6px 12px rgba(32, 26, 20, 0.22);
    pointer-events: auto;
}

.selection-handle[data-handle="nw"] {
    top: -7px;
    left: -7px;
    cursor: nwse-resize;
}

.selection-handle[data-handle="ne"] {
    top: -7px;
    right: -7px;
    cursor: nesw-resize;
}

.selection-handle[data-handle="sw"] {
    bottom: -7px;
    left: -7px;
    cursor: nesw-resize;
}

.selection-handle[data-handle="se"] {
    right: -7px;
    bottom: -7px;
    cursor: nwse-resize;
}

.stage-empty {
    position: absolute;
    inset: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(54, 45, 34, 0.18);
    border-radius: 20px;
    color: var(--muted);
    text-align: center;
    padding: 24px;
}

.stage-layer {
    position: absolute;
    top: 0;
    left: 0;
    border: 1px solid transparent;
    transform-origin: top left;
    user-select: none;
    touch-action: none;
}

.stage-layer.selected {
    border-color: rgba(187, 95, 42, 0.88);
    box-shadow: 0 0 0 2px rgba(187, 95, 42, 0.18);
}

.stage.is-text-editing .stage-layer {
    pointer-events: none;
}

.stage-layer.editing .text-layer-inner {
    opacity: 0;
}

.stage-layer img,
.stage-layer canvas,
.stage-layer .text-layer-inner,
.stage-layer .shape-layer-inner,
.stage-layer .image-layer-inner {
    width: 100%;
    height: 100%;
}

.image-layer-inner {
    position: relative;
    overflow: hidden;
}

/* placement는 editor.js getImagePlacement + drawImage와 동일하게 맞춤 — cover/contain을 CSS로 한 번 더 적용하면 팬·크롭 초기화가 화면과 어긋남 */
.stage-layer img {
    display: block;
    object-fit: fill;
    object-position: 0 0;
    pointer-events: none;
}

.image-layer-canvas {
    display: block;
    pointer-events: none;
}

.text-layer-inner {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.18;
    pointer-events: none;
    width: 100%;
    max-width: 100%;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.stage-text-editor-shell {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

.stage-text-editor {
    display: block;
    width: 100%;
    min-height: 100%;
    resize: none;
    overflow: hidden;
    border: 1px dashed rgba(187, 95, 42, 0.88);
    border-radius: 10px;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    outline: none;
    box-shadow: 0 0 0 3px rgba(187, 95, 42, 0.14);
    pointer-events: auto;
    caret-color: var(--accent-strong);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
    -webkit-user-select: text;
    touch-action: auto;
    cursor: text;
}

.stage-text-editor [data-text-run] {
    white-space: inherit;
    user-select: text;
    -webkit-user-select: text;
    touch-action: auto;
}

.stage-viewport.text-tool-active,
.stage-viewport.text-tool-active .stage,
.stage-viewport.text-tool-active .stage-layer {
    cursor: text;
}

.stage-viewport.draw-tool-active,
.stage-viewport.draw-tool-active .stage-board,
.stage-viewport.draw-tool-active .stage,
.stage-viewport.draw-tool-active .stage-layer,
.stage-viewport.draw-tool-active .stage-overlay,
.stage-viewport.draw-tool-active .draw-preview-canvas {
    cursor: none;
}

.stage-viewport.crop-tool-active,
.stage-viewport.crop-tool-active .stage,
.stage-viewport.crop-tool-active .stage-layer {
    cursor: grab;
}

.stage-viewport.crop-tool-active.is-cropping,
.stage-viewport.crop-tool-active.is-cropping .stage,
.stage-viewport.crop-tool-active.is-cropping .stage-layer {
    cursor: grabbing;
}

.shape-layer-inner {
    pointer-events: none;
}

.shape-layer-svg svg {
    overflow: visible;
}

.layer-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 9px;
}

.layer-list {
    display: grid;
    gap: 8px;
}

.layer-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid rgba(54, 45, 34, 0.08);
    background: rgba(255, 255, 255, 0.74);
    color: var(--text);
    padding: 6px;
}

.layer-item.selected {
    border-color: rgba(187, 95, 42, 0.48);
    background: rgba(187, 95, 42, 0.12);
}

.layer-item.is-hidden {
    opacity: 0.68;
}

.layer-item-main {
    min-width: 0;
    text-align: left;
    border: none;
    background: transparent;
    color: inherit;
    padding: 4px 6px;
    border-radius: 10px;
}

.layer-item-main strong,
.layer-item small {
    display: block;
}

.layer-item-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-item small {
    display: block;
    margin-top: 2px;
    font-size: 0.74rem;
    color: var(--muted);
}

.layer-item-actions {
    display: flex;
    gap: 4px;
}

.layer-toggle-btn {
    position: relative;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(54, 45, 34, 0.08);
    background: rgba(255, 255, 255, 0.82);
    color: var(--muted);
}

.layer-toggle-btn::before,
.layer-toggle-btn::after {
    content: "";
    position: absolute;
    box-sizing: border-box;
}

.layer-toggle-btn.is-active {
    background: rgba(187, 95, 42, 0.14);
    border-color: rgba(187, 95, 42, 0.34);
    color: var(--accent-strong);
}

.layer-toggle-btn.is-locked {
    background: rgba(32, 26, 20, 0.1);
    border-color: rgba(32, 26, 20, 0.16);
    color: var(--text);
}

.layer-toggle-visibility::before {
    left: 7px;
    top: 11px;
    width: 18px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 12px / 8px;
}

.layer-toggle-visibility::after {
    left: 13px;
    top: 14px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.layer-toggle-visibility.is-off::before {
    opacity: 0.48;
}

.layer-toggle-visibility.is-off::after {
    left: 8px;
    top: 16px;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: rotate(-28deg);
}

.layer-toggle-lock::before {
    left: 10px;
    top: 15px;
    width: 14px;
    height: 11px;
    border: 2px solid currentColor;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.28);
}

.layer-toggle-lock::after {
    left: 12px;
    top: 8px;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

.layer-toggle-lock.is-unlocked::after {
    left: 15px;
    transform: rotate(18deg);
    transform-origin: top left;
}

.empty-state {
    padding: 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.62);
    color: var(--muted);
    text-align: center;
}

.template-picker-dialog {
    width: min(520px, calc(100vw - 24px));
    padding: 0;
    border: none;
    border-radius: 20px;
    background: transparent;
    box-shadow: 0 28px 70px rgba(20, 16, 12, 0.28);
}

.template-picker-dialog::backdrop {
    background: rgba(20, 16, 12, 0.38);
    backdrop-filter: blur(4px);
}

.template-picker-sheet {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 252, 248, 0.98);
    border: 1px solid rgba(187, 95, 42, 0.18);
}

#templatePickerSelect {
    min-height: 280px;
}

.controls-wrap.hidden,
.type-section.hidden,
.ai-result-card.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.controls-wrap {
    margin-top: 10px;
}

.type-section {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid rgba(54, 45, 34, 0.08);
}

.template-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 120;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(32, 26, 20, 0.9);
    color: #fff;
    box-shadow: 0 18px 44px rgba(32, 26, 20, 0.25);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.template-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ai-result-card {
    margin-top: 10px;
    display: grid;
    gap: 9px;
}

.ai-result-card img {
    width: 100%;
    display: block;
    border-radius: var(--radius-md);
    border: 1px solid rgba(54, 45, 34, 0.08);
    background: #fff;
}

#legacyImagePickerSelect {
    min-height: 280px;
}

@media (max-width: 1280px) {
    .studio-grid {
        grid-template-columns: 280px minmax(0, 1fr);
    }

    .studio-inspector {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

/* 공통 improved-header 아래 본문 시작 */
body.image-ai-studio-page .studio-shell {
    padding-top: 88px;
}

@media (max-width: 1024px) {
    body.image-ai-studio-page .studio-shell {
        padding-top: 76px;
    }
}

@media (max-width: 960px) {
    .studio-shell {
        padding: 16px;
    }

    body.image-ai-studio-page .studio-shell {
        padding: 72px 16px 16px;
    }

    .studio-topbar,
    .studio-grid,
    .studio-inspector {
        display: flex;
        flex-direction: column;
    }

    .studio-sidebar.studio-sidebar-canva {
        flex-direction: column;
    }

    .studio-rail {
        flex-direction: row;
        flex: 0 0 auto;
        justify-content: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 8px 6px;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        border-bottom: 1px solid rgba(54, 45, 34, 0.1);
        gap: 6px;
    }

    .studio-rail-btn {
        flex: 0 0 auto;
        min-width: 64px;
        min-height: 52px;
        padding: 6px 4px;
    }

    .studio-panel-stack {
        padding: 10px 0 0;
        max-height: min(52vh, 420px);
    }

    .stage-viewport {
        min-height: 520px;
        padding: 16px;
    }

    .workspace-header {
        flex-direction: column;
        align-items: stretch;
    }

    .workspace-tools {
        justify-content: flex-start;
    }

    .text-float-toolbar-inner {
        gap: 8px;
    }
}

/* Dazabi 생성AI 패널 (생성·변환·배경제거) */
.ias-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ias-dazabi-panel .ias-dazabi-coupon-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.ias-dazabi-panel .ias-dazabi-coupon-field {
    flex: 1;
    margin-bottom: 0;
}

.ias-dazabi-panel .ias-dazabi-coupon-field input {
    width: 100%;
}

.ias-dazabi-mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ias-dazabi-mode-btn.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.ias-dazabi-model-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ias-dazabi-model-basic.is-active,
.ias-dazabi-model-pro.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.ias-dazabi-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.ias-dazabi-chips .chip-btn {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.ias-dazabi-nano-res {
    margin-top: 8px;
}

.ias-dazabi-paddle-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
}

.ias-dazabi-paddle-pill--ok {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
}

.ias-dazabi-paddle-pill--off {
    border-color: rgba(54, 45, 34, 0.25);
    opacity: 0.85;
}

.ias-dazabi-paddle-state {
    font-size: 0.8rem;
    font-weight: 600;
}

/* 변환 원본 파일 미리보기 (구버전 생성AI 원본 미리보기와 유사) */
.ias-dazabi-file-preview-wrap {
    margin-top: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    overflow: hidden;
    background: var(--surface);
}

.ias-dazabi-file-preview-img {
    display: block;
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    vertical-align: middle;
}

/* 우측: 생성AI 결과 피드 (프롬프트 + 썸네일) */
.ias-dazabi-feed-panel .panel-head {
    align-items: center;
}

.ias-dazabi-feed-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ias-dazabi-feed-clear {
    font-size: 0.8rem;
    padding: 4px 10px;
}

.ias-dazabi-feed-info-toggle {
    min-width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.ias-dazabi-feed-info {
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 252, 248, 0.92);
    border: 1px solid rgba(54, 45, 34, 0.08);
}

.ias-dazabi-feed-info .helper-copy.tight:last-child {
    margin-bottom: 0;
}

.ias-dazabi-feed {
    max-height: min(42vh, 520px);
    overflow-y: auto;
    margin-top: 8px;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ias-dazabi-feed-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 10px;
    background: rgba(255, 252, 248, 0.95);
    box-shadow: 0 2px 8px rgba(48, 31, 13, 0.06);
}

.ias-dazabi-feed-meta {
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.ias-dazabi-feed-prompt {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text);
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.ias-dazabi-feed-reuse {
    font-size: 0.8rem;
    padding: 4px 10px;
}

.ias-dazabi-feed-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.ias-dazabi-feed-edit,
.ias-dazabi-feed-reuse {
    width: 100%;
}

.ias-dazabi-feed-img-wrap {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(54, 45, 34, 0.12);
    background: repeating-conic-gradient(#f0ebe4 0% 25%, #faf7f3 0% 50%) 50% / 16px 16px;
}

.ias-dazabi-feed-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
}

.ias-dazabi-feed-hint {
    margin-top: 6px;
    margin-bottom: 0;
}

.vault-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.vault-card {
    display: grid;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 252, 248, 0.95);
}

.vault-card-button {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.vault-card-button:focus-visible {
    outline: 2px solid rgba(187, 95, 42, 0.42);
    outline-offset: 2px;
    border-radius: 12px;
}

.vault-card-meta {
    font-size: 0.74rem;
    color: var(--muted);
    padding: 0 2px;
}

.vault-card-preview {
    width: 100%;
    display: block;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(54, 45, 34, 0.12);
    background: #fff;
}

.vault-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
