:root {
  --bg: #141414;
  --surface: #1d1d1d;
  --surface-2: #242424;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f4f5;
  --muted: #9aa3a9;
  --muted-light: #b9c2c8;
  --accent: #2bb0da;
  --accent-hover: #4cc3ea;
  --accent-soft: rgba(43, 176, 218, 0.12);
  --online: #2ecc71;
  --offline: #e74c3c;
  --radius: 14px;
}

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

html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

body.no-scroll {
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

img {
  display: block;
}

.hidden {
  display: none !important;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.92);
}

.header-brand-link {
  display: flex;
  transition: opacity 0.15s ease;
}

.header-brand-link:hover {
  opacity: 0.75;
}

.header-home-link {
  color: inherit;
  text-decoration: none;
}

.header-home-link:hover h1 {
  color: var(--accent-hover);
}

.header-picto {
  height: 40px;
  width: auto;
}

.header-jtume {
  margin-left: auto;
  display: flex;
  flex: none;
  transition: opacity 0.15s ease;
}

.header-jtume:hover {
  opacity: 0.75;
}

.header-jtume img {
  height: 62px;
  width: auto;
  max-width: 30vw;
  object-fit: contain;
}

.site-header h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: color 0.15s ease;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 56px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: #0f0f0f;
  padding: 28px clamp(16px, 4vw, 40px) 24px;
  text-align: center;
}

.footer-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 36px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.footer-logos img {
  width: auto;
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.footer-logo-koizeay img {
  height: 38px;
}

.footer-logo-jtume img {
  height: 62px;
}

.footer-logos a:hover img {
  opacity: 1;
  transform: translateY(-2px);
}

.footer-mention {
  color: var(--muted);
  font-size: 0.85rem;
}

.api-warning {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #f0b0a8;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.api-warning code {
  color: #f0d9d5;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.filters {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.filter-btn {
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 0.92rem;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-btn:hover {
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  color: #10222b;
  font-weight: 600;
}

.streamers-count {
  color: var(--muted);
  font-size: 0.95rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 22px;
}

.grid-message {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
}

.card {
  display: flex;
  height: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: rgba(43, 176, 218, 0.45);
  transform: translateY(-2px);
}

.card-left {
  flex: 0 0 44%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  text-align: center;
}

.avatar-btn {
  position: relative;
  padding: 9px;
  border-radius: 18px;
  transition: background 0.15s ease;
}

.avatar-btn:hover {
  background: var(--accent-soft);
}

.avatar {
  width: 122px;
  height: 122px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--surface-2);
}

.status-dot {
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  flex-shrink: 0;
}

.avatar-btn .status-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  border: 3px solid var(--surface);
  width: 18px;
  height: 18px;
}

.status-dot.online {
  background: var(--online);
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.7);
}

.status-dot.offline {
  background: var(--offline);
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
}

.streamer-name {
  font-size: 1.08rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.socials {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.social-icon {
  color: var(--accent);
  display: inline-flex;
  transition: color 0.15s ease, transform 0.15s ease;
}

.social-icon svg {
  width: 21px;
  height: 21px;
}

.social-icon:hover {
  color: var(--accent-hover);
  transform: translateY(-2px);
}

.card-divider {
  width: 1px;
  background: var(--border);
  margin: 14px 16px;
}

.card-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 4px 0;
  color: inherit;
  border-radius: 10px;
}

.clips-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 12px;
  transition: color 0.15s ease;
}

.card-right:hover .clips-label {
  color: var(--accent-hover);
}

.clips-label svg {
  width: 20px;
  height: 20px;
}

.clips-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.clip-thumb {
  width: 100%;
  height: 76px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
  transition: outline-color 0.15s ease, transform 0.15s ease;
  outline: 2px solid transparent;
}

.card-right:hover .clip-thumb {
  outline-color: rgba(43, 176, 218, 0.55);
}

.clips-empty {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  margin: auto 0;
  line-height: 1.6;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 18px;
}

.dialog {
  width: min(880px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.dialog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}

.dialog-header h2 {
  flex: 1;
  font-size: 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: rgba(43, 176, 218, 0.5);
}

.dialog-player {
  padding: 0 18px;
}

.dialog-player iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: #000;
}

