:root {
  color-scheme: dark;
  --bg: #0d0b24;
  --panel: rgba(255, 249, 255, 0.96);
  --panel-border: #f495d0;
  --text: #261f38;
  --muted: #72648d;
  --pink: #f436a2;
  --pink-soft: #ffe4f4;
  --violet: #a75cff;
  --blue: #2e8cff;
  --shadow: 0 28px 70px rgba(5, 4, 24, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top center, rgba(245, 89, 181, 0.18), transparent 22%),
    radial-gradient(circle at 80% 20%, rgba(86, 137, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #0f0b2b 0%, #080716 100%);
  color: var(--text);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

.cosmos {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cinematic-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.starfield,
.sparkles,
.floating-emoji {
  position: absolute;
  inset: 0;
}

.star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
  opacity: 0.2;
  animation:
    twinkle var(--duration) ease-in-out infinite,
    star-drift 16s linear infinite;
  animation-delay: var(--delay);
}

.sparkle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  color: rgba(255, 159, 222, 0.6);
  font-size: clamp(0.7rem, 1vw, 1rem);
  animation: shimmer var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
}

.flyer {
  position: absolute;
  top: var(--top);
  left: -10vw;
  font-size: var(--size);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.35));
  opacity: 0.92;
  animation: fly-across var(--duration) linear infinite;
  animation-delay: calc(var(--delay) * -1);
}

.falcon-runner {
  position: fixed;
  left: -18rem;
  top: 14vh;
  width: clamp(8rem, 18vw, 13rem);
  opacity: 0;
  z-index: 3;
  filter:
    drop-shadow(0 0 14px rgba(117, 216, 255, 0.7))
    drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55));
  animation: falcon-zoom 1.4s cubic-bezier(0.2, 0.7, 0.18, 1) forwards;
}

.falcon-runner svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.falcon-hull,
.falcon-prong,
.falcon-cockpit,
.falcon-tail {
  fill: #d8d7e8;
}

.falcon-engine {
  fill: #69dcff;
}

.falcon-detail,
.falcon-dish {
  fill: #7a7b96;
}

.imperial-warship {
  position: fixed;
  left: -22rem;
  top: calc(14vh + var(--lane));
  width: clamp(5.75rem, 13vw, 9.5rem);
  opacity: 0;
  z-index: 2;
  filter:
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 10px rgba(255, 103, 108, 0.22));
  animation: imperial-chase var(--duration) cubic-bezier(0.24, 0.7, 0.15, 1) forwards;
  animation-delay: var(--delay);
}

.imperial-warship svg {
  display: block;
  width: 100%;
  height: auto;
}

.destroyer-body {
  fill: #cfd3db;
}

.destroyer-panel {
  fill: #e2e5ec;
}

.destroyer-bridge {
  fill: #8a8ea0;
}

.destroyer-engine {
  fill: #ff676c;
}

.destroyer-detail {
  fill: #707486;
}

.destroyer-window {
  fill: #9fd1ff;
}

.message-explosion {
  position: fixed;
  width: 2.4rem;
  aspect-ratio: 1;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle, rgba(255, 247, 188, 0.98) 0%, rgba(255, 166, 81, 0.82) 32%, rgba(255, 91, 135, 0.18) 70%, transparent 100%);
  box-shadow:
    0 0 24px rgba(255, 195, 88, 0.9),
    0 0 48px rgba(255, 98, 160, 0.55);
  animation: message-blast 820ms ease-out forwards;
}

.explosion-particle {
  position: fixed;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  animation: particle-burst 800ms ease-out forwards;
  animation-delay: var(--delay);
}

.explosion-particle[data-tone="pink"] {
  background: #ff5eb8;
  box-shadow: 0 0 12px rgba(255, 94, 184, 0.85);
}

.explosion-particle[data-tone="blue"] {
  background: #7dc7ff;
  box-shadow: 0 0 12px rgba(125, 199, 255, 0.85);
}

.explosion-particle[data-tone="gold"] {
  background: #ffd75f;
  box-shadow: 0 0 12px rgba(255, 215, 95, 0.92);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 4rem;
}

.hero {
  text-align: center;
  color: #fff5ff;
}

.hero-title {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(2.35rem, 6vw, 4.55rem);
  font-weight: 900;
  letter-spacing: -0.03em;
}

.hero-icon,
.hero-heart {
  font-size: 0.7em;
  transform: translateY(-0.04em);
}

.hero-heart {
  filter: drop-shadow(0 0 14px rgba(255, 117, 201, 0.55));
}

