:root {
  --blue-950: #071b3d;
  --blue-900: #0b2b62;
  --blue-800: #12458f;
  --blue-700: #1d64c3;
  --blue-600: #2d75d4;
  --blue-200: #c6dcff;
  --blue-100: #eaf3ff;
  --gold: #ffd36a;
  --coral: #ff8b8b;
  --mint: #8ee6d0;
  --ink: #132037;
  --muted: #5d6f8c;
  --surface: rgba(255, 255, 255, 0.88);
  --line: rgba(18, 69, 143, 0.15);
  --shadow: 0 20px 60px rgba(7, 27, 61, 0.2);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eaf3ff;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.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;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 211, 106, 0.42) 0 2px, transparent 3px),
    radial-gradient(circle at 75% 16%, rgba(142, 230, 208, 0.45) 0 2px, transparent 3px),
    radial-gradient(circle at 56% 56%, rgba(255, 139, 139, 0.35) 0 2px, transparent 3px),
    linear-gradient(145deg, #dcecff 0%, #f7fbff 48%, #d7e8ff 100%);
}

.sky span {
  position: absolute;
  width: 8rem;
  height: 8rem;
  border-radius: 999px;
  border: 1px solid rgba(45, 117, 212, 0.1);
  opacity: 0.55;
  animation: float 12s ease-in-out infinite;
}

.sky span:nth-child(1) {
  left: 6%;
  top: 16%;
}

.sky span:nth-child(2) {
  right: 8%;
  top: 24%;
  width: 11rem;
  height: 11rem;
  animation-delay: -3s;
}

.sky span:nth-child(3) {
  left: 14%;
  bottom: 12%;
  width: 6rem;
  height: 6rem;
  animation-delay: -6s;
}

.sky span:nth-child(4) {
  right: 24%;
  bottom: 16%;
  width: 5rem;
  height: 5rem;
  animation-delay: -9s;
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -18px, 0);
  }
}

.view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.gate-panel,
.loading-panel {
  width: min(100%, 34rem);
  padding: clamp(2rem, 5vw, 3.25rem);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 0.5rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 243, 255, 0.9));
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--blue-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.gate-panel h1,
.loading-panel h1 {
  margin-bottom: 0.85rem;
  color: var(--blue-950);
  font-size: clamp(2rem, 7vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.gate-copy,
.loading-panel p {
  color: var(--muted);
}

.gate-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.gate-form input,
.wish-form input,
.wish-form textarea {
  width: 100%;
  border: 1px solid rgba(29, 100, 195, 0.2);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: 0;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.gate-form input {
  min-height: 3.15rem;
  padding: 0 1rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.gate-form input:focus,
.wish-form input:focus,
.wish-form textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(45, 117, 212, 0.14);
  background: #fff;
}

.gate-form button,
.submit-button {
  min-height: 3.15rem;
  border: 0;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-600));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(29, 100, 195, 0.28);
}

.gate-form button {
  padding: 0 1.35rem;
}

.form-error {
  min-height: 1.5rem;
  margin: 0.9rem 0 0;
  color: #c43d55;
  font-size: 0.92rem;
}

.loader {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.loader span {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--blue-600);
  animation: pulse 1s ease-in-out infinite;
}

.loader span:nth-child(2) {
  background: var(--gold);
  animation-delay: 0.16s;
}

.loader span:nth-child(3) {
  background: var(--coral);
  animation-delay: 0.32s;
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-0.55rem);
    opacity: 1;
  }
}

.birthday-view {
  min-height: 100vh;
  padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
}

