:root {
  --bg: #080808;
  --panel: #0d0d0e;
  --panel-2: #121213;
  --panel-3: #171719;
  --border: rgba(255,255,255,.10);
  --border-strong: rgba(255,255,255,.16);
  --text: #f4f4f5;
  --muted: #a1a1a6;
  --muted-2: #74747a;
  --accent: #ffffff;
  --shadow: 0 20px 70px rgba(0,0,0,.45);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.025), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.main {
  width: 100%;
  min-height: 100vh;
  padding: 0 42px 70px;
}

.topbar {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: auto minmax(280px, 560px) auto;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.04em;
  white-space: nowrap;
}

.search-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-wrap > span {
  position: absolute;
  left: 11px;
  color: var(--muted-2);
  font-size: 17px;
  line-height: 1;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
}

.search-wrap input::placeholder {
  color: var(--muted-2);
}

.search-wrap input:focus {
  border-color: var(--border-strong);
}

.search-wrap kbd {
  position: absolute;
  right: 10px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted-2);
  background: var(--panel-3);
  font-size: 10px;
}

.manage-header-button {
  justify-self: end;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease;
}

.manage-header-button:hover {
  background: var(--panel-3);
  border-color: rgba(255,255,255,.24);
}

.manage-header-button span {
  margin-right: 6px;
}

.view {
  width: 100%;
  padding-top: 46px;
}

.aniwhat-intro {
  width: 100%;
  max-width: 1050px;
  margin-bottom: 42px;
}

.eyebrow {
  display: block;
  margin-bottom: 9px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.aniwhat-intro h1 {
  margin: 0 0 22px;
  color: var(--text);
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1;
  letter-spacing: -.055em;
}

.aniwhat-intro h1 strong {
  font-weight: 900;
}

.intro-copy {
  max-width: 1000px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.intro-copy p {
  margin: 0 0 13px;
}

.intro-copy p:last-child {
  margin-bottom: 0;
}

.home-filter-bar {
  width: 100%;
  max-width: none;
  margin: 0 0 38px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #0d0d0e;
  display: grid;
  grid-template-columns: 260px 260px 260px 260px minmax(400px, 1fr)auto;
  gap: 12px;
  align-items: end;
}

.filter-group {
  min-width: 0;
}

.filter-group label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.filter-group select {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  background: #151517;
  color: #ddd;
  font-size: 11px;
}

.filter-group select:focus {
  border-color: rgba(255,255,255,.30);
}

.anime-like-search {
  min-width: 0;
}

.anime-like-search input {
  width: 100%;
  height: 38px;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #151517;
  color: #ddd;
  padding: 0 10px;
  font-size: 11px;
  outline: none;
}

.anime-like-search input::placeholder {
  color: #666;
}

.anime-like-search input:focus {
  border-color: rgba(255,255,255,.30);
}

.clear-button {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #151517;
  color: #aaa;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  transition: background .15s ease, border-color .15s ease;
}

.clear-button:hover {
  background: #1b1b1e;
  border-color: rgba(255,255,255,.25);
  color: var(--text);
}

.home-list-heading {
  width: 100%;
  margin-bottom: 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.home-list-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -.035em;
}

#homeResultCount {
  color: var(--muted-2);
  font-size: 11px;
  white-space: nowrap;
}

.poster-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px;
}

.poster-grid.large {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.anime-card {
  min-width: 0;
  outline: none;
  cursor: pointer;
}

.anime-card-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  box-shadow: 0 12px 35px rgba(0,0,0,.20);
  transition:
    transform .18s ease,
    border-color .18s ease,
    box-shadow .18s ease;
}

.anime-card:hover .anime-card-poster,
.anime-card:focus-visible .anime-card-poster {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 42px rgba(0,0,0,.35);
}

.anime-card-poster img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.poster-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 11px;
}

.anime-card-rating {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 32px;
  height: 25px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 5px;
  background: rgba(0,0,0,.78);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  backdrop-filter: blur(6px);
}

.anime-card-content {
  padding: 11px 2px 0;
}

.anime-card-content h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anime-card-rating-text {
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 10px;
}

.empty-state {
  width: 100%;
  padding: 70px 20px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  margin-bottom: 12px;
  color: var(--muted-2);
  font-size: 28px;
}

.empty-state h3 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 17px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.page-heading {
  margin-bottom: 32px;
}

.page-heading h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 42px;
  letter-spacing: -.045em;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 35px;
  overflow-y: auto;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(7px);
}

.modal-backdrop.hidden {
  display: none !important;
}

.detail-modal,
.manage-modal {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #0c0c0d;
  box-shadow: var(--shadow);
}

.detail-modal {
  min-height: 400px;
}

