@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-fade-out 90ms ease both;
}

::view-transition-new(root) {
  animation: vt-fade-in 140ms ease both;
}

@keyframes vt-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes vt-fade-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--canvas);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

button,
[role="button"] {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
svg {
  max-width: 100%;
}

table {
  border-collapse: collapse;
}

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

.icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
  flex-shrink: 0;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-xs {
  width: 0.875rem;
  height: 0.875rem;
}

.staff-badge {
  color: var(--accent);
  filter: drop-shadow(0 0 3px var(--accent));
}

.shell {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.sidebar-rail {
  display: none;
}

.content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 48rem;
  margin: 0 auto;
}

.content-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

@media (min-width: 1024px) {
  .shell {
    padding: 0 var(--space-6);
  }

  .sidebar-rail {
    display: block;
    position: fixed;
    z-index: 20;
    top: 0;
    bottom: 0;
    left: max(0px, calc(50% - 45rem));
    width: var(--sidebar-width);
    padding: var(--space-4) var(--space-8) var(--space-10);
    overflow-y: auto;
    border-right: 1px solid var(--border-muted);
    background-color: var(--surface);
  }

  .shell-body {
    padding-left: var(--sidebar-width);
  }

  .content {
    max-width: none;
    margin-left: 0;
    padding-top: var(--space-4);
  }
}

.sidebar {
  position: relative;
  font-size: var(--text-sm);
  line-height: 1.6;
}

.sidebar-brand {
  display: block;
  padding: 0 0 var(--space-3);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text);
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
  font-size: var(--text-sm);
  background-color: var(--surface-raised);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--search-border);
  cursor: text;
  transition: box-shadow var(--transition);
}

.sidebar-search:focus-within,
.sidebar-search:hover {
  box-shadow: 0 0 0 1px var(--accent);
}

.sidebar-search input {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  font-weight: 300;
}

