:root {
  color-scheme: light;
  --paper: #f5ede3;
  --paper-deep: #ecdfd0;
  --ink: #4a2b20;
  --muted: #77716e;
  --burgundy: #7f1f22;
  --burgundy-dark: #67161a;
  --gold: #c89a50;
  --gold-soft: rgba(200, 154, 80, 0.2);
  --line: rgba(101, 45, 37, 0.72);
  --result-panel: rgba(229, 214, 198, 0.72);
  --danger: #a52421;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(92deg, rgba(255, 255, 255, 0.22), transparent 30%, rgba(112, 74, 46, 0.03) 68%, transparent),
    repeating-linear-gradient(4deg, rgba(116, 82, 54, 0.018) 0 1px, transparent 1px 5px);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 28px 36px;
  overflow: hidden;
}

.page-actions {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
}

.page-actions .back-icon-button {
  grid-column: 1;
  justify-self: start;
}

.page-actions .wedding-logo {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
}

.page-actions .lang-button {
  grid-column: 3;
  justify-self: end;
}

body.result-active .lang-button {
  display: none;
}

.wedding-logo {
  display: block;
  width: 120px;
  max-height: 120px;
  height: auto;
  object-fit: contain;
}

.lang-button,
.back-icon-button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(101, 45, 37, 0.72);
  border-radius: 5px;
  color: var(--burgundy);
  background: rgba(245, 237, 227, 0.6);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10.5px;
  font-weight: 700;
}

.back-icon-button {
  font-family: Arial, sans-serif;
  font-size: 19px;
  line-height: 1;
}

.back-icon-button span {
  display: block;
  transform: translateY(-1px);
}

.wedding-knot {
  display: none;
}

.knot-loop {
  position: absolute;
  top: 0;
  right: -4px;
  width: 100px;
  height: 76px;
  border-top: 2px solid currentColor;
  border-radius: 55% 70% 0 0;
  transform: rotate(10deg);
}

.knot-loop::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 40px;
  width: 54px;
  height: 44px;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  transform: rotate(18deg);
}

.knot-body {
  position: absolute;
  top: 75px;
  right: 23px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  transform: rotate(45deg);
  font-family: Georgia, serif;
  font-size: 35px;
  line-height: 1;
}

.knot-body::before,
.knot-body::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid currentColor;
}

.knot-body::after {
  inset: 14px -9px;
}

.knot-tassel {
  position: absolute;
  top: 126px;
  right: 45px;
  width: 2px;
  height: 78px;
  background: currentColor;
}

.knot-tassel::before,
.knot-tassel::after {
  content: "";
  position: absolute;
  top: 17px;
  width: 2px;
  height: 66px;
  background: currentColor;
}

.knot-tassel::before {
  left: -8px;
  transform: rotate(7deg);
}

.knot-tassel::after {
  right: -8px;
  transform: rotate(-7deg);
}

.wedding-heading {
  position: relative;
  z-index: 2;
  margin: 140px 0 42px;
  text-align: center;
}

.wedding-heading p {
  margin: 0 0 28px;
  color: var(--burgundy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  letter-spacing: 1px;
}

.wedding-heading strong {
  display: block;
  color: var(--burgundy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 48px;
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: 0;
}

.view {
  position: relative;
  z-index: 2;
}

.search-panel,
.message-panel,
.results,
.map-section {
  padding: 0;
  border: 0;
  background: transparent;
}

#lookupTitle {
  margin: 0;
  color: var(--burgundy);
  font-size: 24px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
  white-space: pre-line;
}

form {
  display: grid;
}

#queryValue,
#phoneLast4 {
  width: 100%;
  min-height: 66px;
  margin: 28px 0 18px;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font-size: 22px;
  text-align: center;
}

#queryValue::placeholder,
#phoneLast4::placeholder {
  color: #85807d;
  opacity: 1;
}

#queryValue:focus,
#phoneLast4:focus {
  outline: none;
  box-shadow: none;
}

#queryValue + #phoneLast4 {
  margin-top: 10px;
}

button:focus-visible {
  outline: 2px solid rgba(127, 31, 34, 0.18);
  outline-offset: 3px;
}

.field-hint,
.assist-note {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.field-hint {
  text-align: center;
}

.primary-button {
  min-height: 66px;
  margin-top: 24px;
  border: 0;
  border-radius: 12px;
  color: #f8e7cc;
  background: var(--burgundy);
  box-shadow: inset 0 -10px 25px rgba(74, 8, 14, 0.18);
  font-size: 25px;
  font-weight: 800;
}

.primary-button:active {
  background: var(--burgundy-dark);
}

.primary-button:disabled {
  opacity: 0.68;
}

.message-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding: 16px 18px;
  line-height: 1.6;
}

