:root {
  --bg: #07111f;
  --panel: rgba(10, 18, 35, 0.72);
  --panel-2: rgba(255, 255, 255, 0.08);
  --text: #edf3ff;
  --muted: #96a3c7;
  --accent: #77a8ff;
  --accent-2: #a66cff;
  --danger: #ff6d7d;
  --ok: #77d6a0;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, system-ui, sans-serif; background: radial-gradient(circle at top, #12284f, #07111f 52%, #040912 100%); color: var(--text); }
button, input, select, textarea { font: inherit; }
body { overflow: hidden; }
.app-shell { min-height: 100vh; }
.screen { display: none; padding: 24px; min-height: 100vh; }
.screen.active { display: block; }
.glass { background: var(--panel); backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,0.08); box-shadow: var(--shadow); }
.hero-card { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; padding: 28px; border-radius: 28px; }
.eyebrow { display: inline-flex; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,0.08); color: #b9c8ef; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { font-size: clamp(2rem, 5vw, 4rem); margin: 14px 0 12px; line-height: 1; }
h2, h3 { margin: 0; }
p { color: #d5def7; }
.hero-actions, .topbar-actions, .card-actions-row, .toggle-group, .tool-grid, .template-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { border: 0; border-radius: 14px; padding: 12px 16px; cursor: pointer; transition: .18s ease; color: white; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.secondary { background: rgba(255,255,255,0.12); }
.btn.ghost { background: rgba(255,255,255,0.06); }
.btn.danger { background: rgba(255,109,125,0.18); color: #ffd2d8; }
.btn.tiny { padding: 9px 12px; border-radius: 12px; font-size: 13px; }
.btn.full, .file-btn.full { width: 100%; justify-content: center; }
.saved-section { margin-top: 24px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.deck-card { padding: 18px; border-radius: 20px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.06); }
.deck-card h3 { margin-bottom: 8px; }
.deck-card small { color: var(--muted); display: block; margin-bottom: 14px; }
.hero-preview { position: relative; min-height: 280px; display: grid; place-items: center; }
.floating-card { position: absolute; width: 180px; height: 250px; border-radius: 24px; box-shadow: 0 25px 55px rgba(0,0,0,0.35); animation: float 6s ease-in-out infinite; }
.floating-card:nth-child(1) { left: 8%; top: 12%; transform: rotate(-12deg); }
.floating-card:nth-child(2) { left: 32%; top: 2%; transform: rotate(10deg); animation-delay: 1s; }
.floating-card:nth-child(3) { right: 9%; bottom: 10%; transform: rotate(-3deg); animation-delay: 2s; }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -10px; } }
.topbar { display:flex; justify-content:space-between; align-items:center; gap:16px; padding: 14px 16px; border-radius: 20px; margin-bottom: 18px; }
.brand-line { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.deck-name-input { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); color: white; border-radius: 12px; padding: 10px 12px; min-width: 220px; }
.save-status { color: var(--ok); font-size: 13px; }
.editor-layout { display:grid; grid-template-columns: 290px minmax(0,1fr) 320px; gap: 18px; height: calc(100vh - 110px); }
.sidebar { border-radius: 24px; padding: 14px; overflow: auto; }
.panel { padding: 14px; background: rgba(255,255,255,0.04); border-radius: 18px; margin-bottom: 12px; }
.panel-header, .section-header { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom: 12px; }
.cards-list, .layers-list { display:flex; flex-direction:column; gap:10px; }
.card-thumb, .layer-item { display:flex; align-items:center; justify-content:space-between; gap:8px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.05); cursor:pointer; }
.card-thumb.active, .layer-item.active { outline: 2px solid rgba(119,168,255,0.8); }
.workspace { display:flex; flex-direction:column; gap:16px; min-width:0; }
.workspace-toolbar { padding: 12px; border-radius: 18px; display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.check-row { display:flex; align-items:center; gap:8px; color: #d8e3ff; font-size: 14px; }
.canvas-wrap { position:relative; flex:1; min-height:0; display:grid; place-items:center; border-radius: 30px; padding: 22px; background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); overflow:auto; }
.canvas-wrap.show-grid::before {
  content:""; position:absolute; inset:0; background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px); background-size: 20px 20px; pointer-events:none;
}
.card-stage { perspective: 1200px; }
.card-canvas { width: 420px; height: 600px; position: relative; overflow: hidden; border-radius: 26px; background: #f6f8ff; box-shadow: 0 30px 80px rgba(0,0,0,0.4); transform-style: preserve-3d; }
.canvas-wrap.show-safe-zone .card-canvas::after { content:""; position:absolute; inset:18px; border: 2px dashed rgba(255,255,255,0.35); border-radius: 16px; pointer-events:none; }
.card-canvas.flip-anim { animation: flip .8s ease; }
@keyframes flip { 0% { transform: rotateY(0deg);} 50%{ transform: rotateY(90deg);} 100% { transform: rotateY(0deg);} }
.canvas-element { position:absolute; user-select:none; touch-action:none; }
.canvas-element.selected { outline: 2px solid #6fb2ff; outline-offset: 2px; }
.canvas-element.locked::after { content:'🔒'; position:absolute; top:-20px; right:-10px; font-size: 16px; }
.canvas-element.text-el { white-space: pre-wrap; display:flex; align-items:center; justify-content:flex-start; padding: 4px; }
.canvas-element.shape-triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.canvas-element.shape-line { min-height: 4px !important; }
.canvas-element img { width:100%; height:100%; object-fit: cover; display:block; pointer-events:none; }
.resize-handle { position:absolute; width:14px; height:14px; border-radius:50%; background: white; border:2px solid #2f6dff; right:-7px; bottom:-7px; cursor:nwse-resize; }
.selection-controls.hidden, .modal.hidden { display:none; }
.selection-controls { display:flex; flex-direction:column; gap:10px; }
label { display:flex; flex-direction:column; gap:6px; font-size: 13px; color: #e5ebff; }
input[type="text"], input[type="number"], select, textarea { width:100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); color:white; border-radius: 12px; padding: 10px 12px; }
input[type="color"] { width:100%; height:42px; border-radius:12px; overflow:hidden; padding:0; border:1px solid rgba(255,255,255,0.08); background: transparent; }
input[type="range"] { width:100%; }
.muted { color: var(--muted); font-size: 14px; }
.two-col .btn { flex: 1 1 calc(50% - 6px); }
.template-grid { display:grid; grid-template-columns: repeat(2, 1fr); }
.template-btn { min-height: 88px; border-radius: 18px; color:white; border:0; cursor:pointer; font-weight:700; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); }
.theme-classic { background: linear-gradient(135deg, #efcf8f, #7e5936); }
.theme-neon { background: linear-gradient(135deg, #031326, #005ff4, #d44dff); }
.theme-mystic { background: linear-gradient(135deg, #2d1c4f, #6f56f1, #e8b5ff); }
.theme-ember { background: linear-gradient(135deg, #2a0905, #a02f1b, #ffbe63); }
.theme-ocean { background: linear-gradient(135deg, #07233d, #116ea3, #7de7e8); }
.theme-minimal { background: linear-gradient(135deg, #f7f7f7, #c3cad3); color:#24303f; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display:grid; place-items:center; padding: 24px; z-index: 50; }
.modal-card { width:min(720px, 100%); padding: 24px; border-radius: 24px; }
.file-btn { display:inline-flex; align-items:center; justify-content:center; }
@media (max-width: 1280px) {
  .editor-layout { grid-template-columns: 260px minmax(0,1fr); }
  .right-sidebar { grid-column: span 2; }
}
@media (max-width: 900px) {
  body { overflow:auto; }
  .hero-card, .editor-layout { grid-template-columns: 1fr; height: auto; }
  .screen { padding: 14px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .card-canvas { width: 320px; height: 460px; }
}

.save-toggle-row { padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.05); }
.full-width { width: 100%; }
.compact { margin: 8px 0 0; line-height: 1.45; }
.export-host { position: fixed; left: -10000px; top: 0; padding: 0; margin: 0; background: transparent; pointer-events: none; z-index: -1; }
.export-snapshot { box-shadow: none !important; }
.is-exporting .card-canvas::after,
.is-exporting .canvas-element.selected,
.is-exporting .canvas-element.locked::after,
.is-exporting .resize-handle { display: none !important; }
.is-exporting .canvas-element { outline: none !important; }
@media print {
  .export-host { position: static; left: 0; }
}
