:root {
  --night-top: #040a1a;
  --night-bottom: #0e2456;
  --card-bg: rgba(8, 18, 44, 0.78);
  --line: rgba(250, 211, 132, 0.34);
  --text: #f5f6fb;
  --muted: #cad2e7;
  --gold: #f4cf83;
  --gold-strong: #d99a39;
  --danger: #ffb6b6;
  --glow: 0 22px 50px rgba(4, 8, 27, 0.55);
}

* {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  height: auto;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 84% 8%, rgba(240, 204, 132, 0.15), transparent 28%),
    radial-gradient(circle at 8% 16%, rgba(178, 213, 255, 0.11), transparent 20%),
    linear-gradient(180deg, var(--night-top), var(--night-bottom));
  overflow-x: hidden;
}

body.mode-greeting .topbar {
  display: none;
}

body.mode-greeting .app-shell {
  width: min(920px, 100% - 24px);
  padding-top: 32px;
}

.scene {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
}

.moon {
  position: absolute;
  top: 9vh;
  right: 14vw;
  width: clamp(100px, 14vw, 170px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4d8 4%, #f3cd81 58%, #c79140 100%);
  box-shadow: 0 0 74px rgba(244, 207, 131, 0.35);
}

.moon::after {
  content: "";
  position: absolute;
  width: 84%;
  height: 84%;
  right: -20%;
  top: 9%;
  border-radius: 50%;
  background: linear-gradient(180deg, #08183a, #112a5f);
}

.sparkles {
  position: absolute;
  inset: 0;
  opacity: 0.48;
  background-image:
    radial-gradient(circle, rgba(255, 234, 196, 0.95) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 234, 196, 0.76) 1.2px, transparent 1.2px),
    radial-gradient(circle, rgba(197, 228, 255, 0.74) 1px, transparent 1px);
  background-size: 132px 132px, 182px 182px, 220px 220px;
  background-position: 0 0, 44px 80px, 120px 64px;
  animation: twinkle 7s ease-in-out infinite alternate;
}

.lantern {
  position: absolute;
  width: 46px;
  height: 66px;
  border-radius: 12px;
  border: 1px solid rgba(255, 230, 176, 0.62);
  background: linear-gradient(180deg, #fff2cb 0%, #f7c76a 37%, #c47b29 100%);
  box-shadow: 0 8px 22px rgba(244, 205, 128, 0.45);
  animation: floatLantern 5.8s ease-in-out infinite;
}

.lantern::before,
.lantern::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.lantern::before {
  top: -18px;
  width: 1px;
  height: 18px;
  background: rgba(227, 207, 156, 0.74);
}

.lantern::after {
  top: -23px;
  width: 16px;
  height: 7px;
  border: 1px solid rgba(250, 227, 174, 0.86);
  border-radius: 4px;
}

.lantern-left {
  top: 20vh;
  left: 9vw;
}

.lantern-center {
  top: 12vh;
  left: 45vw;
  width: 38px;
  height: 56px;
  animation-duration: 6.4s;
}

.lantern-right {
  top: 24vh;
  right: 9vw;
  animation-duration: 6.9s;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1120px, 100% - 34px);
  margin: 16px auto 0;
  padding: 12px 14px;
  border: 1px solid rgba(250, 211, 132, 0.24);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  background: rgba(3, 10, 27, 0.45);
}

.brand {
  color: #ffe5ac;
  text-decoration: none;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip-link {
  text-decoration: none;
  color: #ffefcb;
  font-size: 0.9rem;
  border: 1px solid rgba(250, 211, 132, 0.42);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(10, 20, 48, 0.56);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100% - 34px);
  margin: 0 auto;
  min-height: calc(100vh - 88px);
  padding: 24px 0 52px;
  display: grid;
}

.view {
  display: none;
  width: 100%;
  animation: fadeIn 0.55s ease;
}

.view.active {
  display: block;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  color: #fff7df;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 20px rgba(244, 205, 128, 0.22);
}

h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.5rem, 3.3vw, 2.35rem);
}

