:root {
  --bg: #07080c;
  --line: rgba(138, 146, 185, 0.22);
  --text: #ececf3;
  --muted: #9b9eb2;
  --gold: #d2a85a;
  --gold-strong: #b88f44;
  --error: #f05a67;
  --radius-card: 18px;
  --trans-fast: 180ms ease;
  --trans-med: 220ms ease;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(720px 360px at 50% 34%, rgba(210, 168, 90, 0.16), transparent 65%),
    radial-gradient(1200px 700px at 10% 0%, rgba(71, 78, 133, 0.15), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

.app {
  width: min(1120px, 100% - 24px);
  margin: 0 auto;
  padding: 0 0 40px;
}

.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 26px 0;
  text-align: center;
}

.logo-tile {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 22px;
  border: 1px solid #2b2d3d;
  background: linear-gradient(160deg, #1f1a14, #15151f);
  display: grid;
  place-items: center;
  font-size: 32px;
}

.hero-title {
  margin: 2px 0 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.06;
  color: var(--gold);
}

.hero-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 2.4vw, 36px);
}

.panel {
  width: min(650px, 100%);
  margin: 12px auto 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #11131d 0%, #0e111a 100%);
  padding: 28px;
  text-align: left;
  box-shadow: 0 12px 32px rgba(3, 4, 10, 0.35);
}

.mini-panel {
  width: 100%;
  margin: 20px 0 8px;
  padding: 14px;
}

.mini-panel h4 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
}

.form-stack {
  display: grid;
  gap: 12px;
}

label {
  color: #b5b8ca;
  font-weight: 600;
}

input, textarea, button {
  font: inherit;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast), background-color var(--trans-fast), transform var(--trans-fast), opacity var(--trans-fast);
}

input, textarea {
  width: 100%;
  background: #1c1f2a;
  color: var(--text);
  border-color: #2a2e3f;
  padding: 14px 16px;
  min-height: 46px;
}

input::placeholder, textarea::placeholder { color: #7f859c; }
input:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: rgba(210, 168, 90, 0.75);
  box-shadow: 0 0 0 3px rgba(210, 168, 90, 0.2);
}

.gold-btn {
  background: var(--gold);
  color: #17120a;
  border-color: #a17c3d;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
  min-height: 44px;
}
.gold-btn:hover { background: var(--gold-strong); transform: translateY(-1px); }

