:root {
  --bg: #fafafa;
  --card-bg: #ffffff;
  --text: #171717;
  --text-muted: #737373;
  --text-tertiary: #a3a3a3;
  --accent: #0f766e;
  --accent-hover: #0d5d57;
  --border: rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'Outfit', system-ui, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Menlo', 'Consolas', monospace;
}

html.dark {
  --bg: #0f0f0f;
  --card-bg: #1a1a1a;
  --text: #e5e5e5;
  --text-muted: #a3a3a3;
  --text-tertiary: #737373;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --border: rgba(255, 255, 255, 0.08);
}

html.dark .card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

html.dark .btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

html.dark .copied-tooltip {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 40px 32px 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.header-text {
  flex: 1;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.search-input {
  width: 140px;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  transition: width 0.2s ease, border-color 0.15s ease;
}

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

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  width: 180px;
}

.btn-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-theme:hover {
  color: var(--text);
  background: var(--bg);
}

.btn-theme .icon-sun {
  display: none;
}

html.dark .btn-theme .icon-moon {
  display: none;
}

html.dark .btn-theme .icon-sun {
  display: block;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.btn-regen-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--text);
  color: var(--card-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.btn-regen-all:hover {
  background: var(--accent);
}

.btn-regen-all:active {
  opacity: 0.9;
}

/* Main */

.main {
  flex: 1;
  padding: 0 32px 48px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.category-section {
  margin-bottom: 32px;
}

.category-section:last-child {
  margin-bottom: 0;
}

.category-heading {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding: 0 2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

/* Card */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
  min-width: 0;
}

.card-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.btn-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-icon:active {
  transform: scale(0.95);
}

.copied-tooltip {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%) scale(0.96);
  background: var(--text);
  color: var(--card-bg);
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-copy.copied .copied-tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Card value */

.card-value {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-all;
  user-select: all;
  min-height: 20px;
  max-height: 4.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.card-value-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

.card-value-row .card-value {
  flex: 1;
}

@keyframes flash {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.card-value.flash {
  animation: flash 0.2s ease-out;
}

/* Footer */

.footer {
  text-align: center;
  padding: 20px 32px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  .header {
    padding: 28px 20px 24px;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .search-input {
    width: 100%;
    order: 3;
  }

  .search-input:focus {
    width: 100%;
  }

  .main {
    padding: 0 20px 32px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .footer {
    padding: 16px 20px;
  }
}
