:root {
  color-scheme: dark;
  --bg: #08090b;
  --bg-soft: #0d0f13;
  --panel: #111419;
  --line: #272b33;
  --line-soft: #1c2027;
  --text: #f5f2ea;
  --muted: #a39e95;
  --gold: #e7c06a;
  --gold-strong: #f4d68e;
  --danger: #ff9b9b;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -20%, #1b1e26 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.12;
  letter-spacing: 0.015em;
  text-align: center;
  text-wrap: balance;
}

.wrap {
  width: min(980px, 100% - 40px);
  margin: 0 auto;
  padding: 56px 0 72px;
}

.page-head {
  margin-bottom: 42px;
}

.muted {
  color: var(--muted);
}

.note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- logowanie ---------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-box {
  width: min(440px, 100%);
}

.login-box .brand {
  margin-bottom: 38px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form input {
  width: 100%;
  padding: 17px 18px;
  font-size: 19px;
  text-align: center;
  color: var(--text);
  background: #0b0d11;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

.login-form input:focus {
  border-color: rgba(231, 192, 106, 0.65);
  box-shadow: 0 0 0 4px rgba(231, 192, 106, 0.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--gold);
  color: #1a1405;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.button:hover {
  background: var(--gold-strong);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.movie:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: 3px;
}

.button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.button.ghost:hover {
  border-color: rgba(231, 192, 106, 0.55);
  background: rgba(231, 192, 106, 0.07);
}

.button.danger {
  background: transparent;
  border-color: rgba(255, 155, 155, 0.35);
  color: var(--danger);
}

.button.danger:hover {
  background: rgba(255, 155, 155, 0.08);
}

.button.small {
  padding: 9px 14px;
  font-size: 14px;
  border-radius: 9px;
}

.error {
  min-height: 1.4em;
  margin-top: 14px;
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

/* ---------- lista filmów ---------- */

.movie-list {
  display: grid;
  gap: 10px;
}

.movie {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 50px;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 18px 20px;
  color: inherit;
  text-align: left;
  background: linear-gradient(180deg, #101319 0%, #0d1014 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease,
    transform 0.15s ease;
}

.movie:hover,
.movie:focus-visible {
  border-color: rgba(231, 192, 106, 0.5);
  background: linear-gradient(180deg, #151920 0%, #101318 100%);
  transform: translateY(-1px);
}

.movie-title {
  min-width: 0;
  font-size: clamp(19px, 2.6vw, 26px);
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.movie-year {
  color: var(--muted);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.movie-play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--gold);
  background: rgba(231, 192, 106, 0.11);
}

.movie-play svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

.empty {
  padding: 40px 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty .button {
  margin-top: 16px;
}

.last-expired {
  margin-bottom: 14px;
}

/* ---------- dodawanie filmu ---------- */

.add-section {
  margin-top: 44px;
  padding-top: 30px;
  border-top: 1px solid var(--line-soft);
}

.section-title {
  margin-bottom: 18px;
  color: var(--gold);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-card,
.user-slot {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 170px;
  gap: 16px;
}

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

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 13px;
  color: var(--text);
  background: #0a0c10;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(231, 192, 106, 0.6);
}

.file-input {
  display: none;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.file-name {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.file-button {
  flex: 0 0 auto;
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
}

.progress {
  width: 100%;
  height: 10px;
  margin-top: 16px;
  accent-color: var(--gold);
}

.upload-message {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.user-slot-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.user-slot-title {
  font-size: 23px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.user-slot-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.countdown {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.locked {
  margin-top: 14px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  background: #0b0d11;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.site-footer {
  margin-top: 52px;
  padding-top: 28px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.apk-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 2px;
  color: var(--gold);
  font-size: 15px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.apk-link:hover {
  color: var(--gold-strong);
  border-bottom-color: currentColor;
}

.apk-link:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: 4px;
}

/* ---------- player ---------- */

.player {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player video {
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.player-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px 48px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
  pointer-events: none;
}

.player-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 600;
  text-shadow: 0 2px 18px #000;
}

.player-year {
  margin-left: 10px;
  color: var(--gold);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.65em;
  font-weight: 500;
  vertical-align: middle;
}

.icon-button {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--text);
  background: rgba(10, 10, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(30, 30, 34, 0.9);
}

.player-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.78);
}

[hidden] {
  display: none !important;
}

body.player-open {
  overflow: hidden;
}

/* ---------- panel admina ---------- */

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
}

.admin-bar .brand {
  text-align: left;
}

.admin-grid {
  display: grid;
  gap: 40px;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px auto auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.admin-row .field label {
  font-size: 10px;
}

.admin-row .field input {
  padding: 9px 11px;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
}

.admin-row-info {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.admin-user .user-slot {
  border-color: rgba(231, 192, 106, 0.2);
}

.user-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  margin-bottom: 14px;
}

.user-edit-grid .field label {
  font-size: 10px;
}

.user-edit-grid .field input {
  padding: 9px 11px;
}

.user-slot .admin-row-actions {
  margin-bottom: 8px;
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 720px) {
  .wrap {
    width: min(100% - 28px, 980px);
    padding: 34px 0 52px;
  }

  .page-head {
    margin-bottom: 28px;
  }

  .movie {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 12px;
    padding: 16px;
  }

  .movie-year {
    grid-column: 1;
    grid-row: 2;
    font-size: 14px;
  }

  .movie-play {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 40px;
    height: 40px;
  }

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

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

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

  .user-edit-grid {
    grid-template-columns: 1fr;
  }

  .admin-row-actions {
    justify-content: flex-start;
  }

  .admin-bar {
    align-items: flex-start;
  }

  .admin-bar .brand {
    font-size: clamp(24px, 7vw, 36px);
  }
}
