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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

#sketch-frame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

#search-overlay {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#toolbar-buttons {
  display: flex;
  gap: 8px;
}

#toolbar-buttons button {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#toolbar-buttons button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.light-bg #toolbar-buttons button {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.6);
}

.light-bg #toolbar-buttons button:hover {
  background: rgba(0, 0, 0, 0.15);
}

#search-container {
  margin-top: 8px;
  width: 320px;
  max-width: calc(100vw - 32px);
}

#search-container.hidden {
  display: none;
}

#search-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #eee;
  outline: none;
  font-family: system-ui, sans-serif;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#search-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
}

.light-bg #search-input {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.15);
  color: #222;
}

.light-bg #search-input::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

.light-bg #search-input:focus {
  border-color: rgba(0, 0, 0, 0.3);
}

#search-results {
  list-style: none;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
  transition: background 0.2s, border-color 0.2s;
}

.light-bg #search-results {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.12);
}

#search-results:empty {
  display: none;
}

#search-results li {
  padding: 10px 14px;
  cursor: pointer;
  color: #ddd;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: system-ui, sans-serif;
}

#search-results li:last-child {
  border-bottom: none;
}

#search-results li:hover,
#search-results li.active {
  background: rgba(255, 255, 255, 0.1);
}

#search-results li .japanese {
  font-size: 18px;
  margin-bottom: 2px;
}

#search-results li .english {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.light-bg #search-results li {
  color: #222;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.light-bg #search-results li:hover,
.light-bg #search-results li.active {
  background: rgba(0, 0, 0, 0.06);
}

.light-bg #search-results li .english {
  color: rgba(0, 0, 0, 0.45);
}
