.card {
  background: linear-gradient(180deg, var(--c-surface), var(--c-surface-2));
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-1);
  transition: transform var(--t-med) ease, box-shadow var(--t-med) ease, border-color var(--t-med) ease, background var(--t-med) ease;
}
.card:hover {
  border-color: rgba(184, 169, 255, 0.20);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(14, 18, 42, 0.72), rgba(32, 22, 62, 0.56));
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(7, 7, 20, 0.40), rgba(7, 7, 20, 0.20));
  border-color: rgba(255, 255, 255, 0.10);
  backdrop-filter: var(--glass-3);
  box-shadow: 0 24px 80px rgba(7, 7, 20, 0.40), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  border-radius: var(--radius-lg);
  padding: var(--space-7);
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: -40%;
  pointer-events: none;
  background:
    radial-gradient(360px 260px at 18% 18%, rgba(124, 92, 255, 0.12), transparent 65%),
    radial-gradient(400px 300px at 72% 28%, rgba(184, 169, 255, 0.08), transparent 70%),
    radial-gradient(300px 220px at 42% 82%, rgba(124, 92, 255, 0.08), transparent 72%);
  filter: blur(20px);
  opacity: 0.85;
  transform: translate3d(0, 0, 0);
  animation: hero-clouds 12s ease-in-out infinite alternate;
}
@keyframes hero-clouds {
  0% { transform: translate3d(-1.2%, 0.3%, 0) scale(1.0); }
  100% { transform: translate3d(1.2%, -0.8%, 0) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-card::after { animation: none !important; }
}
html[data-reduced-motion="true"] .hero-card::after { animation: none !important; }

@media (max-width: 520px) {
  .hero-card {
    padding: var(--space-5);
  }
}

.btn {
  border: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--c-text-2);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease, border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, color var(--t-fast) ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(184, 169, 255, 0.25);
  color: var(--c-text);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.08);
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.20), rgba(184, 169, 255, 0.10));
  border-color: rgba(184, 169, 255, 0.35);
  color: var(--c-accent-2);
}
.btn.primary:hover {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(184, 169, 255, 0.16));
  border-color: rgba(184, 169, 255, 0.50);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12), var(--shadow-glow);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}
.btn.danger {
  border-color: var(--c-danger-border);
  background: var(--c-danger-bg);
  color: var(--c-danger);
}
.btn.danger:hover {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.40);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.10);
}
.btn.icon {
  padding: 10px;
  font-size: 1.1rem;
}

.input,
.textarea,
.select {
  width: 100%;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--c-border-2);
  color: var(--c-text);
  padding: 12px 14px;
  font-size: 0.95rem;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, background var(--t-fast) ease;
}
.input:hover,
.textarea:hover,
.select:hover {
  background: rgba(255, 255, 255, 0.05);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--c-text-muted);
  opacity: 0.7;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(184, 169, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.10), 0 0 0 1px rgba(184, 169, 255, 0.15) inset;
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}
.textarea {
  resize: none;
  min-height: 200px;
  line-height: 1.6;
}
.field {
  display: grid;
  gap: var(--space-2);
}
.label {
  color: var(--c-text-2);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.hint {
  color: var(--c-text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.err {
  color: var(--c-danger);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chip {
  border: 1px solid var(--c-border-2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--c-text-2);
  padding: 8px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: var(--glass-1);
  transition: transform var(--t-fast) ease, background var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease;
  cursor: pointer;
  font-size: 0.9rem;
}
.chip[aria-pressed="true"] {
  border-color: rgba(184, 169, 255, 0.45);
  background: var(--c-accent-subtle);
  color: var(--c-accent-2);
}
.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(184, 169, 255, 0.30);
  background: rgba(255, 255, 255, 0.05);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--c-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--c-text-2);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 500;
  letter-spacing: 0.15px;
  white-space: nowrap;
}
.badge.private {
  border-color: var(--c-warning-border);
  color: var(--c-warning);
  background: var(--c-warning-bg);
}
.badge.published {
  border-color: rgba(184, 169, 255, 0.30);
  color: var(--c-accent-2);
  background: var(--c-accent-subtle);
}
.badge.draft {
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--c-text-muted);
  background: rgba(255, 255, 255, 0.03);
}
.badge.archived {
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.02);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.dream-title {
  margin: 0;
  font-family: var(--font-serif);
  letter-spacing: 0.3px;
  line-height: 1.3;
  font-weight: 600;
}
.dream-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  color: var(--c-text-muted);
  font-size: 0.9rem;
}

.reactions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.reaction-btn {
  padding: 8px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--c-text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease, border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
  font-size: 0.9rem;
}
.reaction-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(184, 169, 255, 0.25);
  transform: translateY(-1px);
}
.reaction-btn:active {
  transform: scale(0.95);
}
.reaction-btn[aria-pressed="true"] {
  border-color: rgba(184, 169, 255, 0.45);
  background: var(--c-accent-subtle);
  box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.10);
}
.reaction-count {
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
  font-size: 0.85rem;
}

