:root {
  --bg: #000;
  --panel: #0c0c0c;
  --panel-2: #080808;
  --pill: #111;
  --text: #e8e8e8;
  --muted: #666;
  --dim: #999;
  --font: "DM Sans", system-ui, sans-serif;
  --display: Syne, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.pin-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #000;
}
.pin-gate[hidden] { display: none; }
.pin-card {
  width: min(22rem, 100%);
  background: #0c0c0c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1rem;
  padding: 1.6rem 1.4rem 1.4rem;
  text-align: center;
}
.pin-card h1 {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.pin-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 1rem; }
.pin-card .btn {
  width: 100%;
  display: inline-flex;
  justify-content: center;
}
.pin-card .btn-discord { margin-top: 0.15rem; }
.pin-card .gate-out { margin-top: 0.85rem; }
#gate-locked p {
  color: #e8e8e8;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}
.pin-form { margin-top: 0.15rem; }
#pin-input {
  width: 100%;
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--display);
  background: #080808;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.75rem;
  padding: 0.7rem;
  margin-bottom: 0.9rem;
  color: #fff;
}
.pin-card .pin-error { color: #f0c9c9; font-size: 0.8rem; margin-top: 0.75rem; margin-bottom: 0; }
.pin-card .pin-error:empty { display: none; }

.dash {
  display: grid;
  grid-template-columns: minmax(240px, 1.05fr) minmax(320px, 1.45fr) minmax(220px, 0.9fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1.1fr);
  grid-template-areas:
    "instructional admin tasks"
    "notepad showcase tasks";
  gap: 0.75rem;
  padding: 0.75rem;
  height: 100vh;
  overflow: hidden;
}
.dash[hidden] { display: none; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1rem;
  padding: 0.8rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel.instructional {
  grid-area: instructional;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  overflow: hidden;
}
.instructional h1 { flex: none; margin-bottom: 0; }
.instructional.running { border-color: rgba(255,255,255,0.28); }
.admin {
  grid-area: admin;
  display: flex;
  flex-direction: column;
}
.tasks { grid-area: tasks; }
.notepad { grid-area: notepad; }
.showcase { grid-area: showcase; }

.panel h1 {
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0;
  color: #fff;
  margin-bottom: 0.5rem;
}

.timer-face {
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-circle {
  position: relative;
  width: min(100%, 11.5rem);
  height: auto;
  aspect-ratio: 1;
  max-height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.timer-circle svg {
  width: 100%;
  height: 100%;
  display: block;
}
.timer-track,
.timer-progress {
  fill: none;
  stroke-width: 3.2;
}
.timer-track { stroke: rgba(255,255,255,0.14); }
.timer-progress {
  stroke: #9bbcff;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
}
.timer-notch { fill: #9bbcff; }
.timer-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  pointer-events: none;
}
.stopwatch-face {
  font-family: var(--display);
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: #d8dce3;
  line-height: 1;
}
.time-left {
  color: var(--dim);
  font-size: 0.72rem;
}
.timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.dash .btn {
  padding: 0.42rem 0.55rem;
  font-size: 0.78rem;
}
.dash .btn:hover { transform: none; }
.preset-grid .btn,
.admin-top .btn,
.admin-nav .btn,
.showcase-cats .btn,
.note-actions .btn,
.pick-overlay .btn,
.pin-card .btn,
.pending-actions .btn,
.timer-actions .btn {
  width: 100%;
}
.admin-nav .btn.on,
.showcase-cats .btn.on,
.preset-grid .btn.on {
  border-color: rgba(255,255,255,0.22);
  background: #1a1a1a;
}

.admin-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.note-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.admin-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.admin-view[hidden] { display: none; }
.admin-copy {
  color: var(--dim);
  font-size: 0.82rem;
  margin-bottom: 0.55rem;
}
.review-export {
  display: block;
  width: 100%;
  margin-bottom: 0.55rem;
  text-align: center;
}
.admin-status {
  min-height: 0;
  margin: 0.35rem 0 0.25rem;
  color: #f0c9c9;
  font-size: 0.78rem;
}
.file-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.drop-zone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  border: 1px dashed rgba(255,255,255,0.22);
  border-radius: 0.75rem;
  padding: 0.7rem 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  background: #080808;
  cursor: pointer;
  text-align: center;
}
.drop-zone.on-drop,
.admin-view.on-drop .drop-zone,
.admin-view.on-drop .asset-stage,
.asset-stage.on-drop,
.show-drop.on-drop {
  border-color: rgba(255,255,255,0.7);
  background: #161616;
}
.drop-copy {
  font-size: 0.82rem;
  color: #cfcfcf;
}
.drop-hint {
  font-size: 0.68rem;
  color: var(--muted);
}
.drop-zone .file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
#asset-url {
  width: 100%;
  background: #080808;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.75rem;
  padding: 0.42rem 0.65rem;
  margin-bottom: 0.5rem;
  color: #fff;
}
.pick-overlay {
  background: #080808;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1rem;
  padding: 0.9rem;
  margin-bottom: 0.7rem;
  text-align: center;
}
.pick-overlay[hidden] { display: none; }
.pick-overlay p {
  color: #cfcfcf;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}
.pick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}
.pick-overlay .ghost { width: 100%; }
.asset-stage {
  flex: 1;
  min-height: 0;
  background: var(--panel-2);
  border: 1px dashed rgba(255,255,255,0.22);
  border-radius: 1rem;
  display: grid;
  place-items: center;
  overflow: auto;
  margin-bottom: 0.55rem;
  cursor: pointer;
}
.upload-mark {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.upload-mark svg { width: 48px; height: 48px; color: #bdbdbd; }
.asset-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  padding: 0.7rem;
  align-content: start;
}
.asset-card {
  position: relative;
  border: 2px solid transparent;
  border-radius: 0.7rem;
  overflow: hidden;
  background: #111;
}
.asset-card.on { border-color: #fff; }
.asset-pick {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.asset-grid img { width: 100%; height: 88px; object-fit: cover; display: block; image-rendering: auto; }
.asset-grid img.pixel { image-rendering: pixelated; }
.asset-x {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #d12626;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 22px;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}
.asset-card:hover .asset-x,
.asset-card.on .asset-x {
  opacity: 1;
  pointer-events: auto;
}
.admin-nav {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.showcase-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.pending-list {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}
.review-lists {
  display: grid;
  gap: 0.55rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
  align-content: start;
}
.admin-label {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pending-card {
  background: #080808;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.85rem;
  padding: 0.85rem;
}
.pending-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}
.pending-top img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #111;
}
.pending-top strong { display: block; font-size: 0.88rem; }
.pending-top span { color: var(--muted); font-size: 0.72rem; }
.pending-card blockquote {
  color: #d8d8d8;
  font-size: 0.86rem;
  margin-bottom: 0.7rem;
}
.pending-stars { color: #fff; letter-spacing: 0.08em; font-size: 0.85rem; margin-bottom: 0.45rem; }
.pending-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.pending-actions.one { grid-template-columns: 1fr; }
.pending-empty { color: var(--muted); font-size: 0.85rem; }

.notepad textarea {
  flex: 1;
  min-height: 0;
  margin-top: 0.5rem;
  background: #080808;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.75rem;
  resize: none;
  padding: 0.7rem;
  color: #e8e8e8;
}
.note-actions { margin-bottom: 0.2rem; }

.task-list {
  display: grid;
  gap: 0.35rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding-right: 0.2rem;
}
.task {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 0.55rem;
}
.task input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #cfcfcf;
}
  .task input[type="text"] {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 0.2rem 0;
  color: #e8e8e8;
  width: 100%;
  font-family: var(--font);
}

.showcase {
  overflow: auto;
  position: relative;
  z-index: 2;
}
.show-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  flex: 1 1 auto;
}
.show-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  flex: 0 0 auto;
}
.show-triple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.45rem;
  flex: 0 0 auto;
  margin-bottom: 0.45rem;
}
.show-mode {
  margin-bottom: 0.15rem;
}
.show-field {
  min-width: 0;
}
.show-drop {
  margin-bottom: 0;
  padding: 0.55rem 0.4rem 0.6rem;
  min-width: 0;
}
.show-drop .file-label {
  margin: 0 0 0.2rem;
}
.show-actions {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  flex: 0 0 auto;
}
.show-actions .btn {
  pointer-events: auto;
}
.show-preview {
  flex: 1 1 auto;
  min-height: 168px;
  background: #080808;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.75rem;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.show-preview img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
  image-rendering: auto;
}
.file-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.05rem 0 0.25rem;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.soon { color: var(--muted); font-size: 0.75rem; margin: 0; }
.show-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; flex: 1; min-height: 0; }
.show-slot {
  background: #080808;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.75rem;
  min-height: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
}

@media (max-width: 980px) {
  html, body { height: auto; overflow: auto; }
  .dash {
    height: auto;
    overflow: visible;
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas:
      "instructional"
      "admin"
      "notepad"
      "showcase"
      "tasks";
  }
  .instructional { min-height: 420px; }
  .timer-face { min-height: 160px; }
  .tasks { min-height: 280px; }
  .notepad textarea { min-height: 140px; }
  .show-slot { min-height: 72px; }
  .show-pair { grid-template-columns: 1fr; }
  .show-triple { grid-template-columns: 1fr; }
  .show-preview { min-height: 180px; }
}