.dialog-footer {
  display: flex;
  justify-content: center;
  padding: 14px 18px 16px;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-light);
  font-size: 0.95rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 22px;
  transition: color 0.15s ease;
}

.back-link svg {
  width: 18px;
  height: 18px;
}

.back-link:hover {
  color: var(--accent);
}

.clips-header {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 26px;
}

.clips-avatar {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-2);
}

.clips-header h2 {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.clips-subtitle {
  color: var(--muted-light);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 14px;
}

.clips-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.clips-list .grid-message {
  padding: 40px 0;
}

.clip-item {
  display: flex;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.clip-item:hover {
  border-color: rgba(43, 176, 218, 0.5);
  transform: translateX(4px);
}

.clip-item-thumb {
  flex: 0 0 260px;
  width: 260px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
}

.clip-item-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.clip-item-info h4 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--accent-hover);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clip-item-info p {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-header h1 {
  font-size: 1.3rem;
}

.admin-main {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 40px) 60px;
}

.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 26px;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-section h2 {
  font-size: 1.15rem;
  margin-bottom: 14px;
}

.admin-section-head h2 {
  margin-bottom: 0;
}

.admin-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.6fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.admin-row-head {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 14px;
}

.admin-username {
  color: var(--accent);
  font-weight: 600;
  word-break: break-all;
}

.admin-socials {
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #10222b;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted-light);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(231, 76, 60, 0.14);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #f0a89f;
}

.btn-danger:hover {
  background: rgba(231, 76, 60, 0.28);
}

.password-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.password-form input {
  flex: 1;
  min-width: 200px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"] {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font: inherit;
  width: 100%;
}

input:focus {
  outline: 2px solid rgba(43, 176, 218, 0.6);
  outline-offset: 1px;
}

.form-message {
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--online);
  margin-top: 10px;
}

.form-message.error {
  color: #f0a89f;
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-logo {
  height: 52px;
  width: auto;
  align-self: center;
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 1.2rem;
  text-align: center;
  margin-bottom: 8px;
}

.login-card label {
  font-size: 0.88rem;
  color: var(--muted-light);
}

.login-error {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #f0b0a8;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.88rem;
  text-align: center;
}

.login-card .btn {
  margin-top: 8px;
}

.dialog-form {
  width: min(560px, 100%);
}

.streamer-form {
  padding: 4px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted-light);
  margin-bottom: 6px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .card {
    height: 320px;
    padding: 14px;
  }

  .card-divider {
    margin: 10px 10px;
  }

  .avatar {
    width: 104px;
    height: 104px;
  }

  .social-icon svg {
    width: 19px;
    height: 19px;
  }

  .clip-thumb {
    height: 68px;
  }

  .admin-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "username actions"
      "display actions"
      "socials actions";
  }

  .admin-row > :nth-child(1) { grid-area: username; }
  .admin-row > :nth-child(2) { grid-area: display; }
  .admin-row > :nth-child(3) { grid-area: socials; white-space: normal; }
  .admin-row-head { display: none; }
  .admin-actions {
    grid-area: actions;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .card-left {
    flex: 0 0 40%;
  }

  .avatar {
    width: 92px;
    height: 92px;
  }

  .avatar-btn .status-dot {
    width: 16px;
    height: 16px;
  }

  .streamer-name {
    font-size: 0.98rem;
  }

  .socials {
    gap: 9px;
  }

  .social-icon svg {
    width: 17px;
    height: 17px;
  }

  .clip-thumb {
    height: 62px;
  }

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

  .filters {
    justify-content: center;
  }

  .streamers-count {
    text-align: center;
  }

  .clip-item {
    flex-direction: column;
    gap: 12px;
  }

  .clip-item-thumb {
    flex: none;
    width: 100%;
  }

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

  .footer-logo-koizeay img {
    height: 30px;
  }

  .footer-logo-jtume img {
    height: 50px;
  }

  .header-jtume img {
    height: 46px;
    max-width: 34vw;
  }
}