.hero-title-text {
  background: linear-gradient(90deg, #ff5cb8 0%, #b562ff 58%, #6d9dff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 0.4rem 0 2rem;
  color: rgba(255, 240, 252, 0.92);
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 700;
}

.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 2.2rem;
}

.hero-stat {
  min-width: 9rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 188, 230, 0.2);
  border-radius: 999px;
  background: rgba(255, 245, 255, 0.08);
  backdrop-filter: blur(8px);
}

.hero-stat-value,
.hero-stat-label {
  display: block;
}

.hero-stat-value {
  color: #fff8fe;
  font-size: 1rem;
  font-weight: 800;
}

.hero-stat-label {
  margin-top: 0.15rem;
  color: rgba(255, 228, 248, 0.78);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.composer-card {
  padding: 1.35rem 1.5rem 1.45rem;
  border: 4px solid var(--panel-border);
  border-radius: 1.7rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer-heading h1 {
  margin: 0 0 1rem;
  color: var(--pink);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.message-form {
  display: grid;
  gap: 1rem;
}

.field {
  display: block;
}

.field input,
.field textarea {
  width: 100%;
  border: 3px solid #f8a2dc;
  border-radius: 0.95rem;
  background: rgba(255, 252, 255, 0.98);
  color: var(--text);
  padding: 0.95rem 1rem;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.field textarea {
  min-height: 8.8rem;
  resize: vertical;
}

.field textarea,
.field input::placeholder,
.field textarea::placeholder {
  color: #80709f;
}

.field textarea {
  border-color: #ca9cff;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 0 0 5px rgba(206, 148, 255, 0.16);
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.status-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-message[data-tone="success"] {
  color: #6c49f8;
}

.status-message[data-tone="error"] {
  color: #c3287e;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.character-count {
  color: var(--muted);
  font-size: 0.92rem;
}

button {
  border: 0;
  cursor: pointer;
}

.secondary-button {
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  background: rgba(255, 246, 252, 0.12);
  color: #fff4fd;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 205, 236, 0.18);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.secondary-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 246, 252, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 205, 236, 0.28);
}

.secondary-button[data-state="active"] {
  background: rgba(255, 152, 219, 0.18);
  color: #fff8fe;
}

button[type="submit"] {
  min-width: 10rem;
  padding: 0.95rem 1.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink) 0%, var(--violet) 58%, var(--blue) 100%);
  color: white;
  font-weight: 800;
  box-shadow: 0 16px 30px rgba(120, 80, 255, 0.24);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 34px rgba(120, 80, 255, 0.3);
}

button[type="submit"]:disabled {
  opacity: 0.74;
  cursor: wait;
}

.board-section {
  margin-top: 2rem;
}

.email-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 5;
}

.access-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 6;
}

.access-modal[hidden] {
  display: none;
}

.email-modal[hidden] {
  display: none;
}

.access-modal-backdrop,
.email-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 5, 20, 0.72);
  backdrop-filter: blur(10px);
}

