:root { --ring: 0 0% 100%/0.08; }

/* Panel */
.card-panel {
  background: color-mix(in oklab, #0f172a 82%, #fff 0%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.panel-title {
  font-size: 14px; font-weight: 700; letter-spacing: .3px; color: #cbd5e1; margin-bottom: 10px; display: flex; align-items: center; gap: .5rem;
}
.panel-title::before {
  content: ''; width: 6px; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5, #ef4444);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.label { font-size: 12px; color: #cbd5e1; margin-bottom: 6px; }
.input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12); background: rgba(17,24,39,.6);
  color: #e5e7eb; outline: none;
}
.input:focus { border-color: rgba(99,102,241,.8); box-shadow: 0 0 0 4px rgba(99,102,241,.15); }

.btn, .btn-primary {
  display: inline-flex; align-items: center; gap: .5rem; padding: 10px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: #e5e7eb; font-size: 14px; transition: .2s ease;
}
.btn:hover { background: rgba(255,255,255,.1); }
.btn:disabled, .btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg,#4f46e5,#ef4444); border: none; }
.btn-primary:hover { filter: brightness(1.08); }
.switch { width: 16px; height: 16px; accent-color: #4f46e5; }

/* Skeleton */
.skeleton-card { aspect-ratio: 3/4; border-radius: 16px; background:
  linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.12), rgba(255,255,255,.04)) 0/200% 100%,
  rgba(255,255,255,.06);
  animation: shimmer 1.3s infinite; border: 1px dashed rgba(255,255,255,.12);
}
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* HiFi Card */
.hifi-card {
  position: relative; width: 100%; border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(0,0,0,.06); box-shadow: 0 10px 30px rgba(0,0,0,.35); isolation: isolate; background: #fff;
}
.hifi-card .card-inner { position: relative; display: flex; flex-direction: column; height: 100%; padding: 22px; }

/* Aspect ratios */
.hifi-card.aspect-3-4 { aspect-ratio: 3/4; }
.hifi-card.aspect-4-5 { aspect-ratio: 4/5; }
.hifi-card.aspect-9-16 { aspect-ratio: 9/16; }

/* Safe zone & grid */
.safe-mask { position: absolute; inset: 24px; border: 1px dashed rgba(0,0,0,.2); border-radius: 12px; pointer-events: none; }
.grid-mask { position: absolute; inset: 0; pointer-events: none; opacity: .12;
  background-image: linear-gradient(to right, black 1px, transparent 1px), linear-gradient(to bottom, black 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px; }

/* Card chrome */
.card-title { margin: 0 0 12px; font-size: 28px; line-height: 1.25; font-weight: 800; letter-spacing: .2px; color: #111827; }
.card-body { font-size: 16px; line-height: 1.7; color: #1f2937; white-space: pre-wrap; }
.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; color: #6b7280; font-size: 12px; }
.card-footer .page { font-variant-numeric: tabular-nums; }
.card-footer .wm { opacity: .9; }

/* Template: Minimal */
.template-minimal { background: #fff; }
.template-minimal .card-title { color: #0f172a; }
.template-minimal .card-body { color: #1f2937; }

/* Template: Magazine */
.template-magazine {
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--primary, #ef4444) 16%, #ffffff 80%), #fff 70%),
    #fff;
}
.template-magazine .card-inner { padding-top: 28px; }
.template-magazine .card-title {
  padding-left: 12px; border-left: 8px solid color-mix(in oklab, var(--primary, #ef4444) 90%, #000 0%);
}
.template-magazine::before {
  content:""; position:absolute; inset:0;
  background: radial-gradient(1200px 200px at 50% 0%, color-mix(in oklab, var(--primary,#ef4444) 30%, #fff 0%) , transparent 70%), transparent;
  pointer-events:none;
}

/* Template: Handnote (paper feel, no external images) */
.template-handnote {
  background:
    radial-gradient(200px 160px at 10% 10%, rgba(0,0,0,.04), transparent 60%),
    radial-gradient(220px 180px at 90% 6%, rgba(0,0,0,.04), transparent 60%),
    #fffdf6;
}
.template-handnote .card-inner {
  background: rgba(255,255,255,.8); backdrop-filter: blur(6px);
  border-radius: 14px; padding: 18px; height: calc(100% - 24px); margin: 12px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.template-handnote .card-title { position: relative; }
.template-handnote .card-title::after {
  content:""; position:absolute; left:0; bottom:-6px; width:80px; height:8px;
  background: repeating-linear-gradient(90deg, color-mix(in oklab, var(--primary,#ef4444) 60%, #fff 0%) 0 10px, rgba(0,0,0,.08) 10px 12px);
  border-radius: 4px;
}

/* Toolbar */
.toolbar { display: inline-flex; gap: 6px; padding: 6px; background: rgba(17,24,39,.8);
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px; backdrop-filter: blur(6px); }
.toolbar button { padding: 6px; border-radius: 8px; color: #e5e7eb; border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.04); }
.toolbar button:hover { background: rgba(255,255,255,.1); }

/* Drawer (Settings) */
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 50; }
.drawer-panel {
  width: 560px; max-width: 92vw; background: rgba(2,6,23,.95);
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 16px; color: #e5e7eb;
}
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(17,24,39,.9); color: #e5e7eb; padding: 10px 14px;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 30px rgba(0,0,0,.35); z-index: 60;
}
.fade-enter-active, .fade-leave-active { transition: opacity .2s ease }
.fade-enter-from, .fade-leave-to { opacity: 0 }

/* Utilities */
.prose { max-width: none }