:root {
  --bg: #0c0a09;
  --bg-1: #1c1917;
  --bg-2: #292524;
  --line: rgba(255,255,255,0.1);
  --text: #fef3c7;
  --text-dim: rgba(254, 243, 199, 0.65);
  --accent: #fbbf24;
  --green: #84cc16;
  --yellow: #fbbf24;
  --red: #dc2626;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, system-ui, sans-serif; font-size: 14px; min-height: 100%; }

header {
  padding: 18px 24px 8px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(28,25,23,0.7), rgba(12,10,9,0));
}
header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  background: linear-gradient(90deg, var(--accent), #f59e0b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
header .sub { margin: 0; color: var(--text-dim); font-size: 13px; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  padding: 20px 24px 40px;
  max-width: 1500px;
  margin: 0 auto;
}

.poll { min-width: 0; }
.video-pane { min-width: 0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-1);
}
table {
  border-collapse: collapse;
  width: 100%;
}
th, td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}
thead th {
  background: var(--bg-2);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  position: sticky; top: 0;
}
.name-col {
  text-align: left;
  font-weight: 500;
  min-width: 140px;
  position: sticky; left: 0;
  background: var(--bg-1);
  z-index: 1;
}
thead .name-col { background: var(--bg-2); z-index: 2; }
tbody tr:hover .name-col { background: var(--bg-2); }
.place-col { min-width: 100px; }
.place-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.place-head .place-name { font-weight: 600; font-size: 13px; }
.place-head .del-place {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 11px; padding: 0;
  opacity: 0; transition: opacity 0.2s;
}
th:hover .place-head .del-place { opacity: 1; }

.cell {
  width: 40px; height: 32px;
  border-radius: 6px;
  display: inline-grid; place-items: center;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  user-select: none;
  transition: transform .08s, background .15s;
}
.cell:hover { transform: scale(1.08); }
.cell.yes   { background: rgba(132,204,22,0.25); border-color: rgba(132,204,22,0.6); color: var(--green); }
.cell.maybe { background: rgba(251,191,36,0.20); border-color: rgba(251,191,36,0.55); color: var(--yellow); }
.cell.no    { background: rgba(220,38,38,0.20);  border-color: rgba(220,38,38,0.55);  color: var(--red); }
.cell.read  { cursor: default; }
.cell.read:hover { transform: none; }

tbody tr.me .name-col {
  background: linear-gradient(90deg, rgba(251,191,36,0.18), transparent);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}
tbody tr.me .name-col::after { content: ' (te)'; opacity: 0.6; font-size: 11px; font-weight: 400; }

tbody tr .row-del {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 12px; opacity: 0;
  transition: opacity 0.2s;
}
tbody tr:hover .row-del { opacity: 0.8; }
tbody tr .row-del:hover { color: var(--red); }

tfoot td { background: var(--bg-2); font-size: 12px; color: var(--text-dim); padding: 8px 12px; }
.tot { display: inline-flex; gap: 4px; align-items: center; }
.tot .y { color: var(--green); font-weight: 700; }
.tot .m { color: var(--yellow); font-weight: 700; }
.tot .n { color: var(--red); font-weight: 700; }
tfoot .winner { background: rgba(132,204,22,0.18); }
tfoot .winner::after { content: ' 👑'; }

.me-form {
  margin-top: 14px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.me-form label { font-size: 13px; color: var(--text-dim); }
.me-form input {
  flex: 1; min-width: 180px; max-width: 280px;
  background: var(--bg-1); border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: 7px; font-size: 14px; outline: none;
}
.me-form input:focus { border-color: var(--accent); }
button {
  background: var(--bg-1); border: 1px solid var(--line); color: var(--text);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 13px;
  transition: background .15s;
}
button:hover { background: var(--bg-2); }
button:disabled { opacity: 0.5; cursor: wait; }
#save { background: var(--accent); color: #0c0a09; border-color: var(--accent); font-weight: 600; }
#save:hover { background: #f59e0b; }
button.ghost { background: transparent; }

details.admin {
  margin-top: 18px; padding: 10px 14px;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 8px;
}
details.admin summary {
  cursor: pointer; font-size: 12px; color: var(--text-dim);
}
details.admin .row {
  display: flex; gap: 8px; margin-top: 10px;
}
details.admin input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none;
}

.status {
  margin-bottom: 10px;
  padding: 8px 14px; border-radius: 8px;
  background: rgba(132,204,22,0.12); border: 1px solid rgba(132,204,22,0.35);
  color: var(--green); font-size: 13px;
  display: none;
}
.status.show { display: block; }
.status.err { background: rgba(220,38,38,0.12); border-color: rgba(220,38,38,0.4); color: var(--red); }

.video-pane {
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: 12px;
  align-self: start;
}
.video-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.video-frame iframe,
.video-frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  object-fit: cover;
}
.video-pane .hint { margin: 0; text-align: center; color: var(--text-dim); font-size: 11px; }

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 14px;
  }
  .video-pane {
    position: static;
  }
  .video-frame { aspect-ratio: 16 / 9; }
}
