* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #101014;
  color: #f2f2f4;
  font-family: monospace;
}

body {
  overflow: hidden;
  font-size: 15px;
}

.voting-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 8px 18px;
  background: #18181b;
  border-bottom: 1px solid #2f2f36;
}

.brand,
.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand strong {
  font-size: 19px;
}

.user-box img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.voting-layout {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.panel {
  background: rgba(0, 0, 0, .58);
  border: 1px solid #303039;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
}

.center-panel,
.home-panel {
  width: min(620px, calc(100vw - 32px));
  margin: 14vh auto 0;
  text-align: center;
}

.voting-home {
  display: grid;
  place-items: center;
}

body.voting-home {
  overflow: hidden;
}

.home-panel {
  margin: 0;
  padding: 28px;
}

.voting-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

p {
  color: #c9c9d2;
  line-height: 1.5;
}

input,
select,
button,
.twitch-link {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid #3a3a44;
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  background: #25252c;
  color: #e8f2ff;
}

button,
.twitch-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: #2f7d32;
  border-color: #246627;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.twitch-link:hover {
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
  filter: none;
}

.twitch-link {
  min-width: 230px;
  margin-top: 18px;
  background: #9146ff;
  border-color: #772ce8;
  font-weight: 700;
}

.twitch-mark {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

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

#pageSubtitle {
  margin-top: 4px;
}

.tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px 220px;
  gap: 10px;
  margin-bottom: 10px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid #303039;
  border-radius: 8px;
  background: #18181d;
  color: #c9c9d2;
  font-size: 13px;
}

.pagination-bar label,
.pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.pagination-bar select {
  width: auto;
  min-width: 88px;
  min-height: 32px;
  padding: 5px 8px;
}

.pagination-actions button {
  min-height: 32px;
  padding: 5px 10px;
  background: #2a2a32;
  border-color: #454552;
}

#clipPageLabel {
  min-width: 92px;
  text-align: center;
  color: #f2f2f4;
}

.clip-list {
  display: grid;
  gap: 12px;
  flex: 1;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #9146ff #18181d;
}

.clip-list::-webkit-scrollbar {
  width: 10px;
}

.clip-list::-webkit-scrollbar-track {
  background: #18181d;
  border-radius: 999px;
  border: 1px solid #282832;
}

.clip-list::-webkit-scrollbar-thumb {
  background: #9146ff;
  border-radius: 999px;
  border: 2px solid #18181d;
}

.clip-list::-webkit-scrollbar-thumb:hover {
  background: #a970ff;
}

.empty-state {
  padding: 24px;
  border: 1px solid #303039;
  border-radius: 8px;
  background: #18181d;
  color: #c9c9d2;
  text-align: center;
}

.clip-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 96px;
  gap: 18px;
  align-items: start;
  padding: 14px;
  border: 1px solid #303039;
  border-radius: 8px;
  background: #18181d;
}

.thumb-button {
  position: relative;
  display: block;
  width: 220px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #09090b;
  border: 1px solid #303039;
  border-radius: 8px;
}

.clip-thumb {
  width: 220px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #09090b;
}

.thumb-button span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 5px;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
}

.thumb-button:hover {
  border-color: #656577;
  filter: none;
}

.thumb-button:hover span {
  opacity: 1;
  transform: translateY(0);
}

.clip-main {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

.clip-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #a9a9b5;
  font-size: 12px;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 7px;
  padding: 4px 8px 4px 5px;
  border: 1px solid #383846;
  border-radius: 999px;
  background: #222229;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.clip-title {
  display: block;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}

.clip-title:hover {
  color: #b78cff;
  filter: none;
}

.clip-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, max-content));
  gap: 10px 22px;
  align-items: start;
  padding-top: 2px;
}

.clip-meta span {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #f2f2f4;
  font-size: 13px;
}

.clip-meta small {
  color: #8f8f9b;
  font-size: 11px;
  font-weight: 700;
}

.category-icon {
  width: 20px;
  height: 28px;
  object-fit: cover;
  flex: 0 0 auto;
  border-radius: 4px;
  background: #09090b;
}

.clip-side {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 10px;
  min-height: 100%;
}

.vote-box {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
  min-width: 0;
}

.vote-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d6d6dc;
  box-shadow: none;
}

.vote-score {
  color: #d6d6dc;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.vote-button .vote-icon {
  width: 28px;
  height: 28px;
  border-left: 8px solid currentColor;
  border-top: 8px solid currentColor;
  transform: rotate(45deg);
}

.vote-button:hover {
  color: #fff;
  filter: none;
}

.vote-button.active.up {
  color: #44b84b;
}

.vote-button.active.down {
  color: #d34b4b;
}

.vote-button.down .vote-icon {
  transform: rotate(225deg);
}

.secondary {
  background: #25252c;
  border-color: #3a3a44;
}

.preview-frame {
  width: min(920px, 80vw);
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}

@media (max-width: 820px) {
  .tools,
  .pagination-bar,
  .clip-card {
    grid-template-columns: 1fr;
  }

  .pagination-bar,
  .pagination-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-bar select,
  .pagination-actions button {
    width: 100%;
  }

  .thumb-button,
  .clip-thumb {
    width: 100%;
  }

  .vote-box {
    grid-column: auto;
  }

  .clip-side {
    align-content: center;
    justify-items: start;
  }

  .clip-meta {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }
}
