:root {
  --paper: #fffaf8;
  --mist: #f7f2f4;
  --sage: #dfe9e2;
  --sage-strong: #6f8d7a;
  --rose: #b86b7c;
  --ink: #3f353a;
  --muted: #756a6f;
  --line: rgba(63, 53, 58, 0.14);
  --shadow: 0 18px 50px rgba(86, 63, 72, 0.14);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f9f3f5 0%, #edf5ef 48%, #fffaf8 100%);
  font-family: ui-serif, "Songti SC", "Noto Serif SC", Georgia, serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.boot-fallback {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.boot-fallback div {
  max-width: 360px;
}

.boot-fallback h1 {
  margin: 0 0 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.45rem;
}

.boot-fallback p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.gift-page {
  position: relative;
  width: min(100%, 540px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 10px 30px;
}

.gift-hero {
  position: relative;
  min-height: 72vh;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: #ead7dc;
  box-shadow: var(--shadow);
}

.hero-media {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ead7dc, #dce8df);
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.88);
}

.hero-media::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(42, 32, 37, 0.06) 0%, rgba(42, 32, 37, 0.24) 48%, rgba(42, 32, 37, 0.72) 100%),
    linear-gradient(90deg, rgba(35, 57, 47, 0.2), rgba(184, 107, 124, 0.14));
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 30px 18px 24px;
  color: #fffaf8;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rose);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-content .eyebrow {
  color: rgba(255, 250, 248, 0.78);
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

.gift-hero h1 {
  max-width: 12em;
  margin: 0;
  font-size: clamp(2.2rem, 14vw, 4.7rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0;
}

.main-message {
  max-width: 29em;
  margin: 18px 0 0;
  color: rgba(255, 250, 248, 0.9);
  font-size: 1.02rem;
  line-height: 1.85;
}

.panel,
.message-window,
.link-section,
.countdown-section {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 248, 0.84);
  box-shadow: 0 12px 34px rgba(86, 63, 72, 0.08);
  backdrop-filter: blur(18px);
}

.panel p,
.link-section p,
.countdown-section p {
  margin: 12px 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.8;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--rose);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 850;
  letter-spacing: 0;
}

.photo-section {
  min-height: 260px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--sage);
  box-shadow: var(--shadow);
}

.photo-section img {
  display: block;
  width: 100%;
  min-height: 260px;
  max-height: 560px;
  object-fit: cover;
}

.empty-photo {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.music-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-top: 14px;
  padding: 0 14px 0 16px;
  border: 1px solid rgba(184, 107, 124, 0.22);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration: none;
}

.countdown-grid,
.countdown-labels {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 8px;
  align-items: center;
  text-align: center;
}

.countdown-grid {
  margin-top: 16px;
}

.countdown-grid strong,
.countdown-grid span,
.days-lived {
  display: grid;
  min-height: 58px;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(63, 53, 58, 0.08);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.35rem;
  color: var(--ink);
}

.countdown-grid strong,
.days-lived {
  color: var(--rose);
  font-weight: 850;
}

.countdown-labels {
  margin-top: 7px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
}

.muted,
.tiny-note {
  color: var(--muted) !important;
}

.message-window,
.message-form,
.message-list {
  display: grid;
  gap: 14px;
}

.sender-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(63, 53, 58, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.sender-toggle button {
  min-height: 38px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 850;
  cursor: pointer;
}

.sender-toggle button.active {
  background: #fff;
  color: var(--rose);
  box-shadow: 0 8px 20px rgba(86, 63, 72, 0.08);
}

.message-input,
.field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(63, 53, 58, 0.15);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 104px;
  padding: 12px 13px;
  line-height: 1.65;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(184, 107, 124, 0.58);
  box-shadow: 0 0 0 3px rgba(184, 107, 124, 0.12);
}

.message-actions,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.send-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 8px;
  background: var(--ink);
  color: #fffaf8;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 850;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 250, 248, 0.9);
  color: var(--ink);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.message-bubble {
  max-width: 88%;
  padding: 12px 13px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(63, 53, 58, 0.08);
}

.message-bubble.you {
  justify-self: end;
  background: rgba(223, 233, 226, 0.82);
}

.message-bubble div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--rose);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
}

.message-bubble.you div {
  color: var(--sage-strong);
}

.message-bubble time {
  color: var(--muted);
  font-weight: 600;
}

.message-bubble p {
  margin: 8px 0 0;
  line-height: 1.72;
}

.egg-button {
  position: fixed;
  right: max(18px, calc((100vw - 540px) / 2 + 18px));
  bottom: 18px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 250, 248, 0.78);
  color: var(--rose);
  box-shadow: 0 12px 28px rgba(63, 53, 58, 0.18);
  backdrop-filter: blur(14px);
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(42, 32, 37, 0.36);
}

.egg-modal {
  width: min(100%, 390px);
  padding: 24px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal-close {
  float: right;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  background: var(--sage);
  color: var(--ink);
  cursor: pointer;
}

.admin-page {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 16px 42px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
  display: grid;
  place-items: center;
}

.login-panel,
.editor-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 248, 0.92);
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(100%, 420px);
  padding: 24px;
}

.login-panel form,
.editor-panel {
  display: grid;
  gap: 16px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header h1,
.login-panel h1 {
  margin: 8px 0 0;
  font-size: 2rem;
  letter-spacing: 0;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.editor-panel,
.preview-panel {
  padding: 18px;
}

.preview-panel {
  position: sticky;
  top: 16px;
}

.notice {
  margin: 0;
  padding: 12px 13px;
  border-radius: 8px;
  line-height: 1.5;
}

.notice.ok {
  background: rgba(111, 141, 122, 0.16);
  color: #345b45;
}

.notice.error {
  background: rgba(184, 107, 124, 0.16);
  color: #8d364a;
}

.phone-preview {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.phone-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.phone-preview h2,
.phone-preview p,
.phone-preview small {
  display: block;
  margin: 12px 16px 0;
}

.phone-preview small {
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 780px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}