.sidebar-search input:focus {
  outline: none;
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-search button {
  display: flex;
  margin-right: var(--space-2);
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
}

.sidebar-heading {
  padding: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.sidebar-section {
  margin-top: var(--space-4);
}

.sidebar-link {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: var(--space-2);
  padding: var(--space-2) 0.625rem;
  background: transparent;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  text-align: left;
  transition: color var(--transition);
}

.sidebar-link:hover {
  color: var(--text);
}

.sidebar-link.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.sidebar-link .icon {
  opacity: 0.5;
  margin-right: var(--space-2);
}

.sidebar-count {
  margin-left: auto;
}

.navbar {
  position: relative;
  z-index: 40;
  width: 100%;
}

.navbar-row {
  display: flex;
  position: relative;
  align-items: center;
  min-height: 2.25rem;
  padding: var(--space-3) 0 var(--space-2);
  border-bottom: 1px solid var(--border-muted);
}

@media (min-width: 1024px) {
  .navbar-row {
    border-bottom: 0;
  }
}

.navbar-title {
  flex: 1;
  min-width: 0;
  margin-right: var(--space-4);
  overflow: hidden;
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.navbar-actions {
  display: flex;
  position: relative;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
  gap: var(--space-2);
}

.navbar-mobile {
  display: flex;
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text);
}

@media (min-width: 1024px) {
  .navbar-mobile {
    display: none;
  }
}

.navbar-toggle {
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
}

.sidebar-mobile {
  display: block;
  padding: var(--space-4) 0;
}

@media (min-width: 1024px) {
  .sidebar-mobile {
    display: none;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background-color: transparent;
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition:
    color var(--transition),
    border-color var(--transition),
    background-color var(--transition);
}

.button:hover {
  color: var(--text);
  border-color: var(--border);
}

.button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.button-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.button-primary:hover {
  background-color: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-contrast);
}

.button-danger {
  background-color: var(--danger);
  border-color: var(--danger);
  color: var(--on-accent);
}

.button-danger:hover {
  background-color: var(--danger-strong);
  border-color: var(--danger-strong);
  color: var(--on-accent);
}

.button-success {
  background-color: var(--success);
  border-color: var(--success);
  color: var(--on-accent);
}

.button-success:hover {
  background-color: var(--success-strong);
  border-color: var(--success-strong);
  color: var(--on-accent);
}

.button-icon {
  padding: 0.375rem;
  background: none;
  border: 0;
  color: var(--text-muted);
}

.button-icon:hover {
  color: var(--text);
  border-color: transparent;
}

.input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background-color: var(--canvas);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.dropdown {
  position: relative;
  display: inline-block;
  text-align: left;
}

.dropdown-menu {
  position: absolute;
  z-index: 10;
  top: 100%;
  margin-top: var(--space-2);
  padding: var(--space-2);
  width: 12rem;
  display: none;
  flex-direction: column;
  background-color: var(--surface-raised);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
}

.dropdown-left .dropdown-menu {
  left: 0;
}

.dropdown-right .dropdown-menu {
  right: 0;
}

.dropdown.open .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  display: flex;
}

.sidebar-details summary {
  list-style: none;
  display: inline-flex;
}

.sidebar-details summary::-webkit-details-marker {
  display: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  background: none;
  font: inherit;
  cursor: pointer;
  text-align: center;
  transition:
    background-color var(--transition),
    color var(--transition);
}

.dropdown-item:hover {
  background-color: var(--canvas);
  border-color: var(--border-muted);
  color: var(--text);
}

.dropdown-item-center {
  justify-content: center;
  padding: 0.375rem var(--space-2);
}

.dropdown-form {
  display: flex;
}

.dropdown-signout {
  flex: 1;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
}

.dropdown-separator {
  margin: var(--space-2) 0;
  border: 0;
  border-top: 1px solid var(--border-muted);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  color: var(--role-fg);
}

.role-admin {
  background-color: var(--role-admin-bg);
}

.role-mod {
  background-color: var(--role-mod-bg);
}

.card {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background-color: var(--surface-raised);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
}

.card-title {
  margin-bottom: var(--space-3);
  font-size: var(--text-lg);
  color: var(--text);
}

.card-note {
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.page {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
}

.page-title {
  padding: 0 0 var(--space-4);
  font-size: var(--text-2xl);
  font-weight: 600;
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.muted {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.empty {
  padding: var(--space-6) 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

.welcome {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  max-width: 46rem;
  margin: 0 auto;
  padding-bottom: var(--space-10);
}

.welcome-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text);
}

.welcome-fast {
  color: var(--accent-strong);
}

.welcome-lead {
  margin-bottom: var(--space-4);
  font-size: var(--text-lg);
  color: var(--text-secondary);
}

.welcome-hero {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-5) 0 var(--space-8);
}

.welcome-intro {
  min-width: 0;
}

.welcome-logo {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
}

.welcome-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: var(--text-lg);
}

.welcome-support {
  padding-left: var(--space-5);
  margin-bottom: var(--space-6);
  border-left: 3px solid var(--accent-strong);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 40rem) {
  .welcome-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .welcome-logo {
    width: 88px;
    height: 88px;
  }
}

.welcome a,
.link {
  color: var(--link);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 30%, transparent);
  text-underline-offset: 4px;
  transition: text-decoration-color var(--transition);
}

.welcome a:hover,
.link:hover {
  text-decoration-color: var(--link);
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  min-width: 100%;
  color: var(--text);
}

.table thead {
  border-top: 1px solid var(--border-muted);
  border-bottom: 1px solid var(--border-muted);
}

.table th {
  padding: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: left;
  text-transform: capitalize;
  white-space: nowrap;
}

.table th button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font-weight: inherit;
  text-transform: inherit;
}

.table td {
  padding: var(--space-4) var(--space-3);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-muted);
  transition: background-color var(--transition);
}

.table tbody tr:hover {
  background-color: var(--row-hover);
}

.table th:first-child,
.table td:first-child {
  width: 100%;
  white-space: normal;
}

.table th:not(:first-child),
.table td:not(:first-child) {
  width: 1%;
  min-width: 5.5rem;
}

.table-seeders {
  color: var(--seeders);
  font-weight: 300;
}

.table-leechers {
  color: var(--leechers);
  font-weight: 300;
}

