:root {
  --bg: #f3f2fa;
  --surface: #ffffff;
  --surface-2: #f6f5fd;
  --ink: #1b1938;
  --muted: #6f6c8f;
  --line: #e2e0f2;
  --accent: #5b45f0;
  --accent-ink: #ffffff;
  --tint: #ebe8ff;
  --ok: #12805a;
  --mark: #ffe58a;
  --shadow:
    0 1px 2px rgba(27, 25, 56, 0.06), 0 8px 24px -12px rgba(27, 25, 56, 0.18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f1f;
    --surface: #161831;
    --surface-2: #1c1f3b;
    --ink: #ecebff;
    --muted: #8e8bb5;
    --line: #272a4d;
    --accent: #8f7dff;
    --accent-ink: #0e0f1f;
    --tint: #25244d;
    --ok: #5ee0b0;
    --mark: #ffe58a;
    --shadow:
      0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Sora",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 5rem;
}

.head h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.sub {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.sub .arrow {
  display: inline-block;
  margin: 0 0.15rem;
  vertical-align: -3px;
  color: var(--accent);
}

.search {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  display: flex;
  align-items: center;
  margin: 2rem 0 0;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px var(--tint),
    var(--shadow);
}

.search-icon {
  flex-shrink: 0;
  margin-left: 1rem;
  color: var(--muted);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 3.25rem;
  padding: 0 0.85rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search input::placeholder {
  color: var(--muted);
}
.search input::-webkit-search-cancel-button {
  display: none;
}

.kbd {
  margin-right: 0.85rem;
  padding: 0.1rem 0.5rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.search:focus-within .kbd {
  visibility: hidden;
}

.count {
  margin: 1.1rem 0.25rem 0.6rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.8rem 0.8rem 0.8rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  transition:
    border-color 0.15s,
    background-color 0.15s;
}

.item:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.body {
  min-width: 0;
}

.name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.code {
  margin: 0.2rem 0 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-shrink: 0;
  width: 6.6rem;
  height: 2.6rem;
  padding: 0;
  white-space: nowrap;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background-color 0.15s,
    transform 0.1s,
    filter 0.15s;
}

.copy:hover {
  filter: brightness(1.1);
}
.copy:active {
  transform: scale(0.95);
}

.copy:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.copy.done {
  background: var(--ok);
  color: #fff;
}

.copy svg {
  flex-shrink: 0;
}

mark {
  padding: 0 2px;
  color: #1b1938;
  background: var(--mark);
  border-radius: 3px;
}

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

.empty p {
  margin: 0;
}

.empty-title {
  margin-bottom: 0.25rem !important;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  padding: 0.75rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 1rem);
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 480px) {
  .wrap {
    padding-top: 2.25rem;
  }
  .item {
    gap: 0.7rem;
    padding: 0.7rem 0.7rem 0.7rem 1rem;
  }
  .copy {
    width: 2.6rem;
  }
  .copy .label {
    display: none;
  }
  .kbd {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
