/* Adlayr app screens */
.app-body { min-height: 100vh; display: flex; flex-direction: column; }
.app-header, .view, .app-footer { position: relative; z-index: 1; }
.app-header { position: sticky; }

.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 24px; }
.app-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.app-nav a { padding: 9px 14px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.app-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.app-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .12); }
.app-tools { display: flex; align-items: center; gap: 8px; }
.folder-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--text-2); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--a1), var(--a2)); color: #fff; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; cursor: default; }
.view { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 32px 24px 48px; outline: none; }
.view[data-route="layers"], .view[data-route="resize"], .view[data-route="psd"] { max-width: 1680px; }
.app-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; background: rgba(7, 9, 13, .4); }

/* Centered screens (sign-in, folder, gate) */
.center-body .center-main, .center-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px 16px; position: relative; z-index: 1; }
.center-card { width: 100%; max-width: 440px; padding: 32px; }
.center-card h1 { font-size: 28px; }
.form-msg { color: #FFB0B0; font-size: 14px; min-height: 1em; }
.code-input { letter-spacing: .3em; font-family: var(--mono); text-align: center; font-size: 22px; }
.big-icon { display: inline-flex; color: #D8CFFF; }
.big-icon.ok { color: var(--ok); }
.boot-loader span { display: block; width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: #fff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate-body { min-height: 100vh; }
.gate { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 32px 20px 24px; gap: 24px; }
.gate-card { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.gate-card h1 { font-size: 30px; }
.gate-icon { color: #fff; }

/* Page heads */
.page-head { margin-bottom: 28px; display: flex; flex-direction: column; gap: 8px; }
.page-head.row-between { flex-direction: row; align-items: flex-end; }
.panel { padding: 24px; }
.panel.narrow { max-width: 560px; margin: 40px auto; }
.empty { padding: 36px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-2); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; margin-bottom: 16px; color: #FFE2A8; }
.hint { padding: 10px 12px; border-radius: 10px; background: rgba(16, 201, 183, .12); color: #C7F5EF; font-size: 13px; }
.pad-x { padding: 0 6px; } .pad-8 { padding: 8px; }

/* Home: mode cards */
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-bottom: 44px; }
.mode-card { position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 236px; padding: 28px; color: var(--text); text-decoration: none; overflow: hidden; }
.mode-card:hover { color: #fff; border-color: var(--line-strong); }
.mode-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; transition: border-radius .45s var(--ease), transform .45s var(--ease); }
.mode-card:hover .mode-icon { border-radius: 50% 20% 50% 20%; transform: rotate(-6deg) scale(1.06); }
.tone-violet .mode-icon { background: rgba(124, 98, 255, .25); color: #D8CFFF; }
.tone-teal .mode-icon { background: rgba(16, 201, 183, .22); color: #9EF0E6; }
.tone-pink .mode-icon { background: rgba(255, 61, 139, .22); color: #FFB3D1; }
.mode-icon .ic path, .mode-icon .ic rect { transition: d .45s var(--ease), transform .45s var(--ease); transform-box: fill-box; transform-origin: center; }
.mode-card:hover .ic-layers path:nth-child(1) { transform: translateY(-2px); }
.mode-card:hover .ic-layers path:nth-child(3) { transform: translateY(2px); }
.mode-card:hover .ic-resize rect:nth-child(1) { transform: scale(.8); }
.mode-card:hover .ic-resize rect:nth-child(2) { transform: scale(1.15); }
.mode-card:hover .ic-psd rect { transform: rotate(8deg); }
.mode-title { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.mode-text { color: var(--text-2); line-height: 1.5; }
.mode-go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; transition: transform .25s var(--ease); width: fit-content; }
.tone-violet .mode-go { color: #D8CFFF; } .tone-teal .mode-go { color: #9EF0E6; } .tone-pink .mode-go { color: #FFB3D1; }

/* Shared fx */
.fx-card { --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg; transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .35s var(--ease), border-color .3s; }
.fx-card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: radial-gradient(240px circle at var(--mx) var(--my), rgba(255, 255, 255, .55), transparent 60%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .3s; pointer-events: none; }
.fx-card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(360px circle at var(--mx) var(--my), rgba(255, 255, 255, .07), transparent 60%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.fx-card:hover::before, .fx-card:hover::after { opacity: 1; }
.fx-magnet { transition: transform .25s var(--ease); }

/* Recent projects */
.recent h2 { font-size: 20px; }
.recent-grid > .empty, .recent-grid > p { grid-column: 1 / -1; }
.recent-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.project-card { display: flex; flex-direction: column; gap: 8px; color: var(--text); text-align: left; background: none; border: 0; padding: 0; cursor: default; }
.project-card.pick { cursor: pointer; }
.thumb-wrap { position: relative; aspect-ratio: 1 / 1; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #15181F; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.thumb-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.project-card:hover img { transform: scale(1.04); }
.dir-fill { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 12px; background: rgba(8, 10, 14, .62); backdrop-filter: blur(4px); opacity: 0; transform: translate(0, 100%); }
.dir-hover.dir-in .dir-fill { animation: dirIn .32s var(--ease) forwards; }
.dir-hover.dir-out .dir-fill { animation: dirOut .28s var(--ease) forwards; }
.dir-hover[data-from="top"].dir-in .dir-fill { --fx: 0; --fy: -100%; } .dir-hover[data-from="bottom"].dir-in .dir-fill { --fx: 0; --fy: 100%; }
.dir-hover[data-from="left"].dir-in .dir-fill { --fx: -100%; --fy: 0; } .dir-hover[data-from="right"].dir-in .dir-fill { --fx: 100%; --fy: 0; }
.dir-hover[data-from="top"].dir-out .dir-fill { --fx: 0; --fy: -100%; } .dir-hover[data-from="bottom"].dir-out .dir-fill { --fx: 0; --fy: 100%; }
.dir-hover[data-from="left"].dir-out .dir-fill { --fx: -100%; --fy: 0; } .dir-hover[data-from="right"].dir-out .dir-fill { --fx: 100%; --fy: 0; }
@keyframes dirIn { from { opacity: 0; transform: translate(var(--fx, 0), var(--fy, 100%)); } to { opacity: 1; transform: none; } }
@keyframes dirOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translate(var(--fx, 0), var(--fy, 100%)); } }
.project-name { font-weight: 600; }
.project-meta { color: var(--text-3); font-size: 13px; }

/* Brand Kit */
.brand-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.brand-list, .set-list { display: flex; flex-direction: column; gap: 6px; }
.brand-item, .set-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text); text-align: left; cursor: pointer; font-weight: 500; }
.brand-item { justify-content: flex-start; }
.brand-item:hover, .set-item:hover { background: rgba(255, 255, 255, .08); }
.brand-item.active, .set-item.active { background: rgba(255, 255, 255, .14); border-color: var(--line-strong); }
.swatch-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); flex-shrink: 0; }
.swatches { display: flex; flex-direction: column; gap: 10px; }
.swatch-row { display: flex; align-items: flex-end; gap: 8px; }
.color-field { max-width: 280px; }
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.logo-tile { display: flex; flex-direction: column; gap: 8px; }
.logo-preview { aspect-ratio: 16 / 9; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
.logo-preview img { max-height: 100%; object-fit: contain; }
.logo-add { aspect-ratio: 16 / 9; border-radius: 12px; border: 1.5px dashed var(--line-strong); background: rgba(255, 255, 255, .03); color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; padding: 10px; text-align: center; }
.logo-add:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); font-size: 13px; color: var(--text); white-space: nowrap; }
.chip-x { display: inline-flex; border: 0; background: none; color: var(--text-2); cursor: pointer; padding: 2px; border-radius: 50%; }
.chip-x:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); }

/* Presets */
.sets-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.set-name { font-weight: 600; }
.quick-add { align-items: center; padding: 14px 18px; }
.quick-add .input-sm:not(.num) { width: 110px; }
.quick-add .input-sm[placeholder^="Name"] { width: 180px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .input.num { width: 76px; }
.table td:first-child .input { min-width: 190px; }
.table select.input { min-width: 84px; }

/* Team & system check */
.team-list, .check-list { list-style: none; margin: 0; padding: 0; }
.team-row, .check-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.team-row:last-child, .check-row:last-child { border-bottom: 0; }
.check-row { align-items: flex-start; }
.check-row .btn { margin-top: 8px; }
.check-state { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.check-state.pending { border: 2px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin 1s linear infinite; }
.check-state.ok { background: rgba(43, 210, 127, .2); color: var(--ok); }
.check-state.warn { background: rgba(255, 196, 84, .2); color: var(--warn); }
.check-state.fail { background: rgba(255, 107, 107, .22); color: var(--bad); }

/* Step bar */
.stepbar { list-style: none; margin: 0 0 24px; padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: 100%; border-radius: 999px; background: rgba(9, 11, 16, .5); border: 1px solid var(--line); backdrop-filter: blur(16px); }
.stepbar button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 0; background: none; color: var(--text-3); font-size: 14px; white-space: nowrap; cursor: pointer; }
.stepbar button:disabled { cursor: default; }
.stepbar .done button { color: var(--text-2); }
.stepbar .done button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.stepbar .current button { color: #fff; background: rgba(255, 255, 255, .13); font-weight: 600; }
.step-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 1px solid rgba(255, 255, 255, .35); }
.stepbar .done .step-dot { background: var(--ok); color: #04130A; border-color: transparent; }
.stepbar .current .step-dot { background: #fff; color: #0B0D12; border-color: transparent; }

/* Mode 1: choose */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 320px; padding: 32px; text-align: center; border-style: dashed; border-width: 1.5px; cursor: pointer; transition: background .2s, border-color .2s; }
.dropzone:hover, .dropzone.over { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .45); }
.choose-grid, .save-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.center-content { display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 300px; }
.choose-preview, .save-preview { max-height: 62vh; width: auto; max-width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.success-card { padding: 20px; border-radius: 16px; background: rgba(43, 210, 127, .08); border: 1px solid rgba(43, 210, 127, .3); }

/* Workspace */
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: 16px; height: calc(100vh - 230px); min-height: 560px; }
.side-panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow: auto; min-height: 0; }
.panel-title { font-size: 16px; }
.panel-foot { margin-top: auto; padding-top: 12px; }
.canvas-panel { min-width: 0; min-height: 0; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.layer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.layer-row { display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-radius: 10px; cursor: pointer; font-size: 14px; outline-offset: -2px; }
.layer-row:hover { background: rgba(255, 255, 255, .06); }
.layer-row.selected { background: rgba(124, 98, 255, .2); box-shadow: inset 0 0 0 1px rgba(160, 140, 255, .6); }
.layer-row.is-hidden .layer-name { opacity: .45; }
.layer-kind { color: var(--text-3); display: inline-flex; }
.layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; background: #2B3138; color: #D7DEE6; }
.role-hero { background: #4A3216; color: #FFD49A; } .role-logo { background: #1B2D4D; color: #B8D2FF; } .role-headline { background: #2E2350; color: #D2C6FF; }
.role-cta { background: #123F3A; color: #9EF0E6; } .role-legal { background: #4A2235; color: #FFC2DA; } .role-background { background: #22302A; color: #BFE3CF; }
.role-text, .role-decoration { background: #2B3138; color: #D7DEE6; }
.role-chip { cursor: pointer; border: 1px solid transparent; opacity: .72; }
.role-chip:hover { opacity: 1; }
.role-chip.on { opacity: 1; border-color: currentColor; }
.role-chip.role-hero { background: #4A3216; color: #FFD49A; } .role-chip.role-logo { background: #1B2D4D; color: #B8D2FF; } .role-chip.role-headline { background: #2E2350; color: #D2C6FF; }
.role-chip.role-cta { background: #123F3A; color: #9EF0E6; } .role-chip.role-legal { background: #4A2235; color: #FFC2DA; } .role-chip.role-background { background: #22302A; color: #BFE3CF; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button.on { background: #fff; color: #0B0D12; }
.pending-card { padding: 12px; border-radius: 12px; background: rgba(124, 98, 255, .14); border: 1px solid rgba(160, 140, 255, .4); }
.props { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.props dt { color: var(--text-3); } .props dd { margin: 0; text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ocr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.ocr-list li { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); }

/* Editor */
.editor { --ruler-tick: #6A6F74; --ruler-text: #9AA0A6; position: relative; height: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: 22px minmax(0, 1fr); background: #2A2C2E; }
.ruler-corner { background: #1F2123; border-right: 1px solid #3A3D40; border-bottom: 1px solid #3A3D40; }
.ruler { display: block; background: #232527; }
.ruler-x { border-bottom: 1px solid #3A3D40; }
.ruler-y { border-right: 1px solid #3A3D40; }
.viewport { position: relative; overflow: hidden; touch-action: none; }
.viewport[data-tool="select"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 2v8M12 14v8M2 12h8M14 12h8' stroke='%23000' stroke-width='3'/%3E%3Cpath d='M12 2v8M12 14v8M2 12h8M14 12h8' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 12 12, crosshair; }
.viewport[data-tool="lasso"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M2 22 4 15 15 4l5 5L9 20z' fill='%23fff' stroke='%23000' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M2 22l4-1' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") 2 22, crosshair; }
.viewport[data-tool="move"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M4 2v17l4.2-4 2.8 6.5 2.6-1.1-2.8-6.4H16.5z' fill='%23000' stroke='%23fff' stroke-width='1.3' stroke-linejoin='round'/%3E%3Cg stroke='%23fff' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M21 15v10M16 20h10'/%3E%3C/g%3E%3Cpath d='M21 15v10M16 20h10' stroke='%23000' stroke-width='1.3'/%3E%3Cpath d='M21 14l-1.8 2h3.6zM21 26l-1.8-2h3.6zM15 20l2-1.8v3.6zM27 20l-2-1.8v3.6z' fill='%23000' stroke='%23fff' stroke-width='.6'/%3E%3C/svg%3E") 4 2, default; }
.viewport[data-tool="hand"] { cursor: grab; }
.viewport.panning, .viewport.panning * { cursor: grabbing !important; }
.viewport[data-tool="zoom"] { cursor: zoom-in; }
.viewport[data-tool="zoom-out"] { cursor: zoom-out; }
.viewport[data-tool="hand"] .stage-canvas, .viewport[data-tool="hand"] .stage-overlay { cursor: inherit; }
.ed-toolbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; z-index: 5; background: rgba(24,25,27,.86); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 8px 24px rgba(0,0,0,.35); cursor: default; white-space: nowrap; }
.ed-tool { width: 34px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: #C9CED3; cursor: pointer; }
.ed-tool:hover { background: rgba(255,255,255,.08); color: #fff; }
.ed-tool.on { background: var(--a1, #6B4DFF); color: #fff; }
.ed-tool:disabled { opacity: .35; cursor: default; background: transparent; }
.ed-tool:focus-visible, .ed-zoom:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.ed-glyph { font-size: 20px; line-height: 1; font-weight: 500; }
.ed-sep { width: 1px; height: 20px; background: rgba(255,255,255,.12); margin: 0 4px; }
.ed-zoom { min-width: 56px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #E6E9EC; font-size: 12px; cursor: pointer; }
.ed-zoom:hover { background: rgba(255,255,255,.08); }
.stage { position: absolute; box-shadow: 0 20px 60px rgba(0, 0, 0, .55); }
.stage-canvas, .stage-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-canvas { background: #fff; image-rendering: auto; }
.sel-box { position: absolute; pointer-events: none; }
.sel-box.hidden { display: none; }
.handle { position: absolute; width: 9px; height: 9px; background: #fff; border: 1px solid #000; }
.handle.tl { left: -5px; top: -5px; } .handle.tr { right: -5px; top: -5px; } .handle.bl { left: -5px; bottom: -5px; } .handle.br { right: -5px; bottom: -5px; }
.sel-label { position: absolute; left: 0; top: -28px; padding: 3px 8px; border-radius: 6px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.stage-info { position: absolute; left: 34px; bottom: 10px; font-family: var(--mono); font-size: 12px; color: #A9AFB5; pointer-events: none; }

/* Before / after */
.compare-panel { margin-top: 16px; }
.ba { position: relative; width: 100%; max-width: 900px; margin: 16px auto 0; border-radius: 14px; overflow: hidden; user-select: none; touch-action: none; cursor: ew-resize; }
.ba-img, .ba-before { position: absolute; inset: 0; width: 100%; height: 100%; }
.ba-img { object-fit: cover; display: block; }
.ba-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; transform: translateX(-1px); }
.ba-handle { position: absolute; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 0; background: #fff; color: #0B0D12; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); cursor: ew-resize; }
.ba-tag { position: absolute; top: 12px; padding: 4px 10px; border-radius: 8px; background: rgba(0, 0, 0, .55); font-family: var(--mono); font-size: 12px; }
.ba-tag.left { left: 12px; } .ba-tag.right { right: 12px; }

/* Mode 2: pick sizes */
.set-block { padding: 16px 20px; margin-bottom: 14px; }
.set-block summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.set-block summary::-webkit-details-marker { display: none; }
.set-title { font-weight: 600; font-size: 16px; }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 14px; }
.size-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); cursor: pointer; }
.size-option:hover { background: rgba(255, 255, 255, .08); }
.size-option:has(input:checked) { background: rgba(124, 98, 255, .16); border-color: rgba(160, 140, 255, .55); }
.size-thumb { width: 28px; max-height: 28px; border: 1.5px solid rgba(255, 255, 255, .5); border-radius: 3px; flex-shrink: 0; }
.size-text { display: flex; flex-direction: column; min-width: 0; }
.size-text strong { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mode 2: review */
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.review-card { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.review-preview { width: 100%; max-height: 420px; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.review-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.skeleton { background: linear-gradient(90deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .12), rgba(255, 255, 255, .05)); background-size: 200% 100%; animation: shimmer 1.4s infinite; min-height: 60px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.review-meta { display: flex; flex-direction: column; gap: 8px; }
.size-badge { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
.size-badge.ok { background: rgba(43, 210, 127, .18); color: #8BF0BC; }
.size-badge.warn { background: rgba(255, 196, 84, .18); color: #FFDB8F; }
.size-badge.bad { background: rgba(255, 107, 107, .2); color: #FFB0B0; }
.warn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.warn-list li { display: flex; gap: 6px; align-items: center; }
.err-text { color: #FFB0B0; } .warn-text { color: #FFDB8F; }
.adjust-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.adjust-stage { border-radius: 12px; padding: 16px; display: flex; align-items: center; justify-content: center; min-height: 360px; }
.adjust-canvas { max-width: 100%; max-height: 64vh; cursor: grab; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.adjust-layers { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.adjust-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; }
.adjust-row.selected { background: rgba(124, 98, 255, .2); }
.adjust-props { padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 10px; border-radius: 8px; background: rgba(255, 255, 255, .04); }
.adjust-props input[type="range"] { accent-color: var(--accent); }

/* Mode 3: map roles */
.map-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
.sticky-top { position: sticky; top: 90px; }
.psd-preview { max-height: 70vh; width: auto; max-width: 100%; }
.map-list { display: flex; flex-direction: column; }
.map-row { display: flex; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.map-row:last-child { border-bottom: 0; }
.map-row.is-hidden { opacity: .6; }
.map-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }

/* Font dialog */
.font-dialog { display: flex; flex-direction: column; gap: 18px; }
.font-needed { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.font-name { font-family: var(--mono); font-size: 26px; color: #fff; min-height: 1.3em; }
.typed-font { border-right: 2px solid var(--teal); padding-right: 3px; animation: caret .8s step-end infinite; }
@keyframes caret { 50% { border-color: transparent; } }
.font-status { font-size: 13px; color: var(--text-2); min-height: 1em; }

/* Responsive */
@media (max-width: 1200px) {
  .workspace { grid-template-columns: 240px minmax(0, 1fr); height: auto; }
  .workspace > .side-panel:last-child { grid-column: 1 / -1; }
  .canvas-panel { height: 70vh; }
}
@media (max-width: 960px) {
  .mode-cards { grid-template-columns: minmax(0, 1fr); }
  .brand-layout, .sets-layout, .choose-grid, .save-grid, .map-grid, .adjust-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .page-head.row-between { flex-direction: column; align-items: flex-start; }
}
.or-line { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; text-align: center; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.or-line span { flex: 0 1 auto; max-width: 70%; }
.export-opts { align-items: center; padding: 14px 18px; margin-bottom: 14px; }
.export-opts select { width: auto; }
.folder-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); margin: 14px 0 8px; flex-wrap: wrap; }
.file-link { display: block; color: #C9BCFF; text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.file-link:hover { color: #fff; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.layer-row[draggable="true"] { cursor: grab; }
.layer-row.dragging { opacity: .45; }
.layer-row.drop-above { box-shadow: inset 0 2px 0 #9EF0E6; }
.layer-row.drop-below { box-shadow: inset 0 -2px 0 #9EF0E6; }
.platform-finder { padding: 16px 18px; margin-bottom: 14px; }
.set-chip { cursor: pointer; font-weight: 500; }
.set-chip:hover { background: rgba(255, 255, 255, .14); }
.set-chip.on { background: rgba(124, 98, 255, .3); border-color: rgba(180, 160, 255, .7); color: #fff; }
.set-chip[hidden], .size-option[hidden], .set-block[hidden] { display: none; }
.set-item[hidden] { display: none; }
.seg-4 { grid-template-columns: repeat(2, 1fr); }
.helper-chip { padding: 7px 12px; border-radius: 10px; background: rgba(43, 210, 127, .16); color: #8BF0BC; font-size: 12px; font-weight: 600; white-space: nowrap; }
.helper-chip[hidden] { display: none; }
.save-platform { flex-basis: 100%; padding-top: 10px; border-top: 1px solid var(--line); }
.save-platform[hidden] { display: none; }
.save-platform .input { width: 240px; }
.ed-fit-chip { position: absolute; right: 12px; bottom: 10px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: rgba(24,25,27,.9); color: #E6E9EC; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.ed-fit-chip:hover { background: var(--a1, #6B4DFF); color: #fff; }
.ed-fit-chip.hidden { display: none; }
.chip-new { display: inline-flex; align-items: center; gap: 6px; border-style: dashed; }
.set-block > summary .btn-sm { padding-block: 4px; }
.plat-dialog { min-width: min(720px, 90vw); }
.plat-rows { display: grid; gap: 6px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.plat-row { display: grid; grid-template-columns: minmax(140px, 1.4fr) minmax(200px, 1.2fr) 100px 56px 36px; gap: 8px; align-items: center; }
.plat-row .num { width: 84px; }
.plat-head { padding: 0 2px; }
.plat-add .num { width: 90px; }
.self-start { align-self: flex-start; }
@media (max-width: 760px) { .plat-row { grid-template-columns: 1fr 1fr; } }
.plat-add .input { width: auto; flex: 0 0 auto; }
.plat-add .input:first-of-type { width: 220px; }
button.helper-chip { border: 0; cursor: pointer; }
.helper-chip.off { background: rgba(255, 196, 61, .14); color: #FFD27A; }
.steps-list { padding-left: 20px; display: grid; gap: 4px; }
.role-badges, .role-chip.role-badges { background: #33301A; color: #F2E59A; }
.layer-row.group-row { font-weight: 600; }
.layer-row.in-group { padding-left: 26px; }
.group-caret svg { transition: transform .15s; }
.group-caret.collapsed svg { transform: rotate(-90deg); }
.style-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.style-card { margin: 0; display: grid; gap: 6px; justify-items: center; }
.style-card figcaption { display: flex; align-items: center; gap: 4px; color: var(--muted, #9AA0A6); }
.style-thumb svg { display: block; border-radius: 6px; overflow: hidden; }
.sb-bg { fill: rgba(255,255,255,.06); stroke: rgba(255,255,255,.25); }
.sb { fill-opacity: .55; stroke-width: 1; stroke: rgba(255,255,255,.6); }
.sb-logo { fill: #3A6FD8; } .sb-headline { fill: #8A6CFF; } .sb-hero { fill: #E0A050; } .sb-text { fill: #9AA4B0; }
.sb-cta { fill: #2BC4B0; } .sb-badges { fill: #E8D35A; } .sb-legal { fill: #E5689A; }
.tag-ai { background: rgba(124,98,255,.22); color: #D2C6FF; } .tag-rules { background: rgba(255,196,61,.14); color: #FFD27A; }

/* Pick sizes: the count and Next button stay on the right, even when the title wraps */
.page-head .head-actions { margin-left: auto; flex-shrink: 0; }
.plat-tick { justify-content: center; }
.plat-tick input { width: 20px; height: 20px; accent-color: var(--accent, #7c5cff); cursor: pointer; }
.plat-head .check input { width: 16px; height: 16px; accent-color: var(--accent, #7c5cff); }
.finishing-chip { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 13px; color: var(--text-2, #cfd3da); }
.spinner-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent, #7c5cff); flex: none; animation: finPulse 1s ease-in-out infinite; }
@keyframes finPulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .spinner-dot { animation: none; } }
.review-status { padding: 14px 16px; border-radius: 14px; margin-bottom: 16px; display: grid; gap: 10px; }
.review-status .busy-bar { height: 6px; }

/* Build version next to the logo */
.brand-ver { margin-left: 8px; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: rgba(255,255,255,.75); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); align-self: center; }

/* Key boxes shown as dots without being password fields (so browsers don't auto-fill saved passwords) */
.input.masked { -webkit-text-security: disc; text-security: disc; }
.moved-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.moved-grid figure { margin: 0; min-width: 0; }
.moved-pic { width: 100%; height: auto; max-height: 62vh; object-fit: contain; border-radius: 10px; background: #111; display: block; }
@media (max-width: 640px) { .moved-grid { grid-template-columns: 1fr; } }
.tap-wrap { position: relative; display: inline-block; max-width: 100%; }
.tap-preview { cursor: pointer; display: block; }
.role-pop { position: absolute; z-index: 20; width: 260px; padding: 12px; border-radius: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); background: rgba(18, 22, 28, .96); }
.role-pop .chips { flex-wrap: wrap; }
.map-row.is-selected { background: rgba(255, 255, 255, .05); border-radius: 10px; }