.message-panel::before {
  content: "!";
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.message-panel.error {
  color: var(--danger);
}

.message-panel.info {
  color: var(--ink);
}

.result-view .results {
  margin-top: 0;
}

.results-header > div {
  width: 100%;
}

#resultTitle {
  margin: 0 0 30px;
  color: var(--burgundy);
  font-size: 25px;
  line-height: 1.4;
  font-weight: 800;
  text-align: center;
}

.match-list {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
}

.match-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  min-height: 94px;
  padding: 18px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--result-panel);
}

.match-name {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  white-space: pre-line;
}

.match-table {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  padding: 8px;
  border-radius: 50%;
  color: #fff8ef;
  background: var(--burgundy);
  text-align: center;
  font-size: 22px;
  font-weight: 900;
}

.result-view .assist-note {
  padding: 0 20px;
  text-align: center;
}

.map-section {
  margin-top: 46px;
}

.map-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  aspect-ratio: 4 / 3;
}

.map-frame img,
.map-frame svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.highlight-gap {
  fill: none;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 10;
}

.highlight-ring {
  fill: none;
  stroke: var(--gold);
  stroke-width: 10;
  stroke-opacity: 0.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: table-highlight-breathe 1.8s ease-in-out infinite;
}

@keyframes table-highlight-breathe {
  0%,
  100% {
    stroke-opacity: 0.5;
    stroke-width: 8;
    transform: scale(0.96);
    filter: drop-shadow(0 0 2px rgba(200, 154, 80, 0.45));
  }

  50% {
    stroke-opacity: 1;
    stroke-width: 13;
    transform: scale(1.05);
    filter: drop-shadow(0 0 7px rgba(200, 154, 80, 0.95));
  }
}

@media (prefers-reduced-motion: reduce) {
  .highlight-ring {
    animation: none;
    fill: none;
    stroke: var(--gold);
    stroke-opacity: 1;
    stroke-width: 10;
    transform: none;
    filter: none;
  }
}

footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-top: 70px;
  color: rgba(74, 43, 32, 0.62);
  font-size: 11px;
}

footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.privacy-page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 32px 28px 48px;
}

.privacy-page header {
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(101, 45, 37, 0.22);
}

.privacy-page h1,
.privacy-page h2 {
  color: var(--burgundy);
  font-family: Georgia, "Times New Roman", serif;
}

.privacy-page h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 42px);
}

.privacy-page h2 {
  margin: 34px 0 12px;
  font-size: 22px;
}

.privacy-page p,
.privacy-page li {
  font-size: 15px;
  line-height: 1.8;
}

.privacy-page ul {
  padding-left: 22px;
}

.privacy-page .privacy-meta {
  color: var(--muted);
}

.privacy-page .privacy-back {
  display: inline-block;
  margin-top: 36px;
  color: var(--burgundy);
}

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

@media (max-width: 430px) {
  .app-shell {
    padding: 24px 22px 32px;
  }

  .page-actions .wedding-logo {
    width: 160px;
    max-height: 160px;
  }

  .wedding-knot {
    right: -25px;
    transform: scale(0.88);
    transform-origin: top right;
  }

  .wedding-heading {
    margin-top: 170px;
    margin-bottom: 40px;
  }

  .wedding-heading p {
    font-size: 12px;
  }

  .wedding-heading strong {
    font-size: 40px;
  }

  #lookupTitle {
    font-size: 21px;
  }

  #queryValue,
  #phoneLast4 {
    font-size: 19px;
  }

  .field-hint,
  .assist-note {
    font-size: 14px;
  }

  .primary-button {
    min-height: 60px;
    font-size: 22px;
  }

  #resultTitle {
    margin-bottom: 24px;
    font-size: 22px;
  }

  .match-card {
    min-height: 86px;
    padding: 16px;
  }

  .match-name {
    font-size: 18px;
  }

  .match-table {
    width: 78px;
    height: 78px;
    padding: 8px;
    font-size: 20px;
  }

  .map-section {
    margin-top: 28px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-inline: 17px;
  }

  .wedding-heading strong {
    font-size: 35px;
  }

  #lookupTitle {
    font-size: 19px;
  }

  .match-name {
    font-size: 16px;
  }

  .match-table {
    width: 72px;
    height: 72px;
    font-size: 18px;
  }
}
