:root {
  --surface: rgba(255, 250, 245, 0.78);
  --surface-strong: rgba(255, 250, 245, 0.9);
  --border: rgba(255, 255, 255, 0.55);
  --text-main: #4b2f3d;
  --text-soft: rgba(75, 47, 61, 0.76);
  --shadow: 0 25px 70px rgba(95, 72, 84, 0.22);
  --button-shadow: 0 16px 34px rgba(95, 72, 84, 0.2);
  --highlight: #f0a7c3;
  --highlight-strong: #dd8fae;
  --bg-a: #fdf4ed;
  --bg-b: #f5d8cf;
  --bg-c: #dfeef7;
  --orb-a: rgba(244, 183, 150, 0.42);
  --orb-b: rgba(235, 196, 216, 0.36);
  --orb-c: rgba(168, 209, 235, 0.35);
}

body[data-theme="morning"] {
  --surface: rgba(255, 251, 247, 0.78);
  --surface-strong: rgba(255, 251, 247, 0.92);
  --border: rgba(255, 255, 255, 0.62);
  --text-main: #55303f;
  --text-soft: rgba(85, 48, 63, 0.76);
  --highlight: #f1a0bf;
  --highlight-strong: #d97a9f;
  --bg-a: #fff8f0;
  --bg-b: #f4d7c0;
  --bg-c: #dcecf7;
  --orb-a: rgba(243, 190, 145, 0.48);
  --orb-b: rgba(242, 195, 219, 0.36);
  --orb-c: rgba(161, 208, 236, 0.34);
}

body[data-theme="evening"] {
  --surface: rgba(255, 245, 236, 0.78);
  --surface-strong: rgba(255, 245, 236, 0.9);
  --border: rgba(255, 233, 213, 0.5);
  --text-main: #563538;
  --text-soft: rgba(86, 53, 56, 0.74);
  --highlight: #eca273;
  --highlight-strong: #d97a4f;
  --bg-a: #fbebd9;
  --bg-b: #f6bf8e;
  --bg-c: #9fc9df;
  --orb-a: rgba(250, 190, 122, 0.42);
  --orb-b: rgba(233, 160, 132, 0.31);
  --orb-c: rgba(115, 145, 196, 0.28);
}

body[data-theme="night"] {
  --surface: rgba(35, 42, 74, 0.56);
  --surface-strong: rgba(32, 38, 67, 0.72);
  --border: rgba(195, 217, 255, 0.18);
  --text-main: #f6e4f0;
  --text-soft: rgba(246, 228, 240, 0.74);
  --highlight: #8fb6ff;
  --highlight-strong: #7197de;
  --shadow: 0 25px 80px rgba(5, 8, 25, 0.45);
  --button-shadow: 0 16px 34px rgba(7, 10, 31, 0.32);
  --bg-a: #171b34;
  --bg-b: #2f3b72;
  --bg-c: #5f507a;
  --orb-a: rgba(96, 116, 196, 0.28);
  --orb-b: rgba(220, 171, 193, 0.18);
  --orb-c: rgba(130, 179, 233, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.52), transparent 32%),
    linear-gradient(145deg, var(--bg-a), var(--bg-b) 48%, var(--bg-c));
  transition:
    background 700ms ease,
    color 300ms ease;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.scene-shell {
  position: relative;
  min-height: 100vh;
  padding: 1.25rem;
  isolation: isolate;
}

.topbar,
.page-shell {
  position: relative;
  z-index: 2;
}

.topbar {
  max-width: 1120px;
  margin: 0 auto 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.brand-lockup {
  display: grid;
  gap: 0.15rem;
}

.brand-kicker,
.eyebrow,
.card-kicker,
.mode-label {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
}

.brand-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  font-weight: 600;
}

.language-switch {
  display: inline-flex;
  gap: 0.6rem;
  padding: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px);
}

