:root {
  /* Sky Gradients */
  --sky-zenith: #383b5c;
  --sky-top: #4A4E74;
  --sky-mid: #6F7399;
  --sky-horizon: #9C99B6;

  /* Typography & Interface Elements */
  --ink: #FFF2F5;
  --ink-light: rgba(255, 242, 245, 0.82);
  --ink-faint: rgba(255, 242, 245, 0.52);
  --ink-line: rgba(255, 242, 245, 0.16);

  /* Sakura Flowers & Foliage */
  --sakura-main: #FCAEB8;
  --sakura-pale: #FFD1DC;
  --sakura-accent: #EB8298;
  --sakura-cream: #FFF2F5;

  /* Tree & Bark */
  --tree-dark: #7F6477;
  --tree-light: #967A90;

  /* Ground & Terrain */
  --ground-front: #AEA4B9;
  --ground-back: #8E829B;

  /* Moon & Stars */
  --moon-main: #EAC0A2;
  --moon-crater: #CE9B7E;
  --star-glow: #E8E6F0;

  /* Glassmorphism & Panels */
  --btn-glass: rgba(255, 255, 255, 0.18);
  --btn-glass-border: rgba(255, 242, 245, 0.25);
  --btn-glass-hover: #787694;
  --panel-bg: rgba(78, 68, 95, 0.76);
  --panel-border: rgba(255, 242, 245, 0.15);
  --card-bg: rgba(78, 68, 95, 0.88);
  --card-border: rgba(252, 174, 184, 0.35);
  --card-shadow: 0 16px 48px rgba(35, 30, 48, 0.5);

  --danger: #eb8298;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-cursive: "Italianno", cursive, serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* Ensure hidden attribute works everywhere regardless of specificity */
[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--sky-top);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

/* --- Atmospheric Night Sky System --- */
.sky {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-zenith) 0%, var(--sky-top) 28%, var(--sky-mid) 68%, var(--sky-horizon) 100%);
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Starfields */
.stars-layer {
  position: absolute;
  inset: 0;
}

.stars-1 {
  background-image:
    radial-gradient(1px 1px at 12% 18%, var(--star-glow) 100%, transparent),
    radial-gradient(1px 1px at 28% 42%, rgba(232, 230, 240, 0.8) 100%, transparent),
    radial-gradient(1.5px 1.5px at 45% 15%, var(--star-glow) 100%, transparent),
    radial-gradient(1px 1px at 62% 35%, rgba(232, 230, 240, 0.7) 100%, transparent),
    radial-gradient(1.5px 1.5px at 82% 12%, var(--star-glow) 100%, transparent),
    radial-gradient(1px 1px at 92% 48%, rgba(232, 230, 240, 0.8) 100%, transparent),
    radial-gradient(1px 1px at 18% 75%, rgba(232, 230, 240, 0.6) 100%, transparent),
    radial-gradient(1.5px 1.5px at 38% 68%, var(--star-glow) 100%, transparent),
    radial-gradient(1px 1px at 72% 78%, rgba(232, 230, 240, 0.7) 100%, transparent);
  animation: star-twinkle 6s ease-in-out infinite alternate;
}

.stars-2 {
  background-image:
    radial-gradient(1px 1px at 8% 32%, rgba(255, 209, 220, 0.75) 100%, transparent),
    radial-gradient(1.5px 1.5px at 22% 8%, var(--star-glow) 100%, transparent),
    radial-gradient(1px 1px at 52% 28%, rgba(234, 192, 162, 0.8) 100%, transparent),
    radial-gradient(1px 1px at 68% 18%, var(--star-glow) 100%, transparent),
    radial-gradient(2px 2px at 88% 30%, rgba(255, 209, 220, 0.9) 100%, transparent),
    radial-gradient(1px 1px at 32% 88%, rgba(232, 230, 240, 0.6) 100%, transparent),
    radial-gradient(1.5px 1.5px at 84% 65%, var(--star-glow) 100%, transparent);
  animation: star-twinkle 8s ease-in-out infinite alternate-reverse;
}

