:root {
  --ink: #111318;
  --panel: #f5f5f2;
  --line: #d9d9d4;
  --blue: #2457ff;
  --orange: #ff5a24;
  --lime: #b8f23d;
  --canvas: #d8d8d3;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--ink); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
button { font: inherit; }
button:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }

.editor-shell { min-height: 100vh; overflow: hidden; background: var(--canvas); }
.editor-topbar { position: relative; z-index: 4; display: grid; min-height: 54px; grid-template-columns: 180px 1fr auto; align-items: center; border-bottom: 1px solid #33363d; color: white; background: #181a20; font-size: 12px; }
.window-dots { display: flex; gap: 7px; padding-left: 18px; }
.window-dots span { width: 10px; height: 10px; border-radius: 50%; background: #50535c; }
.window-dots span:first-child { background: var(--orange); }
.window-dots span:nth-child(2) { background: #ffbd2e; }
.window-dots span:nth-child(3) { background: var(--lime); }
.file-tab { display: flex; width: max-content; height: 40px; align-items: center; gap: 10px; padding: 0 18px; border-right: 1px solid #343740; border-left: 1px solid #343740; background: #23262d; }
.file-icon { color: var(--orange); }
.saved-state { color: #8e929d; font-size: 10px; }
.top-actions { display: flex; align-items: center; gap: 18px; padding-right: 17px; color: #aeb1ba; }
.share-pill { padding: 7px 12px; border-radius: 7px; color: #111318; background: var(--lime); font-weight: 800; }

.editor-body { display: grid; min-height: calc(100vh - 54px); grid-template-columns: 58px 1fr 330px; }
.tool-rail { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 13px 7px; border-right: 1px solid #353840; color: #d4d6dd; background: #1c1f25; }
.tool { display: grid; width: 38px; height: 38px; border-radius: 7px; font-size: 18px; place-items: center; }
.tool.active { color: white; background: var(--blue); }
.tool-spacer { flex: 1; }
.color-chip { width: 25px; height: 25px; border: 3px solid #fff; border-radius: 5px; box-shadow: 0 0 0 1px #555; }
.color-chip.orange { background: var(--orange); }
.color-chip.blue { margin-top: -16px; margin-left: 13px; background: var(--blue); }

.workspace { position: relative; display: grid; min-width: 0; padding: 44px 55px 55px 70px; overflow: hidden; background-color: var(--canvas); background-image: radial-gradient(#aeadab 0.65px, transparent 0.65px); background-size: 15px 15px; place-items: center; }
.ruler { position: absolute; z-index: 1; color: #6f716e; background: #c7c7c2; font-size: 8px; user-select: none; }
.ruler-top { top: 0; right: 0; left: 0; display: flex; height: 22px; justify-content: space-around; border-bottom: 1px solid #aaa9a4; }
.ruler-left { top: 0; bottom: 0; left: 0; display: flex; width: 22px; flex-direction: column; justify-content: space-around; border-right: 1px solid #aaa9a4; }
.ruler i { font-style: normal; }

.artboard { position: relative; width: min(100%, 720px); aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid #777; background: #fbfaf6; box-shadow: 0 18px 55px rgba(0,0,0,.2); isolation: isolate; }
.poster-grid { position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(to right, transparent 24.8%, rgba(36,87,255,.12) 25%, transparent 25.2%, transparent 74.8%, rgba(36,87,255,.12) 75%, transparent 75.2%), linear-gradient(to bottom, transparent 49.8%, rgba(36,87,255,.12) 50%, transparent 50.2%); }
.selection-tag { position: absolute; top: -22px; left: -1px; padding: 4px 8px; color: white; background: var(--blue); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.corner { position: absolute; z-index: 8; width: 9px; height: 9px; border: 1px solid white; background: var(--blue); }
.corner-tl { top: -5px; left: -5px; } .corner-tr { top: -5px; right: -5px; } .corner-bl { bottom: -5px; left: -5px; } .corner-br { right: -5px; bottom: -5px; }
.poster-copy { position: absolute; top: 9%; left: 7%; z-index: 2; width: 62%; }
.poster-meta { margin: 0 0 14px; color: #535760; font-size: clamp(7px, 1vw, 11px); font-weight: 800; letter-spacing: .14em; }
.poster-copy h1 { display: flex; flex-wrap: wrap; max-width: 520px; margin: 0; font-family: Impact, "Arial Black", sans-serif; font-size: clamp(68px, 11vw, 140px); line-height: .72; letter-spacing: -.055em; }
.poster-copy h1 span { display: inline-block; }
.poster-copy h1 span:nth-child(2) { color: var(--blue); }
.poster-copy h1 span:nth-child(3) { color: var(--orange); }
.poster-subtitle { margin: 22px 0 0 4px; font-size: clamp(13px, 2vw, 22px); font-weight: 800; text-transform: uppercase; }

.avatar-art { position: absolute; right: 5%; bottom: 11%; z-index: 3; display: grid; width: 31%; justify-items: center; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.avatar-crop { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border: 4px solid var(--ink); border-radius: 50%; background: white; }
.avatar-crop img { position: absolute; top: -18.9%; left: -34.4%; width: 176.8%; max-width: none; }
.avatar-label { margin-top: -5px; padding: 5px 11px; color: white; background: var(--ink); font-size: clamp(6px, .9vw, 9px); font-weight: 800; line-height: 1.25; letter-spacing: .08em; text-align: center; transform: rotate(-2deg); }
.poster-footer { position: absolute; right: 0; bottom: 0; left: 0; display: flex; min-height: 8%; align-items: center; justify-content: space-around; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--ink); font-size: clamp(6px, 1vw, 9px); font-weight: 900; letter-spacing: .07em; }

.poster-accent { position: absolute; opacity: 0; transform: scale(.7); transition: opacity .35s ease, transform .45s cubic-bezier(.2,.8,.2,1); }
.poster-accent.visible { opacity: 1; transform: scale(1); }
.accent-attention { top: 7%; right: 3%; display: grid; grid-template-columns: repeat(2, 16px); gap: 6px; }
.accent-attention span { width: 16px; height: 16px; border-radius: 50%; background: var(--orange); }
.accent-responsibility { top: 57%; left: 7%; padding: 7px 12px; color: white; background: var(--blue); font-size: clamp(8px, 1.5vw, 13px); font-weight: 900; letter-spacing: .12em; transform: rotate(-4deg) scale(.7); }
.accent-responsibility.visible { transform: rotate(-4deg) scale(1); }
.accent-creativity { top: 3%; right: 19%; color: var(--orange); font-family: Impact, sans-serif; }
.accent-creativity .squiggle { display: block; font-size: clamp(24px, 5vw, 55px); transform: rotate(10deg); }
.accent-creativity .spark { position: absolute; top: 45px; right: -8px; font-size: 28px; }
.accent-ambiguity { bottom: 18%; left: 8%; display: flex; align-items: center; gap: 8px; font-family: Impact, sans-serif; font-size: clamp(28px, 6vw, 66px); }
.accent-ambiguity span:first-child { color: var(--orange); }
.accent-ambiguity span:nth-child(2) { color: var(--blue); }
.accent-ambiguity span:last-child { display: grid; width: 1.1em; height: 1.1em; border-radius: 50%; background: var(--lime); place-items: center; }
.zoom-bar { position: absolute; right: 17px; bottom: 14px; display: flex; gap: 8px; padding: 6px 10px; border: 1px solid #999; border-radius: 5px; background: #eeeeeb; font-size: 9px; }

.layers-panel { position: relative; z-index: 3; display: flex; flex-direction: column; min-width: 0; border-left: 1px solid #c7c7c3; background: var(--panel); }
.panel-tabs { display: flex; height: 49px; align-items: end; gap: 24px; padding: 0 18px; border-bottom: 1px solid var(--line); color: #858680; font-size: 12px; }
.panel-tabs span, .panel-tabs strong { padding-bottom: 12px; }
.panel-tabs strong { border-bottom: 2px solid var(--ink); color: var(--ink); }
.panel-heading { display: flex; justify-content: space-between; padding: 15px 17px 9px; font-size: 11px; font-weight: 700; }
.layer-list { display: grid; gap: 2px; padding: 4px 8px; }
.layer-row { display: grid; min-height: 63px; grid-template-columns: 21px 38px 1fr 25px; gap: 8px; align-items: center; padding: 7px 8px; border: 1px solid transparent; border-radius: 5px; color: var(--ink); background: transparent; cursor: pointer; text-align: left; transition: background .2s ease, border .2s ease, transform .2s ease; }
.layer-row:hover { border-color: #c9c9c4; background: white; transform: translateX(-2px); }
.layer-row:disabled { cursor: default; opacity: .45; }
.layer-row.enabled { border-color: color-mix(in srgb, var(--layer-color) 50%, white); background: white; }
.visibility-icon { color: #8b8d87; font-size: 13px; }
.layer-row.enabled .visibility-icon { color: var(--layer-color); }
.layer-thumbnail { display: grid; width: 34px; height: 34px; border: 1px solid #c5c5bf; color: var(--ink); background: color-mix(in srgb, var(--layer-color) 25%, white); font-size: 10px; font-weight: 900; place-items: center; }
.layer-name { min-width: 0; }
.layer-name strong, .layer-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-name strong { font-size: 11px; }
.layer-name small { margin-top: 3px; color: #898b85; font-size: 8px; }
.layer-check { color: var(--layer-color); font-weight: 900; text-align: center; }
.progress-block { margin-top: auto; padding: 14px 16px 8px; border-top: 1px solid var(--line); }
.progress-line { height: 4px; overflow: hidden; border-radius: 999px; background: #d9dad5; }
.progress-line span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--orange), var(--lime)); transition: width .35s ease; }
.progress-block p { margin: 8px 0 0; color: #6d6e69; font-size: 9px; text-align: right; }
.export-button { display: flex; min-height: 44px; align-items: center; justify-content: space-between; margin: 9px 14px 16px; padding: 0 15px; border: 0; border-radius: 6px; color: white; background: var(--blue); cursor: pointer; font-size: 11px; font-weight: 800; animation: export-in .35s ease-out both; }
.export-button:hover { background: #123ee4; }

.intro-screen, .modal-layer, .final-overlay { position: fixed; inset: 0; z-index: 20; display: grid; padding: 20px; background: rgba(13,15,19,.76); backdrop-filter: blur(8px); place-items: center; }
.intro-card { position: relative; width: min(100%, 640px); overflow: hidden; padding: clamp(34px, 7vw, 70px); border: 1px solid #4c505a; color: white; background: #15171c; box-shadow: 0 30px 90px rgba(0,0,0,.42); }
.intro-card::before { position: absolute; top: -80px; right: -65px; width: 240px; height: 240px; border: 45px solid var(--blue); border-radius: 50%; content: ""; }
.intro-file-mark { position: relative; z-index: 1; display: grid; width: 74px; height: 74px; border-radius: 12px; color: white; background: var(--orange); font-family: Impact, sans-serif; font-size: 42px; place-items: center; transform: rotate(-3deg); }
.intro-file-mark span { position: absolute; top: -10px; right: -8px; color: var(--lime); font-size: 22px; }
.intro-kicker, .final-kicker, .quality-label { margin: 26px 0 12px; color: var(--lime); font-size: 10px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.intro-card h2 { position: relative; z-index: 1; max-width: 520px; margin: 0; font-size: clamp(34px, 6vw, 64px); line-height: .98; letter-spacing: -.045em; }
.intro-card > p:not(.intro-kicker) { position: relative; z-index: 1; max-width: 450px; margin: 23px 0; color: #c4c7cf; font-size: 17px; line-height: 1.55; }
.intro-card button, .quality-footer button { position: relative; z-index: 1; display: inline-flex; min-height: 47px; align-items: center; gap: 28px; padding: 0 19px; border: 0; color: white; background: var(--blue); cursor: pointer; font-size: 12px; font-weight: 800; }
.intro-card button:hover { background: var(--orange); }
.intro-card small { display: block; margin-top: 29px; color: #696d77; font-family: monospace; font-size: 9px; }

.modal-layer { z-index: 30; }
.quality-card { position: relative; width: min(100%, 650px); overflow: hidden; padding: clamp(34px, 6vw, 62px); border: 1px solid #333; background: #faf9f5; box-shadow: 0 30px 90px rgba(0,0,0,.42); animation: card-in .35s cubic-bezier(.2,.8,.2,1) both; }
.quality-card::before { position: absolute; top: 0; right: 0; left: 0; height: 9px; background: var(--quality-color); content: ""; }
.quality-index { position: absolute; top: 26px; right: 34px; color: color-mix(in srgb, var(--quality-color) 35%, white); font-family: Impact, sans-serif; font-size: 96px; line-height: 1; }
.quality-card h2 { position: relative; max-width: 85%; margin: 0; font-size: clamp(39px, 7vw, 72px); line-height: .96; letter-spacing: -.045em; }
.quality-card > p:not(.quality-label) { position: relative; max-width: 510px; margin: 25px 0; color: #555861; font-size: clamp(17px, 2.5vw, 21px); line-height: 1.55; }
.modal-close { position: absolute; top: 15px; right: 15px; z-index: 4; display: grid; width: 40px; height: 40px; border: 0; border-radius: 50%; background: white; cursor: pointer; font-size: 27px; place-items: center; }
.quality-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 35px; padding-top: 16px; border-top: 1px solid #dadad5; }
.quality-footer > span { color: #92948d; font-family: monospace; font-size: 9px; }
.quality-footer button { background: var(--ink); }

.final-overlay { z-index: 40; overflow: auto; background: rgba(10,12,16,.89); }
.final-card { position: relative; z-index: 2; width: min(100%, 980px); overflow: hidden; border: 1px solid #494c54; color: white; background: #14161b; box-shadow: 0 35px 100px rgba(0,0,0,.52); animation: final-in .55s cubic-bezier(.2,.8,.2,1) both; }
.final-status { display: flex; min-height: 42px; align-items: center; gap: 9px; padding: 0 18px; border-bottom: 1px solid #33363e; color: #9da0aa; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.final-status span { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.final-layout { display: grid; grid-template-columns: 1.45fr .8fr; }
.final-copy { padding: clamp(30px, 5vw, 65px); }
.final-copy h2 { max-width: 650px; margin: 0 0 26px; font-size: clamp(36px, 5vw, 66px); line-height: .98; letter-spacing: -.05em; }
.final-copy > p:not(.final-kicker) { max-width: 650px; margin: 12px 0; color: #c6c9d1; font-size: clamp(14px, 1.7vw, 18px); line-height: 1.55; }
.final-copy strong { display: block; margin-top: 27px; color: var(--lime); font-size: 18px; }
.leaving-scene { position: relative; display: grid; min-height: 480px; overflow: hidden; border-left: 1px solid #33363e; background: var(--orange); place-items: center; }
.leaving-scene::before { position: absolute; inset: 0; background-image: linear-gradient(rgba(17,19,24,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(17,19,24,.12) 1px, transparent 1px); background-size: 30px 30px; content: ""; }
.leaving-avatar { position: relative; z-index: 2; width: 68%; animation: walk-out 4s ease-in-out infinite; }
.leaving-avatar .avatar-crop { border-width: 6px; }
.project-folder { position: absolute; right: -20%; bottom: -4%; display: grid; width: 92px; height: 68px; padding-top: 14px; border: 3px solid var(--ink); color: var(--ink); background: var(--lime); font-size: 12px; font-weight: 900; line-height: 1.05; text-align: center; transform: rotate(6deg); }
.project-folder::before { position: absolute; top: -15px; left: -3px; width: 43px; height: 16px; border: 3px solid var(--ink); border-bottom: 0; background: var(--lime); content: ""; }
.exit-arrow { position: absolute; right: 6%; bottom: 5%; z-index: 2; font-family: Impact, sans-serif; font-size: 68px; animation: arrow-bounce 1s ease-in-out infinite; }
.system-toast { display: flex; min-height: 48px; align-items: center; gap: 9px; padding: 0 20px; border-top: 1px solid #33363e; color: #c6c9d1; background: #1a1d23; font-size: 11px; }
.system-toast span { color: var(--lime); }
.replay-button { position: absolute; right: 18px; bottom: 10px; z-index: 5; padding: 8px 12px; border: 1px solid #4d515c; color: #dfe1e7; background: #262930; cursor: pointer; font-size: 9px; }
.confetti { position: fixed; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -8%; width: 9px; height: 18px; animation: confetti-fall 3s linear both; }

@keyframes card-in { from { opacity: 0; transform: translateY(25px) scale(.95); } }
@keyframes final-in { from { opacity: 0; transform: translateY(30px) scale(.94); } }
@keyframes export-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes walk-out { 0%, 20% { transform: translateX(-5%) rotate(-2deg); } 55% { transform: translateX(7%) rotate(2deg); } 80%, 100% { transform: translateX(44%) rotate(4deg); } }
@keyframes arrow-bounce { 50% { transform: translateX(8px); } }
@keyframes confetti-fall { 0% { opacity: 0; transform: translateY(-10vh) rotate(0); } 10% { opacity: 1; } 100% { opacity: .9; transform: translateY(115vh) rotate(720deg); } }

@media (max-width: 980px) {
  .editor-body { grid-template-columns: 48px 1fr; }
  .layers-panel { grid-column: 1 / -1; border-top: 1px solid #c7c7c3; border-left: 0; }
  .layer-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { min-height: 70vh; padding: 45px 30px 55px 52px; }
  .progress-block { margin-top: 8px; }
  .final-layout { grid-template-columns: 1.2fr .65fr; }
}

@media (max-width: 650px) {
  .editor-topbar { grid-template-columns: 1fr auto; }
  .window-dots { display: none; }
  .file-tab { max-width: 100%; border-left: 0; }
  .file-tab strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .saved-state, .top-actions > span:first-child { display: none; }
  .top-actions { padding-right: 8px; }
  .share-pill { padding: 6px 8px; font-size: 8px; }
  .editor-body { grid-template-columns: 1fr; }
  .tool-rail { display: none; }
  .workspace { min-height: 58vh; padding: 38px 13px 42px 29px; }
  .artboard { aspect-ratio: 4 / 4.5; }
  .poster-copy { top: 8%; width: 86%; }
  .poster-copy h1 { font-size: clamp(67px, 24vw, 106px); line-height: .73; }
  .avatar-art { right: 5%; bottom: 11%; width: 38%; }
  .poster-subtitle { margin-top: 16px; }
  .accent-responsibility { top: 54%; }
  .accent-ambiguity { bottom: 18%; }
  .layer-list { grid-template-columns: 1fr; }
  .panel-tabs { display: none; }
  .panel-heading { padding-top: 14px; }
  .intro-screen, .modal-layer, .final-overlay { padding: 10px; }
  .intro-card { padding: 34px 25px; }
  .intro-card h2 { font-size: 40px; }
  .quality-card { padding: 45px 24px 30px; }
  .quality-index { top: 30px; right: 20px; font-size: 70px; }
  .quality-card h2 { font-size: 42px; }
  .quality-footer { align-items: flex-end; }
  .quality-footer > span { max-width: 42%; overflow-wrap: anywhere; }
  .final-overlay { align-items: start; }
  .final-card { margin: 6px 0; }
  .final-layout { grid-template-columns: 1fr; }
  .final-copy { padding: 32px 24px; }
  .leaving-scene { min-height: 270px; border-top: 1px solid #33363e; border-left: 0; }
  .leaving-avatar { width: 45%; }
  .system-toast { min-height: 70px; padding: 10px 100px 10px 16px; line-height: 1.4; }
}

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