.toast-region {
  position: fixed;
  right: var(--space-5);
  bottom: calc(var(--space-4) + 60px);
  z-index: var(--z-toast);
  display: grid;
  gap: 10px;
  max-width: min(400px, calc(100vw - 2 * var(--space-5)));
}
@media (min-width: 860px) {
  .toast-region {
    bottom: var(--space-5);
  }
}
.toast {
  border: 1px solid var(--c-border-2);
  background: var(--c-surface-3);
  backdrop-filter: var(--glass-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  animation: toast-slidein var(--t-slow) ease forwards;
  overflow: hidden;
}
.toast[data-tone="error"] {
  border-color: var(--c-danger-border);
  background: rgba(18, 14, 30, 0.85);
}
.toast[data-tone="warning"] {
  border-color: var(--c-warning-border);
  background: rgba(18, 18, 14, 0.85);
}
.toast-title {
  font-weight: 600;
  font-size: 0.9rem;
}
.toast-body {
  color: var(--c-text-muted);
  margin-top: 4px;
  font-size: 0.85rem;
}
@keyframes toast-slidein {
  0% { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}
html[data-reduced-motion="true"] .toast { animation: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.70);
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-5);
  animation: fade-in var(--t-med) ease;
}
@keyframes fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.modal {
  width: min(640px, 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border-2);
  background: rgba(10, 11, 30, 0.85);
  backdrop-filter: var(--glass-3);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  animation: modal-scalein var(--t-slow) ease forwards;
}
@keyframes modal-scalein {
  0% { opacity: 0; transform: scale(0.95) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop { animation: none; }
  .modal { animation: none; }
}
html[data-reduced-motion="true"] .modal-backdrop,
html[data-reduced-motion="true"] .modal { animation: none; }

.modal-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-3);
}
.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
}
.modal-body {
  padding: var(--space-5);
  color: var(--c-text-2);
  font-size: 0.95rem;
  line-height: 1.6;
}
.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  height: 16px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

.calendar {
  display: grid;
  gap: var(--space-4);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-2);
}
.cal-cell {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  min-height: 72px;
  background: rgba(255, 255, 255, 0.01);
  transition: background var(--t-fast) ease, border-color var(--t-fast) ease;
}
.cal-cell:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(184, 169, 255, 0.15);
}
.cal-cell button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.cal-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}
.cal-day-number {
  font-weight: 500;
}
.cal-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--c-accent-2);
  box-shadow: 0 0 4px var(--c-accent-glow);
}
.cal-dot.private {
  background: var(--c-warning);
  box-shadow: 0 0 4px rgba(251, 191, 36, 0.20);
}

.hero-ornaments {
  position: absolute;
  inset: -25%;
  pointer-events: none;
  opacity: 0.80;
  background:
    radial-gradient(160px 160px at 78% 22%, rgba(245, 232, 199, 0.80) 0%, rgba(245, 232, 199, 0.35) 40%, transparent 68%),
    radial-gradient(400px 260px at 68% 35%, rgba(255, 255, 255, 0.08), transparent 70%),
    radial-gradient(480px 300px at 38% 72%, rgba(184, 169, 255, 0.10), transparent 72%),
    radial-gradient(1px 1px at 18% 28%, rgba(253, 230, 138, 0.8) 98%, transparent 100%),
    radial-gradient(1px 1px at 26% 56%, rgba(253, 230, 138, 0.3) 98%, transparent 100%),
    radial-gradient(1px 1px at 44% 24%, rgba(253, 230, 138, 0.7) 98%, transparent 100%),
    radial-gradient(1px 1px at 54% 38%, rgba(253, 230, 138, 0.3) 98%, transparent 100%),
    radial-gradient(1px 1px at 60% 16%, rgba(253, 230, 138, 0.7) 98%, transparent 100%);
  transform: translate3d(0, 0, 0);
  animation: hero-float var(--t-slow) ease-in-out infinite alternate;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1000px 480px at 20% 10%, rgba(14, 18, 42, 0.28), transparent 60%),
    radial-gradient(800px 420px at 80% 40%, rgba(32, 22, 62, 0.22), transparent 62%);
  opacity: 0.90;
  filter: blur(12px);
}