.stars-3 {
  background-image:
    radial-gradient(2px 2px at 15% 12%, rgba(234, 192, 162, 0.75) 100%, transparent),
    radial-gradient(1.5px 1.5px at 48% 8%, var(--star-glow) 100%, transparent),
    radial-gradient(1px 1px at 78% 28%, rgba(232, 230, 240, 0.9) 100%, transparent),
    radial-gradient(1.5px 1.5px at 95% 18%, var(--star-glow) 100%, transparent);
  animation: star-twinkle 10s ease-in-out infinite alternate;
}

@keyframes star-twinkle {
  0% { opacity: 0.35; transform: scale(0.95); }
  50% { opacity: 0.85; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

/* Shooting Star */
.shooting-star {
  position: absolute;
  top: 15%;
  left: 20%;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, rgba(232, 230, 240, 0.95), rgba(255, 209, 220, 0.4), transparent);
  transform: rotate(-35deg) translateX(0);
  opacity: 0;
  animation: shoot 11s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes shoot {
  0% { opacity: 0; transform: rotate(-35deg) translate(-100px, 0); }
  2% { opacity: 1; }
  5% { opacity: 0; transform: rotate(-35deg) translate(380px, 120px); }
  100% { opacity: 0; transform: rotate(-35deg) translate(380px, 120px); }
}

/* Luminous Moon */
.moon-wrap {
  position: absolute;
  top: clamp(25px, 6vh, 65px);
  right: clamp(20px, 7vw, 95px);
  width: clamp(65px, 11vw, 95px);
  height: clamp(65px, 11vw, 95px);
}

.moon-halo {
  position: absolute;
  inset: -35px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 192, 162, 0.25) 0%, rgba(156, 153, 182, 0.08) 55%, transparent 72%);
  animation: moon-pulse 6s ease-in-out infinite alternate;
}

@keyframes moon-pulse {
  0% { transform: scale(0.92); opacity: 0.7; }
  100% { transform: scale(1.08); opacity: 1; }
}

.moon {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff5ed 0%, var(--moon-main) 62%, #CE9B7E 100%);
  box-shadow: 0 0 26px rgba(234, 192, 162, 0.35), inset -6px -6px 14px rgba(206, 155, 126, 0.3);
}

.moon-crater {
  position: absolute;
  border-radius: 50%;
  background: var(--moon-crater);
  opacity: 0.35;
}

.moon-crater.c1 {
  width: 22%;
  height: 22%;
  top: 28%;
  left: 24%;
}

.moon-crater.c2 {
  width: 14%;
  height: 14%;
  top: 56%;
  left: 36%;
}

.moon-crater.c3 {
  width: 16%;
  height: 16%;
  top: 38%;
  left: 60%;
}

/* Organic Drifting Clouds */
.clouds-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cloud {
  position: absolute;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 242, 245, 0.12) 0%, rgba(156, 153, 182, 0.05) 100%);
  filter: blur(12px);
}

.cloud-1 {
  width: 380px;
  height: 60px;
  top: 12%;
  left: -400px;
  animation: drift-cloud 75s linear infinite;
}

.cloud-2 {
  width: 460px;
  height: 75px;
  top: 26%;
  left: -500px;
  animation: drift-cloud 110s linear infinite 15s;
}

.cloud-3 {
  width: 320px;
  height: 50px;
  top: 48%;
  left: -350px;
  animation: drift-cloud 90s linear infinite 35s;
}

.cloud-4 {
  width: 520px;
  height: 80px;
  top: 8%;
  left: -550px;
  animation: drift-cloud 140s linear infinite 50s;
}

@keyframes drift-cloud {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 600px)); }
}

