/* Styles moved here from the original <style> block */
:root {
  --font-body: system-ui, sans-serif;
  --font-size-base: 1em;
  --font-size-title: 2.5em;
  --font-size-small: 0.9em;
  --color-bg: #ffffff;
  --color-title: #000;
  --color-text: #666;
  --color-accent: #666666;
  --color-hover: #dddddd;
  --color-light: #eeeeee;
  --color-button-bg: var(--color-light);
  --color-button-text: var(--color-text);
  --color-link: blue;
}

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

* {
  background-repeat: no-repeat;
  padding: 0;
  margin: 0;
}
body.dark {
  --color-bg: #121212;
  --color-title: #fff;
  --color-text: #ccc;
  --color-accent: #bbbbbb;
  --color-hover: #333333;
  --color-light: #2a2a2a;
  --color-button-bg: var(--color-accent);
  --color-button-text: #ffffff;
  --color-link: #fff;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  max-width: 1170px;
  margin: auto;
  padding: 0 1em;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

header {
  padding-top: 1em;
  position: relative;
  padding-bottom: 0.5em;
  margin-bottom: 2.5em;
}

a {
  color: var(--color-link);
}

a:hover {
  color: var(--color-link);
}
h1 {
  font-size: var(--font-size-title);
  margin-bottom: 0;
  color: var(--color-title);
}
.logo {
  text-decoration: none;
  display: inline-block;
  font-weight: bold;
  opacity: 0.8;
}
.logo h1,
.logo div {
  font-size: 2em;
}
.logo:hover span {
  color: lime;
}

form.search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  margin-bottom: 1em;
  position: relative;
}

form.search input[type="text"] {
  flex: 1;
  border-radius: 4px;
  min-width: 150px;
  padding: 0.6em 0.8em;
  font-size: 1.1em;
  background: var(--color-light);
  color: var(--color-title);
  border: 1px solid var(--color-accent);
}

form.search button {
  position: absolute;
  right: 0.1em;
  top: 0.25em;
  padding: 0.3em 0.6em;
  font-size: 1.2em;
  cursor: pointer;
  width: 50px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
}

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 2.5em;
}

.category-buttons label {
  padding: 0.45em 0.9em;
  border-radius: 4px;
  border: 1px solid var(--color-accent);
  font-size: 0.9em;
  background-color: var(--color-light);
  color: var(--color-text);
  display: flex;
  align-items: center;
}
.category-buttons input {
  margin-right: 0.5em;
}

ul.tools {
  list-style: none;
  padding: 0;
}

ul.tools li {
  margin: 0.6em 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.25em;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  justify-content: center;
  margin-top: 1.5em;
}

.pagination a,
.pagination strong {
  padding: 0.5em 0.9em;
  border-radius: 4px;
  border: 1px solid var(--color-accent);
  text-decoration: none;
  font-size: 1em;
  color: var(--color-title);
  background-color: var(--color-light);
}

.pagination strong {
  background-color: var(--color-accent);
  color: white;
  pointer-events: none;
}

.pagination a:hover {
  background-color: var(--color-hover);
}

.theme-toggle {
  z-index: 1;
  float: right;
  font-size: 0.9em;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.3em 0.7em;
  background-color: var(--color-light);
  color: var(--color-title);
  position: absolute;
  top: 0;
  right: 0;
}

@media (max-width: 600px) {
  header {
    margin-bottom: 1.5em;
  }
  h1 {
    font-size: 2em;
    margin-top: 0;
    margin-bottom: 0.5em;
  }
  .logo h1 {
    margin-bottom: 0;
  }

  ul.tools li {
    font-size: 1em;
  }

  .category-buttons {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap; /* prevent wrapping */
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
  }

  form.search {
    margin-bottom: 0.5em;
  }
  form.search input[type="text"] {
    padding: 0.6em 0.8em;
    font-size: 1.1em;
  }

  form.search input {
    width: 100%;
  }

  .pagination a,
  .pagination strong {
    font-size: 0.95em;
    padding: 0.4em 0.8em;
  }
}
