:root {
  color-scheme: dark;
  --bg: #180f14;
  --bg-2: #2a1118;
  --ink: #fff8f4;
  --muted: #d8b7ae;
  --panel: rgba(37, 22, 26, 0.7);
  --panel-strong: rgba(255, 248, 244, 0.1);
  --line: rgba(255, 235, 226, 0.2);
  --accent: #ff5f84;
  --accent-2: #f4b66a;
  --leaf: #4e9a72;
  --shadow: rgba(6, 3, 5, 0.55);
  --radius: 8px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell,
.garden,
#flowerCanvas {
  width: 100vw;
  height: 100vh;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 25%, rgba(255, 123, 150, 0.32), transparent 32%),
    linear-gradient(135deg, #170d12 0%, #32131d 46%, #17251e 100%);
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease,
    transform 0.5s ease;
}

.gate.is-open {
  visibility: hidden;
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.gate__glow {
  position: absolute;
  width: min(56vw, 520px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 226, 216, 0.22);
  border-radius: 50%;
  box-shadow:
    0 0 90px rgba(255, 97, 131, 0.28),
    inset 0 0 90px rgba(244, 182, 106, 0.14);
  animation: breathe 5s ease-in-out infinite;
}

.gate__panel {
  position: relative;
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(27, 14, 18, 0.76);
  box-shadow: 0 22px 80px var(--shadow);
  backdrop-filter: blur(22px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.15rem, 10vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 4vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.28rem;
  letter-spacing: 0;
}

.gate__copy {
  margin-bottom: 26px;
  color: var(--muted);
  line-height: 1.55;
}

.password-form label,
.qr-panel__label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
}

.password-form__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 235, 226, 0.2);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(255, 250, 245, 0.1);
  color: var(--ink);
}

.password-form input {
  height: 48px;
  padding: 0 14px;
  font-size: 1.22rem;
  letter-spacing: 0;
}

.password-form button,
.qr-panel__actions button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #1b0f14;
  font-weight: 850;
  box-shadow: 0 12px 30px rgba(255, 95, 132, 0.28);
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.error {
  min-height: 1.25rem;
  margin: 8px 0 0;
  color: #ffb1a4;
  font-size: 0.88rem;
}

.garden {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(78, 154, 114, 0.22), transparent 34%),
    var(--bg);
}

.garden.is-locked {
  filter: blur(6px);
}

#flowerCanvas {
  display: block;
}

.topbar,
.flower-tabs,
.info-panel,
.mood-strip,
.qr-panel {
  position: absolute;
  z-index: 5;
}

.topbar {
  top: 22px;
  left: 22px;
  right: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.topbar > *,
.flower-tabs,
.info-panel,
.mood-strip,
.qr-panel {
  pointer-events: auto;
}

.topbar__actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 15, 20, 0.58);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  backdrop-filter: blur(16px);
}

.icon-button[aria-pressed="false"] {
  color: var(--muted);
}

.flower-tabs {
  left: 50%;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
  width: min(520px, calc(100vw - 44px));
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 15, 20, 0.62);
  backdrop-filter: blur(18px);
}

.flower-tab {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.flower-tab.is-active {
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 235, 226, 0.14);
}

.info-panel {
  right: 22px;
  bottom: 98px;
  width: min(370px, calc(100vw - 44px));
  max-height: min(50vh, 430px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 60px var(--shadow);
  backdrop-filter: blur(20px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.info-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.info-panel__head h3 {
  margin-bottom: 12px;
}

.info-close {
  display: none;
  flex: 0 0 auto;
}

.info-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.garden.is-qr-open .info-panel {
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.facts div {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 235, 226, 0.12);
}

.facts dt {
  margin-bottom: 4px;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.mood-strip {
  left: 22px;
  bottom: 106px;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 15, 20, 0.58);
  backdrop-filter: blur(18px);
}

.mood-swatch {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.mood-swatch.is-active {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.mood-swatch[data-mood="dawn"] {
  background: linear-gradient(135deg, #ff7898, #f7c977, #3f8e67);
}

.mood-swatch[data-mood="velvet"] {
  background: linear-gradient(135deg, #7b101e, #ff436d, #2d6f55);
}

.mood-swatch[data-mood="pearl"] {
  background: linear-gradient(135deg, #fff8ec, #e2c6ff, #77bfa3);
}

.mood-swatch[data-mood="gold"] {
  background: linear-gradient(135deg, #f4a261, #f7d774, #20594b);
}

.qr-panel {
  top: 86px;
  right: 22px;
  width: min(320px, calc(100vw - 44px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(28, 17, 22, 0.84);
  box-shadow: 0 22px 80px var(--shadow);
  backdrop-filter: blur(22px);
}

.qr-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#qrCode {
  display: block;
  width: min(224px, 100%);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  border-radius: 6px;
  background: #fff8f4;
  overflow: hidden;
}

#qrCode canvas,
#qrCode img {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-panel input {
  height: 40px;
  margin-bottom: 10px;
  padding: 0 10px;
  color: var(--ink);
}

.qr-panel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.qr-panel__actions button {
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.qr-status {
  min-height: 1.2rem;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.74;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .gate__panel {
    padding: 24px;
  }

  .topbar {
    top: 16px;
    left: 16px;
    right: 16px;
  }

  .info-panel {
    left: 16px;
    right: 16px;
    bottom: 92px;
    width: auto;
    max-height: min(58vh, 520px);
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
  }

  .garden.is-info-open .info-panel {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .garden.is-qr-open .info-panel,
  .garden.is-qr-open.is-info-open .info-panel {
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
  }

  .info-close {
    display: grid;
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }

  .flower-tabs {
    bottom: 16px;
    width: calc(100vw - 32px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flower-tab {
    padding: 0 6px;
    font-size: 0.88rem;
  }

  .mood-strip {
    left: 16px;
    top: 92px;
    bottom: auto;
    grid-auto-flow: column;
  }

  .qr-panel {
    top: 76px;
    right: 16px;
  }
}

@media (max-width: 520px) {
  .password-form__row {
    grid-template-columns: 1fr;
  }

  .password-form button {
    width: 100%;
  }

  .info-panel {
    padding: 14px;
  }

  .mood-strip {
    left: 16px;
    transform: none;
  }
}