/* Pollen / Petal Dust */
.sky-particles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(252, 174, 184, 0.35), transparent),
    radial-gradient(1.5px 1.5px at 50% 50%, rgba(234, 192, 162, 0.3), transparent),
    radial-gradient(1px 1px at 80% 40%, rgba(252, 174, 184, 0.35), transparent);
  animation: gentle-drift 12s ease-in-out infinite alternate;
}

@keyframes gentle-drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(12px, -8px); }
}

/* Header */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 2.5vw, 20px) clamp(16px, 4vw, 40px);
  z-index: 20;
  background: linear-gradient(180deg, rgba(56, 59, 92, 0.75) 0%, rgba(56, 59, 92, 0) 100%);
}

.wordmark {
  font-family: var(--font-cursive);
  font-weight: 400;
  font-size: clamp(2.1rem, 4.4vw, 2.75rem);
  line-height: 1;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #FFF2F5 25%, #FFD1DC 65%, #FCAEB8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(252, 174, 184, 0.35));
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wordmark-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0;
  transform: translateY(-3.5px);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-text-fill-color: initial;
}

.wordmark:hover .wordmark-icon {
  transform: translateY(-3.5px) rotate(20deg) scale(1.2);
}

.mini-blossom-svg {
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.25s ease;
  filter: drop-shadow(0 1px 4px rgba(252, 174, 184, 0.45));
}

.counter-pill .mini-blossom-svg {
  margin-right: 6px;
}

.counter-pill:hover .mini-blossom-svg {
  transform: rotate(30deg) scale(1.2);
}

