:root {
  --bg: #0e1014;
  --bg-card: #13151a;
  --bg-card-hover: #181b21;
  --text: #e8e6e1;
  --subtle: #b1b0ad;
  --muted: #7c7d80;
  --border: #1d1f25;
  --border-strong: #292c34;
  --accent: #7ec3b6;
  --accent-faded: rgba(126, 195, 182, 0.10);
  --err: #e8918c;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "IBM Plex Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfaf6;
    --bg-card: #f4f1ea;
    --bg-card-hover: #ede9df;
    --text: #1a1c1f;
    --subtle: #4a4b4e;
    --muted: #6c6d71;
    --border: #e8e5dd;
    --border-strong: #d6d2c8;
    --accent: #1f6e60;
    --accent-faded: rgba(31, 110, 96, 0.07);
    --err: #a4291e;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  width: 100%;
  max-width: 780px;
}

header { text-align: center; margin-bottom: 1.5rem; }
h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.grid {
  display: grid;
  gap: 0.6rem;
  width: 100%;
  max-width: 780px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .btn-all { grid-column: 1 / -1; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  transition: background 0.15s, border-color 0.15s;
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.card-actions { display: flex; gap: 0.25rem; }

h2 {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.desc {
  font-size: 0.65rem;
  color: var(--subtle);
  margin-top: 0.3rem;
}

.value {
  display: block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
  min-height: 1.4em;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  transition: background 0.3s;
  user-select: all;
}
.value.flash { background: var(--accent-faded); }

button {
  font-family: var(--sans);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
button:active { transform: scale(0.96); }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-icon {
  min-width: 32px;
  min-height: 32px;
  padding: 0.3rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
.icon-refresh.spinning { animation: spin 0.4s ease-in-out; }

.btn-all {
  padding: 0.55rem 1.2rem;
  min-height: 40px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.btn-all:hover {
  background: var(--accent-faded);
  border-color: var(--accent);
  color: var(--accent);
}

.about {
  margin-top: 1.5rem;
  max-width: 780px;
  width: 100%;
}
.about summary {
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
  text-align: center;
}
.about summary:hover { color: var(--text); }
.about summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.about dl {
  margin-top: 1rem;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .about dl { grid-template-columns: 1fr 1fr; column-gap: 1.8rem; }
}
.about .def dt {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--accent-faded);
  position: relative;
}
.about .def dt::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2rem;
  height: 1px;
  background: var(--accent);
}
.about .def dd {
  font-size: 0.72rem;
  color: var(--subtle);
  line-height: 1.65;
}

footer {
  margin-top: 2rem;
  max-width: 780px;
  width: 100%;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}
footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 2px;
}
footer a:hover { border-bottom-color: var(--accent); }
footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
footer .cross-link { margin-bottom: 1rem; }
footer .api-hint { margin-bottom: 0.6rem; }
footer .credit { margin-top: 1rem; }
footer .heart { color: var(--err); }
footer pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  margin: 0 auto 0.8rem;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  text-align: left;
}
footer pre code {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--subtle);
  white-space: pre;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  max-width: 90vw;
  transform: translateX(-50%) translateY(0.5rem);
  background: var(--bg-card);
  color: var(--text);
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}
