:root {
  --bg: #f2f2f2;
  --bg-dark: #1a1a1a;
  --black: #000000;
  --white: #ffffff;
  --red: #e87070;
  --red-deep: #c94040;
  --yellow: #f5e6a3;
  --yellow-deep: #d4c47a;
  --blue: #7090c9;
  --blue-deep: #4a6aa3;
  --green: #7ab87a;
  --text: #1a1a1a;
  --text-inv: #ffffff;
  --text-dim: #666666;
  --border: #000000;
  --border-thick: 3px solid #000000;
  --border-thin: 1px solid #000000;
  --surface: #ffffff;
  --surface-hover: #f5e6a3;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--black) var(--bg);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}


.header {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  border-bottom: var(--border-thick);
  background: var(--black);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem 1.5rem;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 3px;
  line-height: 1;
}

.cursor {
  color: var(--yellow);
}

.subtitle {
  font-size: 0.8rem;
  color: #cccccc;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-left: 2px solid #555;
  padding-left: 1rem;
  font-weight: 500;
}

.header-stats {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  font-size: 0.85rem;
  gap: 1rem;
  border-left: 2px solid #333;
}

.stat {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: #dddddd;
}

.controls {
  border-bottom: var(--border-thick);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 60px;
  z-index: 99;
}

.control-row {
  display: flex;
  align-items: stretch;
  border-bottom: var(--border-thin);
}

.control-row:last-child {
  border-bottom: none;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--white);
  border-right: var(--border-thick);
  padding: 0 1rem;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.prompt {
  color: var(--red-deep);
  margin-right: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
}

.search-box input {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  padding: 0.75rem 0;
  font-weight: 500;
}

.search-box input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

.search-box:focus-within {
  background: var(--yellow);
}

.search-box:focus-within input {
  color: var(--black);
}

.search-box:focus-within .prompt {
  color: var(--black);
}

.theme-toggle {
  display: flex;
}

.theme-btn {
  background: var(--white);
  border: none;
  border-right: var(--border-thin);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.75rem 1.2rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  transition: background 0.05s, color 0.05s;
}

.theme-btn:last-child {
  border-right: none;
}

.theme-btn:hover {
  background: var(--yellow);
}

.theme-btn.active {
  background: var(--black);
  color: var(--white);
}

.filter-row {
  display: flex;
  align-items: stretch;
  border-bottom: var(--border-thin);
}

.filter-row:last-child {
  border-bottom: none;
}

.filter-label {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.55rem 0.8rem;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  white-space: nowrap;
  border-right: var(--border-thick);
}

.category-filter,
.size-filter {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
}

.cat-btn,
.size-btn {
  background: var(--white);
  border: none;
  border-right: var(--border-thin);
  border-bottom: var(--border-thin);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: background 0.05s, color 0.05s;
}

.cat-btn:hover,
.size-btn:hover {
  background: var(--yellow);
}

.cat-btn.active,
.size-btn.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* Symbolic button gets special treatment */
.size-btn[data-size="symbolic"] {
  font-weight: 800;
  letter-spacing: 1px;
}

.size-btn[data-size="symbolic"].active {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.main {
  padding: 0;
  flex: 1;
}

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

.icon-card {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  background: var(--white);
  border-right: var(--border-thin);
  border-bottom: var(--border-thin);
  cursor: pointer;
  transition: background 0.05s;
  position: relative;
  overflow: hidden;
}

.icon-card:hover {
  background: var(--yellow);
}

.icon-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.icon-card .icon-name {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.4rem;
  line-height: 1.3;
  word-break: break-all;
  max-height: 2.6em;
  overflow: hidden;
  width: 100%;
  font-family: var(--font-mono);
  font-weight: 500;
}

.icon-card .icon-badges {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0;
}

.icon-badge {
  font-size: 0.45rem;
  padding: 2px 5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
}

.icon-badge.adwaita {
  background: var(--blue);
  color: var(--white);
}

.icon-badge.breeze {
  background: var(--yellow-deep);
  color: var(--black);
}

.icon-card-common {
  aspect-ratio: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.8rem;
  background: var(--white);
  border-right: var(--border-thin);
  border-bottom: var(--border-thin);
  cursor: pointer;
  transition: background 0.05s;
  position: relative;
}

.icon-card-common:hover {
  background: var(--yellow);
}

.icon-pair {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.icon-pair img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.icon-pair .pair-divider {
  width: 1px;
  height: 32px;
  background: var(--border-thin);
  border-left: var(--border-thin);
}

.icon-pair-label {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.icon-pair-label span {
  font-size: 0.5rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  width: 56px;
  text-align: center;
}

.icon-card-common .icon-name {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.4rem;
  line-height: 1.3;
  word-break: break-all;
  max-height: 2.6em;
  overflow: hidden;
  width: 100%;
  font-family: var(--font-mono);
  font-weight: 500;
}

.empty-state,
.loading-state {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6rem 1rem;
  font-family: var(--font-display);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--text-dim);
  font-weight: 700;
}

.loading-state {
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 0;
  flex-wrap: wrap;
  border-top: var(--border-thick);
  background: var(--white);
}

.page-btn {
  background: var(--white);
  border: none;
  border-right: var(--border-thin);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  transition: background 0.05s;
  min-width: 2.8rem;
  text-align: center;
  font-weight: 700;
}

.page-btn:hover {
  background: var(--yellow);
}

.page-btn.active {
  background: var(--black);
  color: var(--white);
}

.page-info {
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 0 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
}

.modal-content {
  position: relative;
  background: var(--white);
  border: 4px solid var(--black);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.2rem;
  border-bottom: var(--border-thick);
  background: var(--black);
  color: var(--white);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.modal-close {
  background: var(--red-deep);
  border: none;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: background 0.05s;
}

.modal-close:hover {
  background: var(--black);
}

.modal-body {
  padding: 1.5rem;
}

.icon-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3rem;
  padding: 2rem;
  background: var(--bg);
  border: var(--border-thick);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.icon-preview .preview-item {
  text-align: center;
}

.icon-preview .preview-item img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.icon-preview .preview-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.icon-details {
  font-size: 0.85rem;
}

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section h3 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--white);
  background: var(--black);
  margin-bottom: 0;
  padding: 0.5rem 0.8rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.8rem;
  border-bottom: var(--border-thin);
  align-items: center;
}

.detail-row:nth-child(even) {
  background: var(--bg);
}

.detail-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.7rem;
  font-weight: 600;
}

.detail-value {
  color: var(--text);
  text-align: right;
  word-break: break-all;
  max-width: 60%;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0;
  margin-top: 0;
}

.size-chip {
  background: var(--white);
  border: var(--border-thin);
  text-align: center;
  padding: 0.5rem;
}

.size-chip .size-label {
  color: var(--text-dim);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.size-chip .size-icons {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.2rem;
  border-top: var(--border-thick);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  background: var(--white);
  font-weight: 600;
}

.footer a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover {
  color: var(--red-deep);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--black);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--red-deep);
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
  }

  .header-left {
    padding: 1rem;
  }

  .header-stats {
    border-left: none;
    border-top: 2px solid #333;
    justify-content: center;
  }

  .control-row {
    flex-direction: column;
  }

  .search-box {
    max-width: 100%;
    border-right: none;
    border-bottom: var(--border-thin);
  }

  .theme-toggle {
    flex-wrap: wrap;
  }

  .theme-btn {
    flex: 1;
    min-width: 0;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-label {
    border-right: none;
    border-bottom: var(--border-thin);
    justify-content: center;
  }

  .icon-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