.wordmark-accent {
  background: linear-gradient(135deg, #FFD1DC 0%, #FCAEB8 60%, #EB8298 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Solid Glass Buttons */
.cta-btn {
  background: var(--btn-glass);
  border: 1px solid var(--btn-glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.65em 1.35em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(45, 40, 65, 0.25);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
  background: var(--btn-glass-hover);
  border-color: var(--sakura-main);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(252, 174, 184, 0.35);
}

.cta-btn:active {
  transform: translateY(0);
}

/* Floating Bottom Footer Bar (Language switch + Signature) */
.footer-bar {
  position: fixed;
  bottom: 14px;
  right: 18px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--btn-glass);
  border: 1px solid var(--btn-glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 5px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(45, 40, 65, 0.25);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.footer-bar:hover {
  border-color: rgba(252, 174, 184, 0.4);
}

.footer-bar .credit {
  position: static;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-cursive);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink-light);
  transform: translateY(2.5px);
  text-decoration: none;
}

.footer-bar .credit:hover {
  color: var(--sakura-pale);
  transform: translateY(2.5px) scale(1.05);
}

.footer-sep {
  display: inline-flex;
  align-items: center;
  color: var(--ink-faint);
  opacity: 0.35;
  font-size: 0.8rem;
  line-height: 1;
  user-select: none;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  gap: 2px;
}

.lang-btn {
  color: var(--ink-faint);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s ease, text-shadow 0.2s ease;
  line-height: 1;
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn.active {
  color: var(--sakura-main);
  text-shadow: 0 0 10px rgba(252, 174, 184, 0.45);
}

.lang-sep {
  color: var(--ink-faint);
  opacity: 0.35;
  font-size: 0.72rem;
  user-select: none;
}

.panel-lang {
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.panel-lang .lang-btn {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.panel-lang .lang-btn.active {
  background: rgba(252, 174, 184, 0.2);
  color: var(--sakura-main);
}

.sparkle-svg {
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.25s ease;
}

.cta-btn:hover .sparkle-svg {
  transform: rotate(45deg) scale(1.2);
}

/* Stage & Tree */
.stage {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-top: 70px;
  padding-bottom: 0;
  z-index: 5;
}

.tree-wrap {
  width: min(880px, 95vw);
  aspect-ratio: 9 / 10;
  max-height: 78vh;
  position: relative;
  z-index: 5;
}

#tree-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Prevent unwanted focus outline boxes on SVG elements */
#tree-svg *:focus,
#tree-svg *:focus-visible,
.blossom:focus,
.blossom:focus-visible {
  outline: none !important;
}

.branch {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Delicate Sakura Leaves & Blossom Buds on branches */
.tree-leaf {
  fill: var(--sakura-main);
  opacity: 0.85;
  transition: opacity 0.3s ease;
}

.tree-leaf-alt {
  fill: var(--sakura-pale);
  opacity: 0.8;
}

.tree-bud {
  fill: var(--sakura-main);
  opacity: 0.95;
}

.tree-bud-core {
  fill: var(--sakura-cream);
}

/* Falling & Accumulating Sakura Petals Canvas */
.petals-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 7;
}

/* Blossom: 100% reliable cross-device rendering (Safari, Android, Chrome) */
.blossom {
  cursor: pointer;
  filter: drop-shadow(0 2px 8px rgba(252, 174, 184, 0.45));
  animation: bloom 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.blossom:hover,
.blossom:focus-visible {
  filter: drop-shadow(0 4px 14px rgba(252, 174, 184, 0.85)) brightness(1.15);
}

.blossom.ascending {
  animation: ascend 2.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes bloom {
  0% { transform: scale(0.1); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes ascend {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  40% { opacity: 0.9; }
  100% { transform: translateY(-160px) scale(0.4); opacity: 0; }
}

/* Sky Wishes (Floating Petal Stars) */
.sky-wishes {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.sky-star {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 15%, var(--sakura-pale) 60%, transparent 80%);
  box-shadow: 0 0 10px rgba(255, 209, 220, 0.6);
  cursor: pointer;
  pointer-events: auto;
  animation: float-star 4s ease-in-out infinite alternate;
  border: none;
  padding: 0;
}

.sky-star::after {
  content: "";
  position: absolute;
  inset: -12px; /* 42px touch hitbox */
  border-radius: 50%;
}

.sky-star:hover {
  transform: scale(1.3);
  box-shadow: 0 0 16px rgba(255, 209, 220, 0.85);
}

@keyframes float-star {
  0% { transform: translateY(0) scale(0.92); }
  100% { transform: translateY(-6px) scale(1.08); }
}

/* Organic Ground & Grass Terrain Mound */
.ground-terrain {
  position: relative;
  width: 100%;
  margin-top: -36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 6;
}

.ground-svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 110px;
  pointer-events: none;
}

.counter-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--ink-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  padding: 0.52em 1.25em;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--ink);
  letter-spacing: 0.01em;
  margin-bottom: 22px;
  z-index: 8;
  box-shadow: 0 6px 20px rgba(35, 30, 48, 0.35);
}

.counter-pill span {
  display: inline;
}

.counter-pill strong {
  font-weight: 700;
  color: var(--sakura-accent);
}

/* Wish Card Modal Dialog */
.wish-card-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 60, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 60;
  animation: fade-in 0.2s ease-out;
}

.wish-card-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, 90vw);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 26px 24px 22px;
  box-shadow: var(--card-shadow);
  z-index: 65;
  animation: pop-card 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pop-card {
  0% { transform: translate(-50%, -46%) scale(0.95); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wish-card-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-light);
  font-size: 1rem;
  transition: background 0.15s ease;
}

.wish-card-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.wish-card-tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--sakura-accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wish-card-text {
  font-family: var(--font-body);
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 18px;
  word-break: break-word;
}

.wish-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--ink-line);
  padding-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.wish-card-who {
  font-weight: 600;
  color: var(--sakura-pale);
}

/* Wish Form Side Panel / Bottom Sheet */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 60, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: -8px 0 40px rgba(35, 30, 48, 0.45);
  padding: clamp(24px, 5vw, 36px);
  z-index: 55;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.panel-handle {
  display: none;
  width: 44px;
  height: 5px;
  background: rgba(255, 242, 245, 0.25);
  border-radius: 999px;
  margin: 0 auto 16px;
}

.panel-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 242, 245, 0.1);
  color: var(--ink-light);
  font-size: 1.1rem;
  transition: background 0.15s ease;
}

.panel-close:hover {
  background: rgba(255, 242, 245, 0.2);
}

#panel-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  color: var(--ink);
  margin-top: 14px;
  margin-bottom: 6px;
}

