:root {
  --ink: #1a1a1a;
  --muted: #666;
  --line: #e5e5e5;
  --bg: #fafafa;
  --input-bg: #fff;
  --accent: #1a1a1a;
  --accent-text: #fff;
  --error: #b33;
  --hover-bg: #eee;
  --search-hit-bg: #ffe566;
  --font: "Geist", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --ink: #e5e5e5;
  --muted: #999;
  --line: #333;
  --bg: #0a0a0a;
  --input-bg: #1a1a1a;
  --accent: #fff;
  --accent-text: #000;
  --error: #ff6b6b;
  --hover-bg: #1f1f1f;
  --search-hit-bg: #665500;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: grid;
  padding: 1.5rem 1rem 2.5rem;
}

#app:not(.is-unlocked) {
  place-items: center;
  padding-bottom: 18vh;
}

#app.is-unlocked {
  align-content: start;
  justify-items: center;
}

.brand {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.note {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.gate {
  width: min(100%, 16rem);
  text-align: center;
  margin-top: -2rem;
}

.pin-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.6rem;
  justify-items: center;
}

.pin-row {
  display: flex;
  gap: 0.4rem;
}

.pin-digit {
  width: 2.5rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--input-bg);
  text-align: center;
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  outline: none;
}

.pin-digit:focus {
  border-color: var(--ink);
}

.pin-error {
  margin: 0;
  color: var(--error);
  font-size: 0.8rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 0.35rem;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1.15rem;
  cursor: pointer;
}

.btn:hover {
  opacity: 0.85;
}

.pin-hint {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.library {
  width: min(100%, 36rem);
}

.library-header {
  margin-bottom: 1rem;
}

.search-label {
  display: block;
  margin-top: 0.85rem;
}

.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--input-bg);
  padding: 0.55rem 0.7rem;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--ink);
  outline: none;
}

.search::placeholder {
  color: #999;
}

.search:focus {
  border-color: var(--ink);
}

.video-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.video-list li {
  border-bottom: 1px solid var(--line);
}

.video-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  box-sizing: border-box;
  width: 100%;
  padding: 0.7rem 0.75rem;
  margin: 0;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
}

a.video-item:hover,
a.video-item:focus-visible {
  background: var(--hover-bg);
  color: var(--ink);
  outline: none;
}

a.video-item:hover .video-title,
a.video-item:focus-visible .video-title {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a.video-item:hover .video-open,
a.video-item:focus-visible .video-open {
  color: var(--ink);
}

.video-item.is-disabled {
  opacity: 0.45;
  cursor: default;
}

.video-title {
  font-size: 0.875rem;
  font-weight: 400;
  min-width: 0;
}

.search-hit {
  background: var(--search-hit-bg);
  color: inherit;
  padding: 0;
  margin: 0;
  border-radius: 0;
}

.video-open {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  align-self: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.video-open-icon {
  width: 0.85em;
  height: 0.85em;
  display: block;
}

.empty {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--input-bg);
  color: var(--ink);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}

.theme-toggle:hover {
  opacity: 0.7;
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
