:root {
  color-scheme: dark;
  --background: #0a1020;
  --surface: #111a2e;
  --surface-hover: #182641;
  --border: #283957;
  --text: #f4f7ff;
  --muted: #9dadca;
  --accent: #2388ff;
  --focus: #54d7ff;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f4f7fc;
  --surface: #ffffff;
  --surface-hover: #eaf2ff;
  --border: #ccd8eb;
  --text: #142039;
  --muted: #52627e;
  --accent: #076ee2;
  --focus: #0059bc;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.picker {
  width: min(100%, 42rem);
  margin: 0 auto;
  padding: 0.75rem;
}

.picker__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.picker__header h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.picker__header p {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.picker__source {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.6875rem;
  text-underline-offset: 0.15rem;
}

.search {
  display: block;
  margin-bottom: 0.75rem;
}

.search input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

.search input:focus-visible,
.sticker:focus-visible,
.picker__source:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.search input::placeholder {
  color: var(--muted);
}

.status {
  margin: 1.5rem 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.8125rem;
}

.status[hidden] {
  display: none;
}

.stickers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.sticker {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 0.25rem;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  background: var(--surface);
  cursor: pointer;
  aspect-ratio: 1;
}

.sticker:hover {
  border-color: var(--border);
  background: var(--surface-hover);
}

.sticker:active {
  transform: translateY(1px);
}

.sticker img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 30rem) {
  .picker {
    padding: 1rem;
  }

  .stickers {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sticker:active {
    transform: none;
  }
}
