:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b36;
  --text: #e6e9ef;
  --muted: #8b93a7;
  --accent: #4f8cff;
  --danger: #e2564d;
  --ok: #3fb984;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #10131a; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.muted { color: var(--muted); }
.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 22px;
}
.card.narrow { width: 100%; max-width: 380px; }
.card h1, .card h2 { margin-top: 0; }

label { display: block; margin: 14px 0; font-size: 14px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; margin: 0; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
label.inline input { width: 62px; margin: 0; }

input, textarea, select {
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  background: #10131a;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  padding: 9px 16px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.danger { background: var(--danger); padding: 5px 10px; font-size: 13px; }
.btn-link { display: inline-block; padding: 9px 12px; }

fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px 16px; margin: 20px 0; }
legend { padding: 0 8px; color: var(--muted); font-size: 13px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 16px; }

.notice, .error {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
}
.notice { background: rgba(63,185,132,.12); border: 1px solid var(--ok); color: var(--ok); }
.error  { background: rgba(226,86,77,.12);  border: 1px solid var(--danger); color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.actions { display: flex; align-items: center; gap: 10px; }
td.actions form { margin: 0; }

.topbar, .wallbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.topbar nav { display: flex; gap: 16px; }
.wallbar-left { display: flex; align-items: center; gap: 12px; }
.wallbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wallbar-right button { padding: 6px 12px; font-size: 13px; }
.wallbar-right select { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }

/* ---- the wall ---- */
.wall-body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.wall {
  flex: 1;
  display: grid;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  align-content: start;
}
.tile {
  background: #000;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tile-frame { position: relative; padding-top: 56.25%; }
.tile-frame iframe, .tile-frame > div {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}
.tile-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--panel);
  font-size: 12px;
}
.tile-timer { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-title { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tile-skip {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

@media (max-width: 640px) {
  .wall { grid-template-columns: 1fr 1fr !important; }
  .wallbar-right { width: 100%; }
}
