:root {
  --bg: #0f1720;
  --panel: #18222e;
  --panel-2: #1f2b39;
  --line: #2a394a;
  --text: #e6edf3;
  --muted: #8b9bab;
  --accent: #f5a524;
  --accent-ink: #1a1200;
  --error: #ff7b72;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.top {
  padding: 18px 16px 6px;
}
.top h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
}

main {
  padding: 8px 16px 32px;
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- search ---------- */

.search {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  background: var(--bg);
}
.search input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: 600 1.15rem/1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.search input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  font-family: system-ui, sans-serif;
  font-weight: 400;
  color: var(--muted);
}
.search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.search button {
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.search button:disabled { opacity: .6; cursor: progress; }

/* ---------- result card ---------- */

.result {
  margin-top: 8px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.result.error {
  border-color: color-mix(in srgb, var(--error) 50%, var(--line));
  color: var(--error);
}
.result .call {
  font: 700 1.6rem/1.1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .05em;
  color: var(--accent);
  margin: 0;
}
.result .name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 6px 0 0;
}
.result .nick { color: var(--muted); font-weight: 400; }
.result address {
  font-style: normal;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  white-space: pre-line;
}
.result .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.chip {
  font-size: .8rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
}
.result .photo {
  float: right;
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 10px;
  margin-left: 12px;
}
.muted { color: var(--muted); }

/* ---------- history ---------- */

.history h2 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 28px 0 8px;
}
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.history-list:empty { display: none; }
.history-list li + li { border-top: 1px solid var(--line); }
.history-list button {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "call date"
    "who  who";
  gap: 2px 12px;
  padding: 12px 14px;
  background: var(--panel);
  cursor: pointer;
}
.history-list button:hover,
.history-list button:focus-visible { background: var(--panel-2); }
.h-call {
  grid-area: call;
  font: 700 1rem ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: .04em;
  color: var(--accent);
}
.h-date { grid-area: date; justify-self: end; font-size: .8rem; color: var(--muted); }
.h-who {
  grid-area: who;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.h-who .muted { font-style: italic; }

/* Wider screens: one row per entry */
@media (min-width: 560px) {
  .history-list button {
    grid-template-columns: 7.5rem 1fr auto;
    grid-template-areas: "call who date";
    align-items: center;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