.manage-modal {
  padding: 26px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  letter-spacing: -.035em;
}

.close-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}

.close-button:hover {
  color: var(--text);
  background: var(--panel-3);
}

.modal-note {
  margin: 0 0 25px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.anime-form {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

.form-grid label {
  min-width: 0;
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.form-grid label.full {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: #151517;
  color: var(--text);
  font-size: 12px;
}

.form-grid input,
.form-grid select {
  height: 38px;
  padding: 0 10px;
}

.form-grid textarea {
  min-height: 120px;
  padding: 10px;
  resize: vertical;
  line-height: 1.5;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: rgba(255,255,255,.28);
}

.hint {
  color: var(--muted-2);
  font-weight: 400;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.primary-button,
.secondary-button {
  height: 38px;
  padding: 0 15px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid #fff;
  background: #fff;
  color: #000;
}

.primary-button:hover {
  background: #ddd;
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--muted);
}

.secondary-button:hover {
  background: var(--panel-3);
  color: var(--text);
}

.form-section {
  margin-top: 25px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.form-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
}

.form-section-heading h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 14px;
}

.form-section-heading p {
  margin: 0;
  color: var(--muted-2);
  font-size: 11px;
}

.watch-links-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-link-editor-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
}

.watch-link-editor-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
}

.watch-link-editor-fields label {
  min-width: 0;
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.watch-link-editor-fields label span {
  display: block;
  margin-bottom: 6px;
}

.watch-link-editor-fields select,
.watch-link-editor-fields input {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: none;
  background: #111113;
  color: var(--text);
  font-size: 11px;
}

.watch-link-editor-fields select:focus,
.watch-link-editor-fields input:focus {
  border-color: rgba(255,255,255,.28);
}

.remove-watch-link {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #111113;
  color: var(--muted);
  font-size: 18px;
}

.remove-watch-link:hover {
  border-color: rgba(255,255,255,.25);
  color: #fff;
}

.manage-list {
  margin-top: 32px;
  padding-top: 25px;
  border-top: 1px solid var(--border);
}

.manage-empty {
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel-2);
  text-align: center;
  font-size: 12px;
}

.manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.manage-item:last-child {
  border-bottom: 0;
}

.manage-item-info {
  min-width: 0;
}

.manage-item-info strong {
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-item-info span {
  color: var(--muted-2);
  font-size: 10px;
}

.manage-item-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.manage-edit,
.manage-delete {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.manage-edit:hover,
.manage-delete:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--panel-3);
}

@media (max-width: 1600px) {
  .poster-grid,
  .poster-grid.large {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .main {
    padding-left: 28px;
    padding-right: 28px;
  }

  .topbar {
    grid-template-columns: auto minmax(220px, 1fr) auto;
  }

  .home-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .anime-like-search {
    grid-column: 1 / -1;
  }

  .clear-button {
    width: 100%;
  }

  .poster-grid,
  .poster-grid.large {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .main {
    padding-left: 20px;
    padding-right: 20px;
  }

  .topbar {
    grid-template-columns: auto 1fr;
    gap: 15px;
    padding: 14px 0;
  }

  .search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .manage-header-button {
    grid-column: 2;
    grid-row: 1;
  }

  .view {
    padding-top: 35px;
  }

  .poster-grid,
  .poster-grid.large {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid label.full {
    grid-column: auto;
  }

  .watch-link-editor-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .main {
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 40px;
  }

  .topbar {
    min-height: auto;
    padding: 15px 0;
  }

  .topbar-brand {
    font-size: 18px;
  }

  .manage-header-button {
    padding: 0 10px;
  }

  .aniwhat-intro h1 {
    font-size: 32px;
  }

  .intro-copy {
    font-size: 12px;
  }

  .home-filter-bar {
    margin: 0 0 25px;
    grid-template-columns: 1fr;
  }

  .anime-like-search {
    grid-column: auto;
  }

  .home-list-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .poster-grid,
  .poster-grid.large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .manage-modal {
    padding: 18px;
  }

  .watch-link-editor-row {
    align-items: stretch;
    flex-direction: column;
  }

  .remove-watch-link {
    width: 100%;
    flex-basis: 34px;
  }

  .form-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-section-heading .secondary-button {
    width: 100%;
  }

  .manage-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .manage-item-actions {
    width: 100%;
  }

  .manage-edit,
  .manage-delete {
    flex: 1;
  }
}

@media (max-width: 430px) {
  .poster-grid,
  .poster-grid.large {
    gap: 12px;
  }

  .anime-card-content h3 {
    font-size: 12px;
  }

  .page-heading h1 {
    font-size: 32px;
  }
}

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  overflow-y: scroll;
}