:root {
  --bg: #10131a;
  --panel: #1a1f2b;
  --panel-2: #232a39;
  --line: #2f3849;
  --text: #f2f5fa;
  --muted: #9aa6bd;
  --accent: #ffd166;
  --accent-2: #4cc9f0;
  --good: #4ade80;
  --bad: #f87171;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  padding: 0 0 env(safe-area-inset-bottom);
}

.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px 96px;
}

.wrap.wide {
  max-width: 1100px;
}

h1 {
  font-size: 1.6rem;
  margin: 12px 0 4px;
}

h2 {
  font-size: 1.15rem;
  margin: 18px 0 8px;
}

p {
  color: var(--muted);
  margin: 6px 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
}

.center {
  text-align: center;
}

.hidden {
  display: none !important;
}

label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type='text'],
input[type='password'],
textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

button {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #171a21;
  cursor: pointer;
  min-height: 52px;
}

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

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

button.danger {
  background: var(--bad);
  color: #1a0f0f;
}

button.subtle {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
}

button.block {
  width: 100%;
  margin-top: 10px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1 1 140px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 12px 0 4px;
  margin-top: 12px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.badge.live {
  color: #0e1116;
  background: var(--good);
  border-color: transparent;
}

.meme-frame {
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas.meme {
  display: block;
  max-width: 100%;
  cursor: zoom-in;
}

.holder {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* escape the centered .wrap so a picture can use the whole screen width */
.fullbleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: zoom-out;
}

.lightbox.hidden {
  display: none;
}

.lightbox canvas.meme {
  cursor: zoom-out;
}

html.is-lightbox-open,
html.is-lightbox-open body {
  overflow: hidden;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin: 6px 0 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 0.95rem;
}

.chip .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  margin-right: 6px;
}

.chip .dot.off {
  background: var(--bad);
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 20px;
  margin-top: 8px;
}

.status.error {
  color: var(--bad);
}

.status.ok {
  color: var(--good);
}

.stars {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 14px 0 4px;
}

.stars button {
  flex: 1 1 0;
  padding: 12px 0;
  font-size: 1.6rem;
  background: var(--panel-2);
  color: var(--accent);
  border: 1px solid var(--line);
}

.stars button.active {
  background: var(--accent);
  color: #171a21;
}

.pill-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pill-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.pill-list li:last-child {
  border-bottom: none;
}

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

.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  min-height: 0;
}

.entry.featured {
  border-color: var(--accent);
  background: #2a2a1c;
}

.entry .name {
  font-weight: 700;
}

.entry .meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.entry .grow {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.pic {
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  min-height: 0;
}

.pic img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.pic span {
  display: block;
  padding: 6px 8px;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pic.current {
  border-color: var(--accent);
}

.conn {
  position: fixed;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bad);
  color: #1a0f0f;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}

.table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.big-name {
  font-size: 2.4rem;
  font-weight: 800;
  margin: 8px 0;
}

.big-score {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

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

.title-row h1 {
  margin: 8px 0;
}

@media (min-width: 700px) {
  .wrap {
    padding: 20px 20px 100px;
  }
}