:root {
  color-scheme: light;
  --bg: #edf6f4;
  --bg-strong: #d8ece9;
  --ink: #112a37;
  --muted: #5a6d77;
  --line: rgba(17, 42, 55, 0.14);
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --accent: #0f766e;
  --accent-deep: #0b5f5a;
  --accent-soft: #d6f4ee;
  --warn: #b42318;
  --shadow: 0 18px 50px rgba(21, 52, 68, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, "Avenir Next", "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 38%),
    linear-gradient(165deg, var(--bg), var(--bg-strong));
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: max(26px, env(safe-area-inset-top)) 0 max(26px, env(safe-area-inset-bottom));
}

.unlock-view {
  min-height: calc(100vh - 52px);
  display: grid;
  align-content: center;
  justify-items: start;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.45rem;
  background: linear-gradient(145deg, var(--accent), #123f54);
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.25);
}

h1 {
  margin: 18px 0 0;
  font-size: 2.1rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.subtitle,
.fineprint,
.meta,
.status {
  color: var(--muted);
}

.subtitle {
  max-width: 34rem;
  margin: 10px 0 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.pin-form {
  width: min(100%, 420px);
  margin-top: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.pin-form label,
.search-panel label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.pin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.pin-row input,
.search-panel input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(17, 42, 55, 0.22);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.pin-row input:focus,
.search-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.pin-row button,
.lock-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}

.pin-row button:hover,
.lock-button:hover {
  background: var(--accent-deep);
}

.pin-row button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.form-error {
  min-height: 1.3em;
  margin: 10px 0 0;
  color: var(--warn);
  font-size: 0.94rem;
  font-weight: 700;
}

.fineprint {
  max-width: 32rem;
  margin: 18px 0 0;
  font-size: 0.9rem;
}

.app-view {
  display: grid;
  gap: 14px;
}

.app-header,
.search-panel,
.alpha-nav,
.results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(21, 52, 68, 0.09);
}

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

.app-header h1 {
  margin: 0;
  font-size: 1.75rem;
}

.meta {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

.search-panel {
  padding: 16px 18px;
}

.status {
  min-height: 1.25em;
  margin: 10px 0 0;
  font-size: 0.94rem;
}

.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

.alpha-nav a {
  min-width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  text-decoration: none;
  font-weight: 800;
}

.alpha-nav a:hover,
.alpha-nav a:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.results {
  overflow: hidden;
}

.list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.letter-group {
  scroll-margin-top: 12px;
}

.letter-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(17, 42, 55, 0.08);
  color: var(--accent-deep);
  background: rgba(214, 244, 238, 0.68);
  font-size: 1rem;
  letter-spacing: 0;
}

.letter-title a {
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
}

.letter-title a:hover,
.letter-title a:focus {
  text-decoration: underline;
}

.row-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(17, 42, 55, 0.08);
}

.row:last-child {
  border-bottom: 0;
}

.name {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-weight: 700;
}

.pager {
  min-width: 72px;
  padding: 5px 10px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  text-align: center;
  font-weight: 900;
}

@media (max-width: 640px) {
  .shell {
    width: calc(100vw - 20px);
  }

  .pin-row {
    grid-template-columns: 1fr;
  }

  .pin-row button {
    width: 100%;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .lock-button {
    width: 100%;
  }

  .row,
  .list-head,
  .letter-title {
    padding-left: 12px;
    padding-right: 12px;
  }
}
