:root {
  --ink: #132e36;
  --bg: #e2d1c0;
  --paper: #f5e7d8;
  --cta: #9f1f16;
  --cta-ink: #ffffff;
  --card: #ffffff;
  --share: #39624f;
  --outline-hover: #beccd2;
  --link: #047da1;
  --steel: #5c8ba7;
  --warm: #ddbfa4;
  --bright-red: #d12419;
  --lang-active: #a1ef8b;
  --heading: #7b1830;
  --body-soft: #492c33;
  --shadow: 0 4px 10px rgba(19, 46, 54, 0.12);
  --radius-btn: 40px; /* Official Winter Post primary pills */
  --radius-card: 12px;
  --radius-control: 2px;
  --max: 1080px;
  --font-ui: "Noto Sans", "Noto Sans TC", system-ui, sans-serif;
  --font-title: "Lora", "Noto Serif TC", Georgia, serif;
  --font-mark-en: "Sansita", "Lora", sans-serif;
  --font-mark-tc: "Noto Sans TC", "Noto Sans", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--link);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(19, 46, 54, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  flex: none;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  overflow: visible;
}

[data-lang="en"] .brand-title {
  font-family: var(--font-mark-en);
  font-size: 22px;
}

[data-lang="tc"] .brand-title {
  font-family: var(--font-mark-tc);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.btn-share {
  background: var(--share);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  height: 40px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  flex: none;
  white-space: nowrap;
}

.share-label-long {
  display: none;
}

.share-label-short {
  display: inline;
}

@media (min-width: 1024px) {
  .share-label-long {
    display: inline;
  }
  .share-label-short {
    display: none;
  }
}

.btn-share.is-copied .share-label {
  display: none;
}

.btn-share.is-copied .share-copied {
  display: inline;
}

.btn-globe {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(19, 46, 54, 0.35);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.btn-globe svg {
  width: 22px;
  height: 22px;
}

.scallop {
  height: 18px;
  background:
    radial-gradient(circle at 10px 0, transparent 9px, #fff 10px) repeat-x;
  background-size: 20px 18px;
  background-color: var(--paper);
  margin-top: -1px;
}

.hero-band {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(19, 46, 54, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 46, 54, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  padding: 20px 16px 28px;
}

.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 16px;
  align-items: center;
}

@media (min-width: 1024px) {
  .hero-inner.split {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.speech {
  background: #fff;
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
}

.speech h1 {
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.25;
  color: var(--ink);
}

.speech p {
  margin: 0;
  color: var(--body-soft);
  font-size: 15px;
}

.hero-art {
  justify-self: center;
  width: min(100%, 520px);
}

.page-body {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.mode-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 1024px) {
  .mode-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
}

.mode-card h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 22px;
}

.mode-card p {
  margin: 0;
  flex: 1;
  color: var(--body-soft);
  font-size: 14px;
}

.mode-icon {
  width: 72px;
  height: 72px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--cta);
  color: var(--cta-ink);
}

.btn-outline {
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
}

.btn-outline:hover:not(:disabled) {
  background: var(--outline-hover);
}

.btn-block {
  width: 100%;
}

.btn-copy {
  background: var(--share);
  color: #fff;
  border-radius: var(--radius-btn);
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--body-soft);
  margin: 28px 16px 12px;
}

.site-footer {
  background: var(--cta);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-top: auto;
}

.null-logo {
  width: 36px;
  height: 36px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

/* Language popover */
.lang-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(19, 46, 54, 0.25);
  z-index: 50;
}

.lang-popover {
  position: fixed;
  top: 64px;
  right: 12px;
  width: min(220px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: var(--shadow);
  z-index: 60;
  padding: 10px;
}

.lang-popover header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}

.lang-popover button.close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: #fff;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 2px;
  text-align: left;
}

.lang-option[aria-checked="true"] {
  background: var(--lang-active);
}

/* Setup */
.setup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.setup-head h1 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 28px;
}

.callout {
  background: #fff;
  border: 1px solid rgba(19, 46, 54, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--body-soft);
  margin: 12px 0 20px;
}

.participant-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid rgba(19, 46, 54, 0.12);
}

.participant-card .bar {
  background: var(--cta);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.participant-card .bar button {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
}

.participant-card .fields {
  padding: 14px;
  display: grid;
  gap: 12px;
}

label.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

label.field input,
label.field textarea,
label.field select {
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  background: #fff;
  font-weight: 400;
}

label.field textarea {
  min-height: 72px;
  resize: vertical;
}

.actions-stack {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.error-box {
  background: #fff;
  border: 1px solid var(--bright-red);
  color: var(--cta);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 12px 0;
}

.status-box {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 0;
}

/* Share URL */
.url-row {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.url-row input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  background: #fff;
}

@media (min-width: 1024px) {
  /* Official desktop: hug-content pills; copy-link sits beside the field. */
  .btn-block {
    width: auto;
  }

  .actions-stack {
    justify-items: start;
  }

  .url-row {
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 12px;
  }

  .url-row .field {
    grid-column: 1;
  }

  .url-row .btn-copy {
    width: auto;
    white-space: nowrap;
    min-height: 48px;
    padding: 0 18px;
  }
}

/* Name buttons */
.name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 1024px) {
  .name-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.name-btn {
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  padding: 16px 12px;
  cursor: pointer;
  text-align: left;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.name-btn .nm {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
}

.name-btn .st {
  font-size: 13px;
  color: var(--body-soft);
}

.name-btn[data-state="deactivated"] {
  background: var(--steel);
  color: #fff;
  border-color: var(--steel);
  cursor: not-allowed;
}

.name-btn[data-state="deactivated"] .st {
  color: rgba(255, 255, 255, 0.9);
}

/* Result card */
.result-card {
  background: #fff;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 16px 0;
}

.result-card .eyebrow {
  font-size: 14px;
  color: var(--body-soft);
  margin: 0 0 4px;
}

.result-card .who {
  font-family: var(--font-title);
  font-size: clamp(32px, 6vw, 44px);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-card .bear {
  width: 64px;
  height: 64px;
  background: #beccd2;
  border-radius: 8px;
  padding: 6px;
  flex: none;
}

.wishlist-box {
  margin-top: 16px;
  border: 1px solid rgba(19, 46, 54, 0.3);
  border-radius: 8px;
  padding: 12px;
}

.wishlist-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.helper {
  font-size: 13px;
  color: var(--body-soft);
  margin: 12px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

[hidden] {
  display: none !important;
}