.ghost-btn {
  background: transparent;
  color: #c1c4d9;
  border: 1px solid #34384f;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 44px;
}
.ghost-btn:hover {
  border-color: #495174;
  background: rgba(93, 105, 155, 0.12);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.error {
  min-height: 20px;
  color: var(--error);
  margin: 0;
}

.topbar {
  min-height: 78px;
  border-bottom: 1px solid #22263a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 28px; }
.brand-text {
  color: var(--gold);
  font-size: 34px;
  font-weight: 800;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b7bbce;
  flex-wrap: wrap;
}

.section-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 30px rgba(4, 5, 12, 0.3);
}

.status-card {
  margin-top: 24px;
  background: linear-gradient(180deg, #11131d, #10121b);
  padding: 22px;
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
}

.status-label {
  color: #9fa4bb;
  font-size: 13px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#next-screening {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.projection-date {
  font-size: clamp(20px, 2.6vw, 31px);
  font-weight: 700;
  line-height: 1.2;
}

.projection-time {
  display: inline-flex;
  width: fit-content;
  color: var(--gold);
  border: 1px solid rgba(210, 168, 90, 0.35);
  background: rgba(210, 168, 90, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 10px;
  width: min(430px, 100%);
}

.countdown-item {
  background: linear-gradient(180deg, #1a1e2a, #141928);
  border: 1px solid rgba(123, 134, 176, 0.35);
  border-radius: 999px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 0 24px rgba(210, 168, 90, 0.08);
}

.countdown-title {
  color: #9aa0bb;
  font-size: 12px;
  margin-bottom: 4px;
}

.countdown-value {
  color: var(--gold);
  font-size: 22px;
  font-weight: 800;
}

.card-block {
  margin-top: 28px;
  background: linear-gradient(180deg, #11131d, #0f121b);
  padding: 22px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

h3, h4 {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 700;
}

.section-title { margin-bottom: 16px; }

#notify-status, #screening-result, #admin-whitelist-result, #admin-notify-result {
  color: #9da2b8;
  margin: 8px 0 14px;
}

.votes-remaining {
  margin: 0 0 8px;
  color: #d9be84;
  font-size: 14px;
  font-weight: 600;
}

#invite-result {
  color: #9da2b8;
  margin: 8px 0 0;
}

.film-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.film-form button { min-width: 170px; }

#films, #screenings-list, #admin-whitelist-list, #admin-notify-logs {
  list-style: none;
  margin: 0;
  padding: 0;
}

#films li {
  background: linear-gradient(180deg, #131623, #111421);
  border: 1px solid rgba(127, 138, 181, 0.23);
  border-radius: 14px;
  padding: 14px;
  margin-top: 16px;
  transition: transform var(--trans-med), border-color var(--trans-med), box-shadow var(--trans-med);
}

#films li:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(189, 201, 255, 0.32);
  box-shadow: 0 14px 30px rgba(4, 6, 14, 0.45), 0 0 24px rgba(210, 168, 90, 0.12);
}

.film-card-active {
  border-color: rgba(210, 168, 90, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(210, 168, 90, 0.25), 0 10px 24px rgba(14, 11, 4, 0.35);
}

.film-rank-1 {
  border-color: rgba(250, 204, 21, 0.72) !important;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35), 0 0 30px rgba(250, 204, 21, 0.22);
}

.film-rank-2 {
  border-color: rgba(250, 204, 21, 0.38);
}

.film-rank-3 {
  border-color: rgba(250, 204, 21, 0.28);
}

.film-layout {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
}

.film-poster-wrap {
  width: 84px;
}

.film-poster {
  width: 84px;
  height: 118px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(157, 167, 205, 0.34);
  background: #1b1f2b;
}

.film-poster-fallback {
  display: grid;
  place-items: center;
  color: #f7d08a;
  font-weight: 700;
  font-size: 22px;
  background:
    radial-gradient(circle at 50% 20%, rgba(210, 168, 90, 0.28), transparent 65%),
    linear-gradient(180deg, #222533, #141824);
}

.film-body {
  min-width: 0;
}

.film-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.film-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.film-title {
  font-size: clamp(19px, 1.9vw, 23px);
  font-weight: 700;
  line-height: 1.24;
  word-break: break-word;
}

.film-year {
  color: #98a0bf;
  font-size: 14px;
  font-weight: 600;
}

.film-rating-badge {
  align-self: center;
  background: rgba(210, 168, 90, 0.14);
  border: 1px solid rgba(210, 168, 90, 0.42);
  color: #efc57d;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 14px;
  font-weight: 700;
}

.film-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.film-actions .gold-btn,
.film-actions .ghost-btn {
  min-width: 190px;
  min-height: 46px;
  font-weight: 700;
}

.film-proposer {
  margin: 7px 0 0;
  color: #9aa2bf;
  font-size: 13px;
}

.film-progress-wrap {
  margin-top: 10px;
}

.film-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.film-progress-bg {
  height: 10px;
  width: 100%;
  border-radius: 999px;
  background: #252938;
  border: 1px solid rgba(117, 127, 165, 0.35);
  overflow: hidden;
}

.film-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  border-radius: 999px;
  background: linear-gradient(90deg, #facc15, #f59e0b);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.45);
  transition: transform 220ms ease;
}

.film-votes-count {
  color: #d7dced;
  font-size: 13px;
  font-weight: 600;
}

.film-voters {
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-direction: column;
}

.film-voter-avatars {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.film-avatar {
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(128, 139, 183, 0.4);
  background: #2a3044;
  color: #e6e9f7;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.film-avatar-more {
  background: #3a415a;
  color: #f0f3ff;
}

.voters-line {
  margin: 0;
  color: #8f97b5;
  font-size: 13px;
  line-height: 1.45;
}

.film-skeleton .skeleton-line {
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(133, 144, 185, 0.2), rgba(184, 193, 225, 0.32), rgba(133, 144, 185, 0.2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  margin-top: 10px;
}
.film-skeleton .skeleton-line:first-child { margin-top: 0; }
.w-60 { width: 60%; }
.w-35 { width: 35%; }
.w-20 { width: 20%; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

#screenings-list li,
#admin-whitelist-list li,
#admin-notify-logs li {
  background: #121420;
  border: 1px solid #2b2f42;
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  color: #d8daea;
}

.whitelist-item {
  display: grid;
  gap: 8px;
}

.whitelist-item .meta {
  color: #9da3bb;
  font-size: 13px;
}

.whitelist-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.whitelist-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.whitelist-remove {
  min-height: 38px;
  padding: 8px 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-pill-ok {
  color: #c6f6d5;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.38);
}

.status-pill-muted {
  color: #c9cedf;
  background: rgba(116, 126, 161, 0.17);
  border-color: rgba(116, 126, 161, 0.38);
}

#screenings-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

@media (max-width: 900px) {
  .brand-text { font-size: 30px; }
  h3, h4 { font-size: 22px; }
  .film-title { font-size: 20px; }
}

@media (max-width: 640px) {
  .app { width: calc(100% - 16px); }
  .panel { padding: 18px; }
  .topbar {
    flex-direction: column;
    height: auto;
    align-items: flex-start;
    padding: 14px 0;
    gap: 8px;
  }
  .topbar-user { width: 100%; }
  .topbar-user button { width: 100%; }
  .status-card { flex-direction: column; align-items: flex-start; }
  .countdown-grid { grid-template-columns: 1fr; width: 100%; }
  .row { flex-direction: column; align-items: stretch; }
  .film-form { grid-template-columns: 1fr; }
  .film-form button { width: 100%; }
  .film-layout { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .film-poster-wrap, .film-poster { width: 72px; }
  .film-poster { height: 104px; }
  .film-head { grid-template-columns: 1fr; gap: 8px; }
  .film-actions { flex-direction: column; align-items: stretch; }
  .film-actions button { width: 100%; min-height: 44px; min-width: 0; }
  .film-voters { flex-direction: column; align-items: flex-start; gap: 6px; }
  .whitelist-footer { align-items: stretch; }
  .whitelist-remove { width: 100%; }
}