.flag-button,
.mode-button,
.primary-button,
.secondary-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    background-color 220ms ease,
    color 220ms ease,
    border-color 220ms ease;
}

.flag-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  background: transparent;
  color: var(--text-main);
}

.flag-button img {
  width: 1.5rem;
  height: 1rem;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(45, 33, 41, 0.18);
}

.flag-button.is-active,
.mode-button.is-active {
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--button-shadow);
}

.page-shell {
  max-width: 1120px;
  margin: 0 auto;
}

.panel {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.3), transparent 46%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.34), transparent 24%);
  pointer-events: none;
}

.panel-inner {
  position: relative;
  z-index: 1;
  padding: clamp(1.6rem, 5vw, 3rem);
}

.gate-panel {
  max-width: 700px;
  margin: 6vh auto 0;
}

.panel-title,
.hero-title,
.card-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  margin: 0;
  line-height: 0.95;
  text-wrap: balance;
}

.panel-title {
  font-size: clamp(3rem, 8vw, 5.1rem);
  margin-top: 0.6rem;
}

.hero-title {
  font-size: clamp(2.6rem, 6vw, 4.5rem);
}

.panel-copy,
.hero-copy-text,
.card-body,
.helper-text,
.feedback-text,
.mode-note,
.audio-status {
  line-height: 1.7;
  color: var(--text-soft);
}

.gate-form {
  margin-top: 2rem;
  display: grid;
  gap: 0.95rem;
}

.password-shell {
  position: relative;
  width: min(100%, 420px);
}

.password-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.01;
  cursor: text;
}

.password-display {
  position: relative;
  display: flex;
  gap: 0.3rem;
  padding: 1rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition:
    box-shadow 180ms ease,
    transform 180ms ease,
    background-color 180ms ease;
}

.password-input:focus + .password-display {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 3px rgba(255, 255, 255, 0.62),
    0 0 0 10px rgba(255, 255, 255, 0.22),
    0 18px 36px rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.48);
}

.password-slot {
  width: clamp(2.7rem, 9vw, 3.5rem);
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.password-slot.gap-after {
  margin-right: 0.95rem;
}

.password-slot.is-filled {
  background: rgba(255, 255, 255, 0.72);
  transform: translateY(-1px);
}

.password-input:focus + .password-display .password-slot {
  border-color: rgba(255, 255, 255, 0.78);
}

.feedback-text {
  min-height: 1.7em;
  margin: 0;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  min-width: 188px;
  border-radius: 999px;
  padding: 0.95rem 1.45rem;
  font-weight: 700;
  box-shadow: var(--button-shadow);
}

.primary-button {
  background: linear-gradient(135deg, var(--highlight), var(--highlight-strong));
  color: white;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.48);
  color: var(--text-main);
}

.ghost-button {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.flag-button:hover,
.mode-button:hover {
  transform: translateY(-2px);
}

.home-panel {
  margin-top: 3vh;
}

.hero-grid {
  display: grid;
  gap: 1.5rem;
  align-items: start;
  grid-template-columns: minmax(0, 1.4fr) minmax(270px, 0.82fr);
}

.hero-copy {
  display: grid;
  gap: 1rem;
}

.greeting-pill-row,
.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.greeting-pill,
.mode-button {
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.greeting-pill.is-current {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.45));
  box-shadow: var(--button-shadow);
}

.mode-card,
.content-card {
  border-radius: 26px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  padding: 1.2rem;
}

.mode-card {
  display: grid;
  gap: 1rem;
}

.content-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.6rem;
}

.audio-status,
.helper-text,
.mode-note {
  margin-bottom: 0;
}

.admin-return-button {
  margin-top: 0.25rem;
}

.admin-panel {
  margin-top: 3vh;
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto;
  gap: 1.2rem;
  align-items: start;
}

.admin-title {
  max-width: 12ch;
}

.admin-actions {
  display: grid;
  gap: 0.8rem;
  justify-items: end;
}

