:root {
  --navy: #0a2749;
  --navy-2: #123e70;
  --blue: #256fe8;
  --blue-soft: #eaf3ff;
  --green: #14765a;
  --green-soft: #e9f8f1;
  --amber: #8a5c00;
  --amber-soft: #fff7df;
  --red: #bd4050;
  --red-soft: #fff0f2;
  --text: #14283f;
  --muted: #64778b;
  --line: #d9e4ef;
  --surface: #ffffff;
  --bg: #edf5ff;
  --shadow: 0 24px 70px rgba(31, 71, 119, .14);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(37,111,232,.12), transparent 28rem),
    radial-gradient(circle at 88% 82%, rgba(65,183,205,.10), transparent 24rem),
    linear-gradient(180deg, #edf5ff, #f8fbff);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

img,
svg { display: block; }

button { border: 0; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 50;
  padding: 9px 12px;
  border-radius: 10px;
  color: #fff;
  background: var(--navy);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.page-shell {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 18px;
}

.app-card {
  position: relative;
  width: min(100%, 760px);
  overflow: hidden;
  border: 1px solid rgba(186, 207, 231, .9);
  border-radius: 28px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}

.app-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 220px;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(233,244,255,.95), rgba(255,255,255,.7)),
    radial-gradient(circle at 82% 20%, rgba(37,111,232,.13), transparent 15rem);
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(214, 226, 239, .9);
}

.government-logo {
  width: 40px;
  height: 50px;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.brand-copy span {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.brand-copy strong {
  color: var(--navy);
  font-size: .98rem;
  line-height: 1.2;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: .72rem;
  font-weight: 850;
}

.status-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.main-content {
  position: relative;
  padding: 34px 36px 22px;
}

.intro {
  max-width: 560px;
  margin: 0 auto 22px;
  text-align: center;
}

.intro h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.2rem, 6vw, 3.7rem);
  line-height: .98;
  letter-spacing: -.05em;
}

.intro h1 span { color: var(--blue); }

.intro > p:last-child {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.5;
}

.search-panel {
  max-width: 590px;
  margin: 0 auto;
}

.lookup-form {
  display: grid;
  gap: 13px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.label-row label {
  color: var(--text);
  font-size: .82rem;
  font-weight: 800;
}

#nik-count {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.input-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 60px;
  border: 1.5px solid #cbd9e8;
  border-radius: 16px;
  background: #fbfdff;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.input-shell:focus-within {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37,111,232,.10);
}

.input-shell.is-complete {
  border-color: #8ed1b8;
  background: #fbfffd;
}

.input-shell.is-invalid {
  border-color: #e8a0aa;
  background: #fffafb;
}

.input-icon {
  width: 21px;
  height: 21px;
  margin-left: 17px;
  fill: #75879a;
}

.input-shell:focus-within .input-icon { fill: var(--blue); }

#nik {
  width: 100%;
  height: 58px;
  min-width: 0;
  padding: 0 16px 0 12px;
  border: 0;
  outline: 0;
  color: var(--navy);
  background: transparent;
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: .07em;
}

#nik::placeholder {
  color: #a1afbd;
  font-size: .93rem;
  font-weight: 500;
  letter-spacing: 0;
}

.field-meta {
  min-height: 18px;
  margin-top: 5px;
}

.field-meta p {
  margin: 0;
  font-size: .72rem;
  line-height: 1.4;
}

#nik-help { color: var(--muted); }

.field-error {
  color: var(--red);
  font-weight: 700;
}

.field-error:not(:empty) { margin-top: 3px; }

.honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.primary-button {
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #1764db, #2f7cf0);
  box-shadow: 0 14px 28px rgba(37,111,232,.22);
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 17px 34px rgba(37,111,232,.28);
}

.primary-button:focus-visible,
.result-reset:focus-visible {
  outline: 3px solid rgba(37,111,232,.26);
  outline-offset: 3px;
}

.primary-button:disabled {
  cursor: wait;
  opacity: .72;
}

.primary-button svg { fill: currentColor; }

.button-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.primary-button.is-loading svg { display: none; }
.primary-button.is-loading .button-spinner { display: block; }

#result-anchor {
  width: 1px;
  height: 1px;
  outline: none;
}

.result-card {
  margin-top: 14px;
  overflow: hidden;
  border-radius: 17px;
  background: #f8fbff;
  animation: result-in .22s ease-out both;
}

.result-card[hidden] { display: none; }