.hero-title {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  letter-spacing: 0.6px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--c-text) 40%, var(--c-accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
}
.hero-subtitle {
  font-size: clamp(1.0rem, 1.4vw, 1.1rem);
  max-width: 64ch;
  color: var(--c-text-2);
  line-height: 1.6;
}
.hero-logo {
  width: 120px;
  height: 120px;
  border-radius: 32px;
  margin-bottom: var(--space-3);
  box-shadow:
    0 24px 80px rgba(124, 92, 255, 0.18),
    0 0 0 5px rgba(184, 169, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.10) inset;
  background: rgba(255, 255, 255, 0.02);
}
@media (min-width: 860px) {
  .hero-logo {
    width: 160px;
    height: 160px;
    border-radius: 42px;
  }
}
@keyframes hero-float {
  0% { transform: translate3d(-0.5%, 0.2%, 0); }
  100% { transform: translate3d(0.5%, -0.3%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-ornaments { animation: none !important; }
}
html[data-reduced-motion="true"] .hero-ornaments { animation: none !important; }

.editor-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(184, 169, 255, 0.18);
  background: linear-gradient(180deg, var(--c-surface-3), rgba(32, 22, 62, 0.30));
}
.editor-card::before {
  content: "";
  position: absolute;
  inset: -30%;
  pointer-events: none;
  opacity: 0.85;
  background:
    radial-gradient(560px 300px at 16% 20%, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.0) 72%),
    radial-gradient(720px 380px at 72% 28%, rgba(184, 169, 255, 0.10), rgba(184, 169, 255, 0.0) 74%),
    radial-gradient(660px 360px at 52% 80%, rgba(124, 92, 255, 0.08), rgba(124, 92, 255, 0.0) 74%),
    radial-gradient(1px 1px at 12% 16%, rgba(253, 230, 138, 0.8) 98%, transparent 100%),
    radial-gradient(1px 1px at 32% 60%, rgba(253, 230, 138, 0.3) 98%, transparent 100%),
    radial-gradient(1px 1px at 64% 22%, rgba(253, 230, 138, 0.7) 98%, transparent 100%),
    radial-gradient(1px 1px at 82% 54%, rgba(253, 230, 138, 0.3) 98%, transparent 100%);
  filter: blur(12px);
  transform: translate3d(0, 0, 0);
  animation: editor-drift 24s ease-in-out infinite alternate;
}

@keyframes editor-drift {
  0% { transform: translate3d(-0.6%, 0.2%, 0); }
  100% { transform: translate3d(0.6%, -0.3%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .editor-card::before { animation: none !important; }
}
html[data-reduced-motion="true"] .editor-card::before { animation: none !important; }

article[data-dream-id] {
  position: relative;
  overflow: hidden;
}
article[data-dream-id]::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 200px;
  height: 200px;
  pointer-events: none;
  background:
    radial-gradient(circle at 40% 40%, rgba(253, 230, 138, 0.15), rgba(253, 230, 138, 0.0) 60%),
    radial-gradient(circle at 65% 35%, rgba(184, 169, 255, 0.12), rgba(184, 169, 255, 0.0) 62%);
  filter: blur(4px);
  opacity: 0.85;
}

.star-trail {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  contain: layout paint;
}
.star-spark {
  position: fixed;
  width: var(--spark-size, 8px);
  height: var(--spark-size, 8px);
  transform: translate3d(calc(var(--spark-size, 8px) / -2), calc(var(--spark-size, 8px) / -2), 0);
  opacity: 0;
  animation: spark-pop 800ms ease forwards;
  filter: drop-shadow(0 0 6px rgba(184, 169, 255, 0.15));
}
.star-spark::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 35% 30%, rgba(253, 230, 138, 0.90), rgba(253, 230, 138, 0.0) 70%),
    radial-gradient(circle at 65% 70%, rgba(184, 169, 255, 0.55), rgba(184, 169, 255, 0.0) 70%);
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
  opacity: 0.80;
}
@keyframes spark-pop {
  0% { opacity: 0; transform: translate3d(calc(var(--spark-size, 8px) / -2), calc(var(--spark-size, 8px) / -2), 0) scale(0.80); }
  15% { opacity: 0.70; }
  100% { opacity: 0; transform: translate3d(calc(var(--spark-size, 8px) / -2 + var(--spark-dx, 0px)), calc(var(--spark-size, 8px) / -2 + var(--spark-dy, 0px)), 0) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .star-trail { display: none; }
}
html[data-reduced-motion="true"] .star-trail { display: none; }

.feature-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: transform var(--t-med) ease, border-color var(--t-med) ease, box-shadow var(--t-med) ease;
}
.feature-card:hover {
  border-color: rgba(184, 169, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--c-accent-subtle);
  border: 1px solid rgba(184, 169, 255, 0.15);
  margin-bottom: var(--space-3);
  font-size: 1.3rem;
}

@media (max-width: 520px) {
  .card { padding: var(--space-4); }
  .hero-card { padding: var(--space-5); }
  .modal-header,
  .modal-body,
  .modal-footer { padding: var(--space-4); }
  .cal-cell { padding: var(--space-1); min-height: 48px; }
  .calendar-grid { gap: var(--space-1); }
  .modal { width: min(100%, calc(100vw - 24px)); max-height: min(90vh, 560px); overflow-y: auto; }
  .modal-backdrop { padding: var(--space-3); overflow-y: auto; }
  .reaction-btn { padding: 6px 8px; font-size: 0.85rem; }
  .chip { padding: 6px 10px; font-size: 0.85rem; }
  .btn { padding: 8px 14px; font-size: 0.85rem; }
  .cal-day { font-size: 0.8rem; }
  .cal-day-number { font-size: 0.8rem; }
}

pre { overflow-wrap: anywhere; }