.table-completed {
  font-weight: 300;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) 0;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.pagination-summary {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.pagination-summary strong {
  font-weight: 500;
}

.pagination-nav {
  display: inline-flex;
  align-items: center;
}

.page-button {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background: none;
  border: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}

.page-button:hover {
  color: var(--text);
}

.page-button[disabled],
.page-button[aria-current="page"] {
  color: var(--accent);
  cursor: default;
}

.page-gap {
  padding: var(--space-2) var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

@media (min-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.category-tile {
  padding: var(--space-12) var(--space-4);
  background-color: var(--surface-raised);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  text-align: center;
  transition: background-color var(--transition);
}

.category-tile:hover {
  background-color: var(--canvas);
}

.category-tile-name {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}

.category-tile-count {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.torrent-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.torrent-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow: visible;
}

.torrent-title-row > .truncate {
  min-width: 0;
}

.torrent-title-row .input {
  flex: 1;
  font-size: var(--text-base);
  font-weight: 400;
}

.stat-head {
  gap: var(--space-1);
}

.stat-edit {
  margin-top: 0.125rem;
  gap: var(--space-1);
}

.stat-actions {
  gap: 0;
  flex-shrink: 0;
}

.input-sm {
  padding: 0.125rem var(--space-2);
  font-size: var(--text-sm);
  min-width: 0;
}

.edit-error {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--danger);
}

.torrent-hash {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.torrent-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

@media (min-width: 1024px) {
  .torrent-summary {
    flex-direction: row;
  }
}

.stat-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stat {
  padding: var(--space-2) var(--space-3);
  border-right: 1px solid var(--border-muted);
  border-bottom: 1px solid var(--border-muted);
  min-width: 0;
}

.stat:nth-child(3n) {
  border-right: 0;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  margin-top: 0.125rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.torrent-aside {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
}

.torrent-aside > :first-child {
  border-top-left-radius: calc(var(--radius-lg) - 1px);
  border-top-right-radius: calc(var(--radius-lg) - 1px);
}

@media (min-width: 1024px) {
  .torrent-aside {
    width: 16rem;
  }
}

.swarm {
  display: flex;
  border-bottom: 1px solid var(--border-muted);
}

.swarm-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-4);
}

.swarm-cell + .swarm-cell {
  border-left: 1px solid var(--border-muted);
}

.swarm-count {
  font-size: var(--text-sm);
  font-weight: 700;
}

.swarm-seeders {
  color: var(--seeders);
}

.swarm-leechers {
  color: var(--leechers);
}

.swarm-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.download-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background-color: var(--success);
  border: 0;
  color: var(--on-accent);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--transition);
}

.download-button:hover {
  background-color: var(--success-strong);
}

.support-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: filter var(--transition);
}

.torrent-aside > :last-child,
.torrent-aside > .support-wrap:last-child > .support-toggle {
  border-bottom-left-radius: calc(var(--radius-lg) - 1px);
  border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}

.torrent-aside > * {
  min-height: 0;
}

.torrent-aside > .support-wrap > .support-link {
  flex: 1 1 0;
  min-height: 0;
}

.support-link:hover {
  filter: brightness(1.1);
}

.support-menu {
  position: absolute;
  left: var(--space-2);
  right: var(--space-2);
  top: 100%;
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: 0.375rem;
  padding: var(--space-1);
  background-color: var(--surface-raised);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.support-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.support-toggle {
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  background-color: var(--warning);
  color: #1a1205;
  font-family: inherit;
  cursor: pointer;
}

.support-wrap.open .support-menu,
.support-wrap:hover .support-menu {
  display: flex;
}

.support-menu a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: var(--space-2) 0.625rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: filter var(--transition);
}

.support-menu a:hover {
  filter: brightness(1.1);
}

.file-list {
  margin-top: var(--space-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-muted);
  font-size: var(--text-sm);
  transition: background-color 100ms;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row:hover {
  background-color: var(--row-hover);
}

.file-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background-color: rgba(0, 0, 0, 0.6);
}

.modal.open {
  display: flex;
}

.modal-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: 28rem;
  padding: var(--space-5);
  background-color: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.auth-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
}

.auth-main {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding-bottom: var(--space-10);
}

.auth-panel {
  width: 100%;
  max-width: 24rem;
}

.auth-heading {
  margin-bottom: var(--space-4);
  font-size: var(--text-xl);
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-3xl);
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.auth-logo {
  width: 96px;
  height: 96px;
}