.result-success {
  border: 1px solid #bde2d4;
  background: linear-gradient(180deg, #f0fbf6, #fbfffd);
}

.result-not-found {
  border: 1px solid #ecdca5;
  background: linear-gradient(180deg, #fff9e8, #fffdfa);
}

.result-error {
  border: 1px solid #efc4ca;
  background: linear-gradient(180deg, #fff4f5, #fffafa);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.result-title-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.result-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
}

.result-success .result-symbol { color: var(--green); background: var(--green-soft); }
.result-not-found .result-symbol { color: var(--amber); background: var(--amber-soft); }
.result-error .result-symbol { color: var(--red); background: var(--red-soft); }

.result-symbol svg { width: 18px; height: 18px; fill: currentColor; }

.result-kicker {
  display: none;
}

.result-header h3 {
  margin: 0;
  color: var(--navy);
  font-size: .92rem;
  line-height: 1.25;
}

.status-pill {
  flex: 0 0 auto;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: .67rem;
  font-weight: 850;
}

.result-success .status-pill { color: var(--green); background: var(--green-soft); }
.result-not-found .status-pill { color: var(--amber); background: var(--amber-soft); }
.result-error .status-pill { color: var(--red); background: var(--red-soft); }

.voter-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin: 0 14px 10px;
  padding: 12px 13px;
  border-radius: 13px;
  background: rgba(255,255,255,.78);
}

.voter-name-label,
.data-label {
  display: block;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.voter-name {
  display: block;
  margin-top: 3px;
  color: var(--navy);
  font-size: .98rem;
  font-weight: 900;
  line-height: 1.25;
}

.tps-badge {
  display: grid;
  min-width: 64px;
  min-height: 42px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-2), var(--blue));
  font-size: .9rem;
  font-weight: 900;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 14px 10px;
}

.data-cell {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(255,255,255,.72);
}

.data-value {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: .83rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-message {
  margin: 0;
  padding: 0 15px 10px;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.45;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 14px 13px;
}

.result-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #cbd9e8;
  border-radius: 10px;
  color: var(--navy-2);
  background: #fff;
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}

.result-reset svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.mini-note {
  max-width: 590px;
  margin: 13px auto 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
  text-align: center;
}

.site-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid #e1e9f1;
  color: #8291a1;
  font-size: .76rem;
  text-align: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 10px;
  }

  .app-card {
    border-radius: 22px;
  }

  .topbar {
    gap: 10px;
    padding: 13px 15px;
  }

  .government-logo {
    width: 34px;
    height: 43px;
  }

  .brand-copy span {
    font-size: .61rem;
  }

  .brand-copy strong {
    font-size: .9rem;
  }

  .status-dot {
    padding: 6px 8px;
    font-size: .65rem;
  }

  .main-content {
    padding: 25px 17px 17px;
  }

  .intro {
    margin-bottom: 18px;
  }

  .intro h1 {
    font-size: clamp(2.15rem, 12vw, 3rem);
  }

  .intro > p:last-child {
    margin-top: 10px;
    font-size: .84rem;
  }

  .input-shell {
    min-height: 56px;
    border-radius: 14px;
  }

  #nik {
    height: 54px;
    font-size: .98rem;
  }

  .primary-button {
    min-height: 54px;
    border-radius: 14px;
  }

  .mini-note {
    margin-top: 11px;
    font-size: .73rem;
  }

  .site-footer {
    padding: 10px 14px 12px;
    font-size: .7rem;
  }
}

@media (max-width: 420px) {
  .page-shell {
    place-items: center;
    padding: 8px;
  }

  .app-card {
    border-radius: 20px;
  }

  .topbar {
    padding: 11px 13px;
  }

  .government-logo {
    width: 30px;
    height: 38px;
  }

  .status-dot {
    padding: 5px 7px;
  }

  .main-content {
    padding: 21px 13px 14px;
  }

  .intro {
    margin-bottom: 15px;
  }

  .intro h1 {
    font-size: 2.35rem;
  }

  .intro > p:last-child {
    max-width: 310px;
    margin-inline: auto;
    font-size: .8rem;
  }

  .label-row {
    margin-bottom: 6px;
  }

  .input-shell {
    min-height: 53px;
  }

  #nik {
    height: 51px;
    padding-right: 10px;
    font-size: .91rem;
    letter-spacing: .05em;
  }

  #nik::placeholder {
    font-size: .82rem;
  }

  .input-icon {
    width: 19px;
    height: 19px;
    margin-left: 13px;
  }

  .primary-button {
    min-height: 51px;
    font-size: .88rem;
  }

  .result-header {
    padding: 11px 12px 8px;
  }

  .result-header h3 {
    font-size: .84rem;
  }

  .voter-summary {
    margin: 0 11px 8px;
    padding: 10px 11px;
  }

  .voter-name {
    font-size: .9rem;
  }

  .tps-badge {
    min-height: 38px;
    min-width: 58px;
    font-size: .82rem;
  }

  .data-grid {
    gap: 6px;
    margin: 0 11px 8px;
  }

  .data-cell {
    padding: 8px 9px;
  }

  .result-message {
    padding: 0 12px 8px;
    font-size: .68rem;
  }

  .result-actions {
    padding: 0 11px 10px;
  }

  .mini-note {
    max-width: 320px;
    margin-top: 9px;
  }

  .site-footer {
    padding: 9px 13px 10px;
  }
}

@media (max-height: 700px) and (min-width: 721px) {
  .page-shell { padding: 10px; }
  .topbar { padding-block: 13px; }
  .main-content { padding-block: 22px 16px; }
  .intro { margin-bottom: 17px; }
  .intro h1 { font-size: 2.7rem; }
  .intro > p:last-child { margin-top: 9px; }
  .site-footer { padding-block: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