.access-modal-card,
.email-modal-card {
  position: relative;
  width: min(32rem, calc(100% - 1.4rem));
  padding: 1.6rem;
  border: 4px solid var(--panel-border);
  border-radius: 1.7rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.access-modal-card {
  width: min(34rem, calc(100% - 1.4rem));
  background:
    radial-gradient(circle at top right, rgba(255, 182, 224, 0.35), transparent 26%),
    linear-gradient(180deg, #fff9ff 0%, #fff0f8 100%);
}

.access-modal-eyebrow,
.email-modal-eyebrow {
  margin: 0 0 0.45rem;
  color: #8f51ff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.access-modal-card h2,
.email-modal-card h2 {
  margin: 0;
  color: var(--pink);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.access-modal-copy,
.email-modal-copy {
  margin: 0.75rem 0 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.access-form,
.email-alert-form {
  display: grid;
  gap: 1rem;
}

.access-modal-status,
.email-modal-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.access-modal-status[data-tone="error"],
.email-modal-status[data-tone="error"] {
  color: #c3287e;
}

.access-modal-status[data-tone="success"],
.email-modal-status[data-tone="success"] {
  color: #6c49f8;
}

.access-modal-actions,
.email-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
}

.email-modal-actions .secondary-button {
  background: rgba(122, 108, 145, 0.12);
  color: #5e5476;
  box-shadow: inset 0 0 0 1px rgba(122, 108, 145, 0.18);
}

.email-modal-actions .secondary-button:hover {
  background: rgba(122, 108, 145, 0.18);
}

.board-feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem 1.4rem;
}

.note-card,
.empty-state {
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: rise-in 500ms ease forwards;
}

.note-card {
  min-height: 8.2rem;
  padding: 1.2rem 1rem 0.85rem;
  border: 3px solid #f597d3;
  border-radius: 1.2rem;
  background: linear-gradient(180deg, #fff0f7 0%, #ffedf6 100%);
  box-shadow: 0 18px 36px rgba(11, 7, 33, 0.2);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.note-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0.8rem 0.8rem 0;
  border-color: transparent #ff535f transparent transparent;
}

.note-card[data-variant="lilac"] {
  border-color: #bb86ff;
  background: linear-gradient(180deg, #f7efff 0%, #f4ecff 100%);
}

.note-card[data-variant="sky"] {
  border-color: #83a6ff;
  background: linear-gradient(180deg, #eff5ff 0%, #eef3ff 100%);
}

.note-card:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: 0 24px 42px rgba(11, 7, 33, 0.25);
}

.note-body {
  margin: 0;
  color: #3b3050;
  font-size: 1.05rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.note-meta {
  display: grid;
  gap: 0.18rem;
}

.note-sender {
  color: var(--pink);
  font-size: 0.94rem;
  font-weight: 800;
}

.note-card[data-variant="lilac"] .note-sender {
  color: #8f51ff;
}

.note-card[data-variant="sky"] .note-sender {
  color: #4c78f7;
}

.note-time {
  color: #7a6c91;
  font-size: 0.82rem;
  font-style: italic;
}

.note-delete {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #8f2f67;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 2px rgba(244, 54, 162, 0.14);
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    opacity 160ms ease;
}

.note-delete:hover {
  transform: translateY(-1px);
  background: rgba(255, 236, 246, 0.94);
}

.note-delete:disabled {
  opacity: 0.72;
  cursor: wait;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2.4rem 1rem;
  border: 2px dashed rgba(244, 149, 208, 0.45);
  border-radius: 1.4rem;
  background: rgba(255, 246, 252, 0.16);
  text-align: center;
}

.empty-state p {
  margin: 0;
  color: #fff7fe;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: 1.45rem;
}

.empty-state span {
  display: block;
  margin-top: 0.45rem;
  color: rgba(255, 236, 250, 0.86);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.18;
    transform: scale(0.8);
  }

  50% {
    opacity: 0.95;
    transform: scale(1.35);
  }
}

@keyframes star-drift {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(24px);
  }
}

@keyframes shimmer {
  0%,
  100% {
    opacity: 0.1;
    transform: scale(0.7) rotate(0deg);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.16) rotate(12deg);
  }
}

@keyframes fly-across {
  0% {
    transform: translate3d(-15vw, 0, 0) rotate(0deg);
  }

  50% {
    transform: translate3d(55vw, var(--drift), 0) rotate(14deg);
  }

  100% {
    transform: translate3d(125vw, calc(var(--drift) * -0.35), 0) rotate(-12deg);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes falcon-zoom {
  0% {
    opacity: 0;
    transform: translate3d(0, 5vh, 0) scale(0.3) rotate(-16deg);
  }

  12% {
    opacity: 1;
  }

  48% {
    opacity: 1;
    transform: translate3d(58vw, -3vh, 0) scale(1.15) rotate(-8deg);
  }

  100% {
    opacity: 0;
    transform: translate3d(130vw, 2vh, 0) scale(0.68) rotate(11deg);
  }
}

@keyframes imperial-chase {
  0% {
    opacity: 0;
    transform: translate3d(0, 6vh, 0) scale(calc(var(--scale) * 0.34)) rotate(-16deg);
  }

  10% {
    opacity: 0.95;
  }

  48% {
    opacity: 0.95;
    transform: translate3d(50vw, var(--mid-y), 0) scale(var(--scale)) rotate(var(--rotation));
  }

  100% {
    opacity: 0;
    transform: translate3d(128vw, var(--end-y), 0) scale(calc(var(--scale) * 0.7)) rotate(8deg);
  }
}

@keyframes message-blast {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.15);
  }

  22% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.7);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.5);
  }
}

@keyframes particle-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }

  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
  }

  100% {
    opacity: 0;
    transform:
      translate(
        calc(-50% + var(--dx)),
        calc(-50% + var(--dy))
      )
      scale(0.2);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 1rem, 960px);
    padding-top: 1.25rem;
  }

  .hero-actions {
    margin-bottom: 1.8rem;
  }

  .composer-card {
    padding: 1rem;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .character-count {
    align-self: flex-end;
  }

  button[type="submit"] {
    width: 100%;
  }

  .board-feed {
    grid-template-columns: 1fr;
  }

  .access-modal-card,
  .email-modal-card {
    padding: 1.2rem;
  }

  .access-modal-actions,
  .email-modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}