.panel-hint {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-light);
  margin-bottom: 22px;
}

#wish-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

label span {
  font-weight: 400;
  color: var(--ink-faint);
}

input, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.96rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid var(--ink-line);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--sakura-main);
  box-shadow: 0 0 0 3px rgba(252, 174, 184, 0.25);
}

.char-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-align: right;
  margin-top: -10px;
}

/* Centered hCaptcha Widget between textarea and submit button */
.h-captcha,
#hcaptcha-widget {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 6px auto;
  min-height: 78px;
}

.h-captcha > *,
#hcaptcha-widget > * {
  margin: 0 auto !important;
}

.submit-btn {
  width: 100%;
  background: var(--sakura-accent);
  color: var(--ink);
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 14px;
  margin-top: 8px;
  box-shadow: 0 4px 18px rgba(235, 130, 152, 0.35);
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
  background: #e06982;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(224, 105, 130, 0.45);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.form-error {
  color: #ffb4c2;
  font-size: 0.85rem;
  background: rgba(235, 130, 152, 0.2);
  border: 1px solid rgba(235, 130, 152, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
}

.panel-footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.panel-footer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.panel-footer a:hover {
  color: var(--ink);
}

.panel-credit {
  display: block;
  margin-top: 10px;
  font-family: var(--font-cursive);
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.panel-credit a {
  text-decoration: none;
  color: var(--ink-faint);
  transition: color 0.2s ease;
}

.panel-credit a:hover {
  color: var(--sakura-pale);
}

/* Desktop Credit */
.credit {
  position: fixed;
  bottom: 12px;
  right: 18px;
  font-family: var(--font-cursive);
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  z-index: 15;
  transition: color 0.2s ease, transform 0.2s ease;
}

.credit:hover {
  color: var(--sakura-pale);
  transform: scale(1.05);
}

/* Terms & 404 Pages */
.terms {
  position: relative;
  z-index: 5;
  max-width: 640px;
  margin: 0 auto;
  padding: 100px 24px 60px;
  line-height: 1.7;
}

.terms h1, .terms h2, .terms h3 {
  font-family: var(--font-display);
  color: var(--ink);
}

.terms h1 {
  font-size: 2.1rem;
  margin-bottom: 0.4em;
}

.terms h2 {
  font-size: 1.25rem;
  margin-top: 1.8em;
  margin-bottom: 0.5em;
}

.terms p {
  margin-bottom: 16px;
  color: var(--ink-light);
}

.terms a {
  color: var(--sakura-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
  .topbar {
    padding: 10px 14px;
  }

  .cta-btn {
    padding: 0.55em 1.1em;
    font-size: 0.85rem;
  }

  .footer-bar {
    bottom: 8px;
    right: 12px;
    padding: 3px 10px;
    gap: 6px;
    background: rgba(78, 68, 95, 0.6);
  }

  .footer-bar .credit {
    font-size: 1.15rem;
  }

  .lang-switch {
    font-size: 0.72rem;
  }

  .stage {
    padding-top: 60px;
    justify-content: flex-end;
  }

  .tree-wrap {
    width: min(100%, 96vw);
    aspect-ratio: 9 / 10;
    max-height: 64vh;
  }

  .ground-terrain {
    margin-top: -24px;
  }

  .ground-svg {
    height: 85px;
  }

  .counter-pill {
    font-size: 0.76rem;
    margin-bottom: 16px;
    padding: 0.46em 1.1em;
  }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 88svh;
    border-left: none;
    border-top: 1px solid var(--panel-border);
    border-radius: 24px 24px 0 0;
    padding: 16px 20px 28px;
    animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .panel-handle {
    display: block;
  }

  #panel-title {
    margin-top: 0;
  }

  @keyframes slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