.admin-form {
  display: grid;
  gap: 1.2rem;
  margin-top: 1.5rem;
}

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

.admin-language-card {
  display: grid;
  gap: 1rem;
}

.admin-audio-card {
  display: grid;
  gap: 1rem;
}

.admin-audio-copy {
  margin: 0;
}

.shared-audio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.shared-audio-slot {
  display: grid;
  align-items: start;
}

.upload-field {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.upload-label {
  font-weight: 700;
}

.audio-file-input {
  width: 100%;
  color: var(--text-soft);
}

.upload-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

.upload-action-row .secondary-button {
  min-width: 148px;
}

.record-button.is-active {
  background: linear-gradient(135deg, var(--highlight), var(--highlight-strong));
  color: white;
}

.upload-status {
  line-height: 1.5;
  color: var(--text-soft);
}

.shared-audio-preview {
  width: 100%;
}

.message-field {
  display: grid;
  gap: 0.45rem;
  color: var(--text-main);
  font-weight: 600;
}

.message-field textarea {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-main);
  padding: 1rem;
  line-height: 1.6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.message-field textarea:focus {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 2px rgba(255, 255, 255, 0.4),
    0 0 0 8px rgba(255, 255, 255, 0.12);
}

.admin-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.admin-status {
  min-height: 1.7em;
  margin: 0;
}

.hidden {
  display: none;
}

.gradient-orb,
.sparkle-layer,
.bubble-field {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.gradient-orb {
  filter: blur(24px);
  opacity: 0.95;
}

.orb-one {
  width: 360px;
  height: 360px;
  top: 4%;
  left: -4%;
  background: radial-gradient(circle, var(--orb-a), transparent 72%);
  animation: orbit 18s ease-in-out infinite alternate;
}

.orb-two {
  width: 320px;
  height: 320px;
  right: -6%;
  top: 32%;
  background: radial-gradient(circle, var(--orb-b), transparent 68%);
  animation: orbit 22s ease-in-out infinite alternate-reverse;
}

.orb-three {
  width: 420px;
  height: 420px;
  bottom: -8%;
  left: 34%;
  background: radial-gradient(circle, var(--orb-c), transparent 70%);
  animation: orbit 26s ease-in-out infinite alternate;
}

.sparkle-layer {
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 74% 18%, rgba(255, 255, 255, 0.48) 0 1px, transparent 2px),
    radial-gradient(circle at 58% 36%, rgba(255, 255, 255, 0.34) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 25% 75%, rgba(255, 255, 255, 0.38) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 68%, rgba(255, 255, 255, 0.34) 0 1px, transparent 2px);
  animation: twinkle 8s ease-in-out infinite alternate;
}

.bubble {
  position: absolute;
  bottom: -12vh;
  animation-name: float-up;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  filter: drop-shadow(0 10px 20px rgba(255, 255, 255, 0.16));
}

.surprise-bubble {
  z-index: 1;
}

.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 orbit {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(18px, -12px, 0) scale(1.08);
  }
}

@keyframes twinkle {
  from {
    opacity: 0.45;
  }

  to {
    opacity: 0.9;
  }
}

@keyframes float-up {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  25% {
    transform: translate3d(16px, -22vh, 0) rotate(4deg);
  }

  50% {
    transform: translate3d(-12px, -48vh, 0) rotate(-4deg);
  }

  75% {
    transform: translate3d(12px, -74vh, 0) rotate(6deg);
  }

  100% {
    transform: translate3d(-6px, -114vh, 0) rotate(-4deg);
  }
}

@media (max-width: 780px) {
  .scene-shell {
    padding: 1rem;
  }

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

  .language-switch {
    align-self: flex-end;
    flex-wrap: wrap;
  }

  .hero-grid,
  .content-grid,
  .admin-grid,
  .admin-hero,
  .shared-audio-grid {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    justify-items: stretch;
  }

  .flag-button span {
    display: none;
  }

  .password-slot {
    width: min(14vw, 3.1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
