:root {
  --bg: #edf3f8;
  --panel: rgba(255, 255, 255, .92);
  --line: #d8e2ec;
  --text: #142033;
  --muted: #65758a;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .16), rgba(22, 163, 74, .12)),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

button, input {
  font: inherit;
  border-radius: 8px;
}

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

.query-card {
  width: min(760px, 100%);
  background: var(--panel);
  border: 1px solid rgba(216, 226, 236, .9);
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .14);
  padding: 26px;
  animation: cardIn .28s ease-out;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand > img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .22);
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

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

input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  padding: 13px 14px;
  background: #fff;
  font-size: 16px;
  font-weight: 800;
}

button {
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 13px 22px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .2);
}

button:active { transform: translateY(1px); }
button:disabled {
  cursor: wait;
  opacity: .78;
}

button.loading span::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin .8s linear infinite;
}

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

.result-empty i {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--blue);
  border-radius: 50%;
  vertical-align: -4px;
  animation: spin .8s linear infinite;
}

.result-empty {
  margin-top: 16px;
  border: 1px dashed #bdc9d8;
  background: rgba(248, 250, 252, .8);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.result-error {
  border-color: rgba(220, 38, 38, .35);
  background: rgba(254, 242, 242, .95);
  color: var(--red);
}

.result-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  animation: resultIn .2s ease-out;
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid #e7edf4;
}

.result-head span,
.info-grid span,
.time-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.result-head strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  word-break: break-all;
}

.copyable {
  cursor: pointer;
  user-select: all;
}

.copyable:hover {
  text-decoration: underline;
}

mark {
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
  font-weight: 900;
}

mark.unused { background: #e0f2fe; color: #0369a1; }
mark.used { background: #dcfce7; color: #15803d; }
mark.frozen { background: #fef3c7; color: #b45309; }
mark.blacklisted { background: #fee2e2; color: #b91c1c; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: #e7edf4;
}

.info-grid article {
  min-width: 0;
  background: #f8fafc;
  padding: 15px;
}

.info-grid strong,
.time-row strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  word-break: break-word;
}

.time-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

@media (max-width: 720px) {
  .query-shell {
    align-items: start;
    padding: 12px;
  }
  .query-card {
    margin-top: 8vh;
    padding: 18px;
    border-radius: 8px;
  }
  .brand { align-items: flex-start; }
  .brand > img {
    width: 48px;
    height: 48px;
  }
  h1 { font-size: 21px; }
  p { font-size: 13px; }
  .query-form,
  .info-grid,
  .time-row {
    grid-template-columns: 1fr;
  }
  input, button {
    min-height: 48px;
  }
  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
