:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --teal: #155f75;
  --teal-dark: #0f5266;
  --ink: #44484b;
  --muted: #696d70;
  --line: #d9dddf;
  --danger: #c93434;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #eef4f5; }

body { margin: 0; min-width: 320px; min-height: 100svh; }

button, input { font: inherit; }

.visitor-page {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  padding: max(10px, env(safe-area-inset-top)) 16px calc(48px + env(safe-area-inset-bottom));
  background: #eef4f5 url("assets/campus-building.png") center top / cover no-repeat;
  isolation: isolate;
}

.visitor-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(8, 70, 89, .68) 0%,
    rgba(12, 79, 99, .58) 32%,
    rgba(31, 103, 122, .42) 55%,
    rgba(103, 161, 176, .22) 72%,
    rgba(238, 244, 245, .06) 100%
  );
}

.page-header { text-align: center; color: white; }

.title-image {
  display: block;
  width: min(88%, 414px);
  height: auto;
  margin: 0 auto 5px;
}

.current-time {
  display: block;
  min-height: 0;
  font-size: 19px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .01em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}

.search-card, .record-card, .denied-card {
  background: rgba(255, 255, 255, .98);
  border-radius: 13px;
}

.search-card {
  margin-top: 7px;
  padding: 18px 14px 13px;
}

.search-card h1 {
  margin: 0 0 13px;
  padding-left: 13px;
  border-left: 4px solid var(--teal);
  color: #164f61;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: .06em;
}

.input-shell { position: relative; }

#phone-input {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 40px 0 11px;
  border: 1px solid #d7d7d7;
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: #111;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .015);
  transition: border-color .16s, box-shadow .16s;
}

#phone-input::placeholder { color: #a9adaf; font-weight: 400; font-size: 14px; }
#phone-input:focus { border-color: #318399; box-shadow: 0 0 0 3px rgba(36, 116, 138, .12); }
#phone-input[aria-invalid="true"] { border-color: #d96969; }

.clear-button {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  padding: 0 0 2px;
  background: #c9ccce;
  color: white;
  font-size: 18px;
  line-height: 18px;
  font-weight: 700;
  cursor: pointer;
}

.form-message { min-height: 0; margin: 0; color: var(--danger); font-size: 13px; }
.form-message:not(:empty) { min-height: 20px; padding: 6px 2px 0; }

.search-button {
  width: 100%;
  height: 40px;
  margin-top: 14px;
  border: 0;
  border-radius: 11px;
  background: var(--teal);
  color: white;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .1em;
  cursor: pointer;
  transition: background .16s, transform .08s;
}

.search-button:active { transform: scale(.992); background: var(--teal-dark); }

.result-area { margin-top: 13px; }
.result-area[hidden], .denied-card[hidden], .clear-button[hidden] { display: none; }

.record-heading {
  display: flex;
  align-items: center;
  min-height: 29px;
  color: white;
  font-size: clamp(16px, 4.4vw, 20px);
  letter-spacing: .03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .14);
}

.record-heading strong { font-weight: 600; }
.record-heading .divider { width: 1px; height: 22px; margin: 0 12px; background: rgba(255, 255, 255, .9); }

.record-card { margin-top: 6px; padding: 18px 14px 14px; color: var(--muted); }
.record-mark { width: 5px; height: 17px; margin-bottom: 13px; background: var(--teal); }
.record-list { margin: 0; border-top: 1px solid var(--line); font-size: clamp(13px, 3.65vw, 16px); }
.record-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); column-gap: 4px; margin: 0; padding-top: 9px; line-height: 1.35; }
.record-row.first-row { padding-top: 13px; margin-bottom: 1px; }
.record-row dt, .record-row dd { margin: 0; }
.record-row dt { white-space: nowrap; }
.record-row dd { font-weight: 500; overflow-wrap: anywhere; }
.record-separator { height: 1px; margin-top: 11px; background: var(--line); }

.denied-card {
  margin-top: 18px;
  padding: 31px 20px 30px;
  text-align: center;
  box-shadow: 0 10px 35px rgba(26, 74, 86, .12);
}

.denied-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border: 3px solid var(--danger);
  border-radius: 50%;
  color: var(--danger);
  font-size: 45px;
  line-height: 47px;
  font-weight: 300;
}

.denied-card h2 { margin: 0; color: #333; font-size: 22px; }
.denied-card p { margin: 9px 0 0; color: #7b7e80; font-size: 15px; }

@media (min-width: 560px) {
  .visitor-page { width: 430px; margin: 0 auto; box-shadow: 0 0 40px rgba(0, 0, 0, .12); }
}

@media (max-width: 359px) {
  .visitor-page { padding-inline: 12px; }
  .search-card { padding-inline: 13px; }
  .record-row { grid-template-columns: 82px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
