:root {
  --text-color: #8B4513;
  --bg-color: #FFEBCD;
  --btn-color: #FFA07A;
}
html *{
  font-family: "Noto Sans", sans-serif;
  color-scheme: light;
}
body {
  padding: 20px;
  max-width: 800px;
  margin: auto;
  background: var(--bg-color);
}
.controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 1em;
  padding-bottom: 5px;
  justify-content: flex-end;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
}
.kanji {
  color: var(--text-color);
  background-color: var(--btn-color);
  text-align: center;
  padding: 10px;
  border: 1px solid #1d1416;
  font-size: 1.5em;
  cursor: pointer;
  border-radius: 6px;
  user-select: none;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: inset -1px -1px 4px rgba(0, 0, 0, 0.4);
}
.kanji.checked {
  background-color: #ddd;
  color: #555;
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2);
}
.counter {
  text-align: center;
  margin-top: 1em;
  font-weight: bold;
}
.dropdown {
position: relative;
display: inline-block;
}
.hamburger {
font-size: 1.5em;
padding: 5px 10px;
cursor: pointer;
border: none;
background: none;
}
.dropdown-content {
display: none;
position: absolute;
background: var(--bg-color);
min-width: 220px;
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
z-index: 1;
padding: 10px;
border-radius: 5px;
flex-direction: column;
gap: 8px;
right: 0;
}
.dropdown.open .dropdown-content {
display: flex;
}
.dropdown-content button,
.dropdown-content input {
width: 100%;
margin-top: 5px;
}

body.dark {
  background-color: #1e1e1e;
  color: #eee;
}
body.dark .kanji {
  background-color: #333;
  color: #eee;
  border-color: #555;
  box-shadow: inset 1px 1px 3px rgba(255, 255, 255, 0.1),
              inset -2px -2px 5px rgba(0, 0, 0, 0.5);
}
body.dark .kanji.checked {
  background-color: #555;
  color: #bbb;
}
body.dark input,
body.dark select,
body.dark button,
body.dark .dropdown-content {
  background-color: #2a2a2a;
  color: #eee;
  border-color: #555;
}

@media (prefers-color-scheme: dark) {
  body.light {
    background-color: #f2f2f2;
    color: #111;
  }
  body.light .kanji {
    background-color: #fff;
    color: #111;
    border-color: #bbb;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.6),
                inset -2px -2px 4px rgba(0, 0, 0, 0.08);
  }
  body.light .kanji.checked {
    background-color: #ddd;
    color: #444;
  }
  body.light .dropdown-content,
  body.light input,
  body.light select,
  body.light button {
    background-color: #fafafa;
    color: #111;
    border-color: #ccc;
  }
}