h3 {
  font-size: clamp(1.15rem, 2.1vw, 1.6rem);
}

.subtext {
  color: var(--muted);
  line-height: 1.7;
  max-width: 64ch;
  margin: 14px 0 0;
}

.badge {
  margin: 0 0 12px;
  display: inline-block;
  color: #fce6b5;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  font-weight: 700;
}

.card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  box-shadow: var(--glow);
  padding: 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 16px;
}

.hero-card {
  padding: clamp(22px, 4vw, 34px);
}

.hero-card .button-row {
  margin-top: 20px;
}

.admin-note {
  opacity: 0.92;
  max-width: 58ch;
}

.global-greeting {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
  padding: clamp(28px, 5vw, 44px);
}

.global-greeting .subtext {
  margin-inline: auto;
}

.stats-card h2 {
  margin-bottom: 16px;
}

.stat-list {
  display: grid;
  gap: 12px;
}

.stat-item {
  border: 1px solid rgba(250, 211, 132, 0.22);
  border-radius: 14px;
  padding: 12px;
  background: rgba(3, 10, 27, 0.36);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-item span {
  color: #d8deed;
  font-size: 0.92rem;
}

.stat-item strong {
  color: #ffebbb;
}

.feature-strip {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.feature-strip p {
  margin: 0;
  border: 1px solid rgba(250, 211, 132, 0.24);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  color: #f8e5b4;
  background: rgba(4, 13, 33, 0.45);
  font-size: 0.9rem;
}

.view-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.admin-login-card {
  max-width: 560px;
  margin: 0 auto;
}

.admin-route-pill {
  margin: 12px 0 16px;
  display: inline-block;
  border: 1px dashed rgba(250, 211, 132, 0.4);
  border-radius: 999px;
  padding: 8px 12px;
  color: #ffe7b2;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.admin-login-form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

.creator-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.form-card {
  text-align: left;
}

.editor-mode {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(250, 211, 132, 0.32);
  border-radius: 10px;
  background: rgba(8, 18, 44, 0.55);
  color: #ffe5af;
  font-size: 0.9rem;
  font-weight: 700;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #ffebbc;
  font-weight: 700;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #f4cf83;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(250, 211, 132, 0.26);
  border-radius: 12px;
  background: rgba(3, 12, 30, 0.68);
  color: #f7f8ff;
  font: inherit;
  padding: 12px 14px;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

input[type="file"] {
  padding: 10px;
  line-height: 1.3;
}

input[type="file"]::file-selector-button {
  border: 1px solid rgba(250, 211, 132, 0.36);
  border-radius: 999px;
  background: rgba(10, 22, 52, 0.8);
  color: #ffe8b1;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 8px 12px;
  margin-right: 10px;
  cursor: pointer;
}

.field-meta {
  margin-top: 6px;
  margin-bottom: 16px;
  color: #cfdaef;
  font-size: 0.84rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.template-btn {
  border: 1px solid rgba(250, 211, 132, 0.34);
  border-radius: 10px;
  background: rgba(11, 24, 52, 0.78);
  color: #ffe8b2;
  padding: 9px 10px;
  cursor: pointer;
  font-weight: 600;
}

.template-btn:hover {
  border-color: rgba(250, 211, 132, 0.64);
}

.preview-card {
  text-align: center;
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: 300px;
}

.company-signature {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 8px;
  padding: 8px 12px;
  border: 1px solid rgba(250, 211, 132, 0.24);
  border-radius: 999px;
  background: rgba(5, 14, 34, 0.62);
}

.company-logo {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(250, 211, 132, 0.33);
  background: #fff;
}

.company-name {
  margin: 0;
  color: #ffe8b0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.preview-card blockquote {
  margin: 0;
}

.preview-photo {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(250, 211, 132, 0.28);
}

.preview-card .to-line {
  margin: 10px 0 2px;
  color: #f8ebc4;
  font-weight: 700;
  font-size: 0.95rem;
}

.preview-card .from-line {
  margin: 0 0 12px;
  color: #ffd890;
  font-weight: 700;
  font-size: 0.93rem;
}

.result-card {
  margin-top: 16px;
  text-align: left;
}

.result-title {
  margin: 0 0 10px;
  font-size: 1.04rem;
  font-weight: 700;
}

.link-line {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(250, 211, 132, 0.23);
  background: rgba(4, 13, 33, 0.7);
  overflow-wrap: anywhere;
}

.qr-image {
  margin-top: 16px;
  width: 140px;
  height: 140px;
  border-radius: 12px;
  border: 1px solid rgba(250, 211, 132, 0.22);
  background: #fff;
  padding: 8px;
}

.recent-card {
  margin-top: 16px;
}

.created-card {
  margin-top: 16px;
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(250, 211, 132, 0.2);
  border-radius: 12px;
  padding: 10px;
  background: rgba(4, 13, 33, 0.52);
}

.recent-meta {
  display: grid;
  gap: 2px;
}

.recent-link {
  color: #ffe3a7;
  text-decoration: none;
  font-weight: 700;
}

.recent-link:hover {
  text-decoration: underline;
}

.recent-date {
  color: #c7d1e8;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.created-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.created-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(250, 211, 132, 0.22);
  border-radius: 12px;
  padding: 12px;
  background: rgba(4, 13, 33, 0.54);
}

.created-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.created-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.created-slug {
  color: #ffe3a7;
  font-weight: 700;
  font-size: 0.9rem;
}

.created-name {
  color: #fff3d0;
  font-weight: 700;
  font-size: 0.9rem;
}

.created-subline {
  color: #c9d5ee;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.created-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.created-actions .btn {
  padding: 9px 12px;
}

.greeting-card {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
  padding: clamp(22px, 4vw, 36px);
  position: relative;
  overflow: hidden;
}

.greeting-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 82% -10%, rgba(244, 207, 131, 0.18), transparent 38%),
    radial-gradient(circle at -5% 0%, rgba(154, 213, 255, 0.11), transparent 32%);
  pointer-events: none;
}

.greeting-card > * {
  position: relative;
  z-index: 1;
}

.greeting-card h2 {
  margin-bottom: 6px;
}

.greeting-card .badge {
  display: block;
  margin: 0 0 12px;
}

.greeting-card .company-signature {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  max-width: min(100%, 320px);
  margin: 0 auto 10px;
  padding: 10px 16px;
  border-radius: 16px;
}

.greeting-card .company-logo {
  width: 48px;
  height: 48px;
}

.greeting-card .company-name {
  text-align: left;
  font-size: 0.94rem;
}

.greeting-photo {
  display: block;
  width: 100%;
  max-height: min(72vh, 980px);
  margin: 14px auto 10px;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(250, 211, 132, 0.3);
  background: rgba(255, 255, 255, 0.02);
}

.greeting-meta {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.greeting-card .to-line {
  margin: 0;
  color: #fff0c8;
  font-weight: 700;
  font-size: clamp(1.02rem, 2.1vw, 1.16rem);
  letter-spacing: 0.01em;
}

.greeting-card .from-line {
  margin: 0;
  color: #ffd68d;
  font-weight: 700;
  font-size: clamp(0.96rem, 1.8vw, 1.04rem);
}

blockquote {
  margin: 0;
  line-height: 1.8;
  color: #f8f9ff;
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.greeting-card blockquote {
  position: relative;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid rgba(250, 211, 132, 0.28);
  border-radius: 16px;
  background: rgba(3, 12, 30, 0.58);
  line-height: 1.9;
  color: #fff8e5;
  font-size: clamp(1.02rem, 2.05vw, 1.13rem);
}

.created-at {
  margin: 16px 0 0;
  text-align: center;
}

.thank-btn {
  margin-top: 18px;
}

.thank-note {
  margin-top: 10px;
  color: #fce6b8;
  font-weight: 600;
}

.error-line {
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.muted {
  color: #d1d8ea;
  font-size: 0.92rem;
}

.button-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #241a07;
  border-color: rgba(250, 211, 132, 0.32);
  background: linear-gradient(90deg, var(--gold), var(--gold-strong));
  box-shadow: 0 8px 18px rgba(238, 178, 75, 0.3);
}

.btn-secondary {
  color: #ffe9b4;
  border-color: rgba(250, 211, 132, 0.42);
  background: rgba(9, 19, 44, 0.76);
}

.btn-ghost {
  color: #ffe8b2;
  border-color: rgba(250, 211, 132, 0.3);
  background: transparent;
}

input:focus,
textarea:focus,
.btn:focus-visible,
.chip-link:focus-visible,
.template-btn:focus-visible {
  outline: 2px solid rgba(244, 205, 128, 0.9);
  outline-offset: 2px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  border-radius: 999px;
  border: 1px solid rgba(250, 211, 132, 0.38);
  background: rgba(7, 15, 35, 0.95);
  color: #f6e2b2;
  padding: 10px 14px;
}

.hidden {
  display: none !important;
}

.confetti-piece {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 14px;
  opacity: 0.94;
  z-index: 6;
  animation: confettiFall 1800ms linear forwards;
}

.sparkle-burst {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  background: radial-gradient(circle, #fffdf1 0%, #f7d590 55%, rgba(247, 213, 144, 0) 72%);
  box-shadow:
    0 0 14px rgba(255, 244, 204, 0.8),
    0 0 28px rgba(247, 213, 144, 0.46);
  animation: sparkleBurst 1300ms ease-out forwards;
}

@keyframes floatLantern {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

@keyframes twinkle {
  from {
    opacity: 0.26;
  }
  to {
    opacity: 0.63;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes confettiFall {
  to {
    transform: translate3d(var(--x-shift), 110vh, 0) rotate(var(--rotation));
    opacity: 0;
  }
}

@keyframes sparkleBurst {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.3);
  }
  14% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--sparkle-x), var(--sparkle-y), 0) scale(1.35);
  }
}

@media (max-width: 1024px) {
  .hero-grid,
  .creator-layout {
    grid-template-columns: 1fr;
  }

  .feature-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-head {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar {
    width: calc(100% - 24px);
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .app-shell {
    width: calc(100% - 24px);
    padding-top: 16px;
  }

  .moon {
    right: 7vw;
  }

  .lantern-center {
    left: 50%;
  }

  .card {
    padding: 20px;
  }

  .admin-route-pill {
    width: 100%;
    border-radius: 12px;
  }

  .field-meta {
    display: grid;
    justify-content: flex-start;
    gap: 4px;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

  .created-item {
    display: grid;
  }

  .created-actions {
    justify-content: flex-start;
  }

  .button-row .btn,
  .button-row a {
    width: 100%;
  }

  .company-signature {
    width: 100%;
    justify-content: center;
    border-radius: 12px;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }

  .view-head {
    display: grid;
    gap: 12px;
  }

  .preview-card {
    min-height: 0;
  }

  .greeting-photo {
    max-height: 54vh;
  }

  .greeting-card .company-signature {
    padding: 9px 12px;
    margin-bottom: 12px;
  }

  .greeting-card .company-logo {
    width: 42px;
    height: 42px;
  }

  .greeting-card blockquote {
    padding: 14px;
    line-height: 1.75;
  }

  .toast {
    width: calc(100% - 24px);
    text-align: center;
    border-radius: 14px;
  }

  .sparkle-burst {
    width: 7px;
    height: 7px;
  }

  input,
  textarea,
  button {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  .brand {
    font-size: 0.92rem;
  }

  .chip-link {
    font-size: 0.82rem;
    padding: 6px 10px;
  }

  .recent-item {
    display: grid;
    gap: 8px;
  }

  .created-item {
    gap: 10px;
  }

  .card {
    padding: 16px;
    border-radius: 18px;
  }

  .company-signature {
    padding: 8px 10px;
  }

  .company-logo {
    width: 30px;
    height: 30px;
  }

  .greeting-card .company-logo {
    width: 38px;
    height: 38px;
  }
}