.hero-section {
  min-height: 72vh;
  display: grid;
  align-items: center;
  padding: clamp(4.5rem, 10vh, 7rem) 1.4rem 3rem;
  background:
    linear-gradient(rgba(7, 27, 61, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 27, 61, 0.12) 1px, transparent 1px),
    radial-gradient(circle at 70% 22%, rgba(255, 211, 106, 0.32), transparent 18rem),
    linear-gradient(145deg, #073277 0%, #2d75d4 50%, #bfe3ff 100%);
  background-size:
    44px 44px,
    44px 44px,
    auto,
    auto;
  color: #fff;
}

.hero-inner {
  width: min(100%, 58rem);
  margin: 0 auto;
}

.hero-section .eyebrow {
  color: #d9ecff;
}

.hero-section h1 {
  max-width: 12ch;
  margin-bottom: 1.2rem;
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 48rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
}

.content-section {
  width: min(100%, 62rem);
  margin: 0 auto;
  padding: clamp(2.8rem, 7vw, 5rem) 1.4rem 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.section-heading h2 {
  margin-bottom: 0;
  color: var(--blue-950);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.tag-cloud,
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.55rem;
  border: 1px solid rgba(45, 117, 212, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--blue-900);
  box-shadow: 0 10px 22px rgba(7, 27, 61, 0.08);
  font-weight: 800;
}

.tag-cloud .tag-chip {
  padding: 0.35rem 0.85rem;
}

.tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: rgba(255, 211, 106, 0.35);
  color: #865800;
  font-size: 0.82rem;
}

.tag-picker {
  margin-top: 0.6rem;
}

.tag-picker .tag-chip {
  padding: 0.35rem 0.75rem;
}

.tag-picker .tag-chip.selected {
  border-color: var(--blue-700);
  background: var(--blue-700);
  color: #fff;
}

.tag-picker .tag-chip.selected .tag-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.blessing-list {
  display: grid;
  gap: 1rem;
}

.blessing-card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(7, 27, 61, 0.08);
  backdrop-filter: blur(10px);
}

.blessing-card p {
  margin-bottom: 1rem;
  color: #24344f;
  font-size: 1.02rem;
  white-space: pre-wrap;
}

.blessing-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  width: 100%;
  margin: 0;
  padding: 1.2rem;
  border: 1px dashed rgba(29, 100, 195, 0.25);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  text-align: center;
}

.sound-toggle,
.icon-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--blue-800);
  box-shadow: 0 10px 28px rgba(7, 27, 61, 0.18);
}

.sound-toggle {
  position: fixed;
  top: calc(1rem + env(safe-area-inset-top));
  right: 1rem;
  z-index: 20;
  width: 3rem;
  height: 3rem;
}

.sound-toggle.is-muted {
  color: #a53a48;
}

.sound-icon {
  font-size: 1.35rem;
  font-weight: 900;
}

.send-button {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 15;
  width: min(calc(100% - 2rem), 26rem);
  min-height: 3.4rem;
  transform: translateX(-50%);
  border: 0;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(29, 100, 195, 0.34);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 27, 61, 0.42);
}

.sheet-panel {
  position: relative;
  width: min(100%, 40rem);
  max-height: min(90vh, 46rem);
  margin: 0 auto;
  overflow: auto;
  padding: 1.2rem;
  border-radius: 0.5rem 0.5rem 0 0;
  background: #f8fbff;
  box-shadow: 0 -24px 80px rgba(7, 27, 61, 0.3);
}

.sheet-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.sheet-header h2 {
  margin-bottom: 0;
  color: var(--blue-950);
  font-size: 1.55rem;
  line-height: 1.15;
}

.icon-button {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  font-size: 1.4rem;
}

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

.wish-form label,
.form-group {
  display: grid;
  gap: 0.45rem;
}

.wish-form label > span,
.label-row > span {
  color: var(--blue-950);
  font-weight: 800;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.label-row small {
  color: var(--muted);
}

.wish-form input,
.wish-form textarea {
  padding: 0.85rem 0.9rem;
}

.wish-form textarea {
  resize: vertical;
  min-height: 8rem;
}

.submit-button {
  width: 100%;
  margin-top: 0.2rem;
}

@media (max-width: 720px) {
  .view {
    padding: 1rem;
  }

  .gate-form {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: 68vh;
    padding-top: 5.5rem;
  }

  .section-heading {
    display: block;
  }

  .blessing-meta {
    display: grid;
    gap: 0.15rem;
  }

  .sheet-panel {
    max-height: 92vh;
  }
}

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