.auth-actions {
  display: flex;
  margin-top: var(--space-2);
}

.auth-actions .button {
  flex: 1;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
}

.auth-switch {
  font-size: var(--text-sm);
  text-align: center;
}

.auth-back .icon {
  transition: transform var(--transition);
}

.auth-back:hover .icon {
  transform: translateX(-0.125rem);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.alert-danger {
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background-color: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: var(--text-sm);
}

.alert-danger strong {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

.toasts {
  position: fixed;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  max-width: 360px;
}

.toast {
  padding: 9px var(--space-3);
  background-color: var(--surface-raised);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-info {
  border-left-color: var(--role-mod-bg);
}

.footer {
  margin-top: var(--space-12);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.footer-inner {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-10) 0 7rem;
  border-top: 1px solid var(--border-muted);
  color: var(--text-muted);
}

.footer-inner a {
  transition: color var(--transition);
}

.footer-inner a:hover {
  color: var(--text);
}

.footer-inner a + a {
  margin-left: var(--space-2);
  padding-left: var(--space-2);
  border-left: 1px solid var(--border);
}

.breadcrumb {
  margin-left: var(--space-6);
  font-size: var(--text-sm);
  font-weight: 600;
}

.breadcrumb ol {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb a {
  font-size: var(--text-xs);
  color: var(--accent);
}

.breadcrumb a:hover {
  color: var(--accent-strong);
}

.md-body {
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.5;
  word-wrap: break-word;
}

.md-body h1,
.md-body h2,
.md-body h3,
.md-body h4,
.md-body h5,
.md-body h6 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-4);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.md-body h1 {
  font-size: 2em;
}

.md-body h2 {
  font-size: 1.5em;
}

.md-body h3 {
  font-size: 1.25em;
}

.md-body h4 {
  font-size: 1em;
}

.md-body h5 {
  font-size: 0.875em;
}

.md-body h6 {
  font-size: 0.85em;
  color: var(--text-muted);
}

.md-body p {
  margin-bottom: var(--space-4);
}

.md-body a {
  color: var(--link);
}

.md-body a:hover {
  text-decoration: underline;
}

.md-body ul,
.md-body ol {
  margin-bottom: var(--space-4);
  padding-left: 2em;
  list-style: revert;
}

.md-body li + li {
  margin-top: 0.25em;
}

.md-body blockquote {
  margin: 0 0 var(--space-4);
  padding: 0 1em;
  border-left: 0.25em solid var(--border);
  color: var(--text-muted);
}

.md-body code {
  padding: 0.2em 0.4em;
  background-color: var(--code-bg);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 85%;
}

.md-body pre {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  overflow: auto;
  background-color: var(--pre-bg);
  border-radius: var(--radius);
  font-size: 85%;
  line-height: 1.45;
}

.md-body pre code {
  padding: 0;
  background: transparent;
  font-size: 100%;
}

.md-body table {
  display: block;
  width: 100%;
  margin-bottom: var(--space-4);
  overflow: auto;
}

.md-body table th,
.md-body table td {
  padding: 6px 13px;
  border: 1px solid var(--border);
}

.md-body table th {
  font-weight: 600;
}

.md-body hr {
  height: 0.25em;
  margin: var(--space-6) 0;
  padding: 0;
  background-color: var(--border);
  border: 0;
}

.md-body img {
  max-width: 100%;
}

.md-preview {
  max-height: 16rem;
  margin-top: var(--space-2);
  padding: var(--space-4);
  overflow: auto;
  background-color: var(--canvas);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
}

.spinner {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.theme-icon-sun {
  display: none;
}

html.dark .theme-icon-sun {
  display: block;
}

html.dark .theme-icon-moon {
  display: none;
}

.navbar-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
}

.navbar-toolbar .toolbar-row {
  margin: 0;
  flex-wrap: wrap;
}

.row-between {
  justify-content: space-between;
}

.row-end {
  justify-content: flex-end;
}

.grow {
  flex: 1;
  min-width: 0;
}

.ml-auto {
  margin-left: auto;
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-fallback {
  background-color: #475569;
  color: #ffffff;
}

.brand-patreon {
  background-color: #FF424D;
  color: #ffffff;
}

.brand-steam {
  background-color: #2a475e;
  color: #66c0f4;
}

.brand-kofi {
  background-color: #FF5E5B;
  color: #ffffff;
}

.brand-buymeacoffee {
  background-color: #FFDD00;
  color: #0f172a;
}

.brand-subscribestar {
  background-color: #009688;
  color: #ffffff;
}

.brand-boosty {
  background-color: #F15F2C;
  color: #ffffff;
}

.brand-itchio {
  background-color: #FA5C5C;
  color: #ffffff;
}

.brand-discord {
  background-color: #5865F2;
  color: #ffffff;
}

.brand-gumroad {
  background-color: #FF90E8;
  color: #0f172a;
}

.brand-instagram {
  background-color: #E4405F;
  color: #ffffff;
}

.brand-gog {
  background-color: #86328A;
  color: #ffffff;
}

.brand-x {
  background-color: #000000;
  color: #ffffff;
}

.brand-deviantart {
  background-color: #05CC47;
  color: #ffffff;
}

.brand-slushe {
  background-color: #D6366C;
  color: #ffffff;
}

.brand-dlsite {
  background-color: #052A83;
  color: #ffffff;
}

.brand-pixiv {
  background-color: #0096FA;
  color: #ffffff;
}

.brand-kickstarter {
  background-color: #05CE78;
  color: #ffffff;
}

.brand-bluesky {
  background-color: #0285FF;
  color: #ffffff;
}

.brand-youtube {
  background-color: #FF0000;
  color: #ffffff;
}

.brand-facebook {
  background-color: #0866FF;
  color: #ffffff;
}

.brand-newgrounds {
  background-color: #FDA238;
  color: #0f172a;
}

.brand-vndb {
  background-color: #4F6A93;
  color: #ffffff;
}

.brand-github {
  background-color: #181717;
  color: #ffffff;
}

.brand-gamejolt {
  background-color: #CCFF00;
  color: #0f172a;
}

.brand-nutaku {
  background-color: #F5A623;
  color: #0f172a;
}

.brand-tfgames {
  background-color: #7C3AED;
  color: #ffffff;
}

.page-wide {
  max-width: var(--page-wide);
}

.list-row {
  padding: var(--space-2) var(--space-3);
  background-color: var(--surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
}

.list-row .muted {
  margin-top: var(--space-1);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  background-color: var(--canvas);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition), border-color var(--transition);
}

a.chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.chip span {
  color: var(--text);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--role-fg);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.count-danger {
  background-color: var(--danger);
}

.count-warning {
  background-color: var(--warning);
  color: #1f2933;
}

.engine-rpgm {
  background-color: var(--engine-rpgm);
}

.engine-unity {
  background-color: var(--engine-unity);
}

.engine-renpy {
  background-color: var(--engine-renpy);
}

.engine-unreal {
  background-color: var(--engine-unreal);
}

.engine-html {
  background-color: var(--engine-html);
}

.engine-godot {
  background-color: var(--engine-godot);
}

.engine-other {
  background-color: var(--engine-other);
}

.note {
  font-style: italic;
  overflow-wrap: anywhere;
}

.link-type {
  flex: 0 0 10rem;
}

.confirm {
  position: relative;
}

.confirm > summary {
  list-style: none;
  cursor: pointer;
}

.confirm > summary::-webkit-details-marker {
  display: none;
}

.confirm > form {
  position: absolute;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  white-space: nowrap;
  background-color: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.dashboard-nav nav {
  display: flex;
  gap: var(--space-1);
}

.dashboard-body {
  flex: 1;
  min-width: 0;
}

.dashboard-tab {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: background-color var(--transition), color var(--transition);
}

.dashboard-tab:hover {
  background-color: var(--row-hover);
  color: var(--text);
}

.dashboard-tab.active {
  background-color: var(--accent-strong);
  color: var(--on-accent);
}

@media (min-width: 48rem) {
  .dashboard {
    flex-direction: row;
  }

  .dashboard-nav {
    flex: 0 0 12rem;
  }

  .dashboard-nav nav {
    flex-direction: column;
  }
}

.error-page {
  padding: var(--space-6) 0;
}

.error-code {
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.error-page .page-title {
  padding-top: var(--space-2);
}

.fallback-shell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
