/* Dark Ant Design 5-like theme. No inline styles anywhere: CSP style-src 'self'. */
:root {
  --bg: #141414;
  --c: #1f1f1f;
  --c2: #262626;
  --b: #424242;
  --b2: #303030;
  --t: rgba(255, 255, 255, .88);
  --t2: rgba(255, 255, 255, .65);
  --t3: rgba(255, 255, 255, .45);
  --p: #1677ff;
  --p-hover: #3c89e8;
  --ok: #49aa19;
  --warn: #d89614;
  --err: #dc4446;
  --r: 6px;
  --r-card: 8px;
  --mono: Consolas, "SFMono-Regular", Menlo, "Liberation Mono", monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--t);
  font: 14px/1.5715 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
}
a { color: var(--p); text-decoration: none; }
a:hover { color: var(--p-hover); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); }

/* ---- header ---- */
.top {
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--c);
  border-bottom: 1px solid var(--b2);
}
.logo { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--t); font-weight: 600; }
.logo:hover { color: var(--t); }
.logo img { flex: none; width: 22px; height: 22px; display: block; }
.logo span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.menu { display: flex; align-items: stretch; gap: 16px; height: 48px; flex: none; }
.menu a, .menu button {
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--t2);
  font: inherit;
  cursor: pointer;
}
.menu a:hover, .menu button:hover { color: var(--t); }
.menu .on { color: var(--t); border-bottom-color: var(--p); }
.timer { font-size: 16px; font-weight: 600; color: var(--warn); font-variant-numeric: tabular-nums; }

/* ---- layout ---- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 16px; }
main.narrow { max-width: 440px; }
main.center-col { max-width: 640px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.fill { width: 100%; text-align: left; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.page-title { font-size: 20px; margin: 8px 0 16px; }

.card {
  background: var(--c);
  border: 1px solid var(--b2);
  border-radius: var(--r-card);
  padding: 20px 16px;
}
.card h2 { font-size: 16px; margin: 0 0 16px; }
.card.flush { padding: 0; overflow: hidden; }

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 40px 16px;
}
.big { font-size: 20px; font-weight: 600; }
.lead { color: var(--t2); }
.lead b { color: var(--t); }
.icon-big { font-size: 40px; line-height: 1; }

.muted { color: var(--t3); font-size: 12px; }
.note { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .input { flex: 1 1 220px; min-width: 0; }

/* ---- forms ---- */
.field { margin-bottom: 16px; }
.field label, .lbl { display: block; color: var(--t2); margin: 0 0 6px; }
.input, .textarea {
  display: block;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--b);
  border-radius: var(--r);
  padding: 4px 11px;
  min-height: 32px;
  color: var(--t);
  font: inherit;
  /* 16px on phones prevents iOS zoom on focus */
  font-size: 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:hover, .textarea:hover { border-color: var(--p-hover); }
.input:focus, .textarea:focus { border-color: var(--p); box-shadow: 0 0 0 2px rgba(5, 145, 255, .1); }
.input[readonly] { color: var(--t2); }
.input::placeholder, .textarea::placeholder { color: var(--t3); }
.textarea { min-height: 140px; resize: vertical; font-family: var(--mono); padding: 8px 11px; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.hint { font-size: 12px; margin-top: 4px; }
.hint.warn { color: var(--warn); }
.hint.err, .err-text { color: var(--err); }
.counter { color: var(--t3); font-size: 12px; text-align: right; margin-top: 4px; }
.counter.over { color: var(--err); }

.drop {
  display: block;
  border: 1px dashed var(--b);
  border-radius: var(--r-card);
  padding: 18px 12px;
  text-align: center;
  color: var(--t3);
  background: rgba(255, 255, 255, .02);
  cursor: pointer;
  transition: border-color .2s;
}
.drop:hover, .drop.over { border-color: var(--p); }
.drop.over { background: rgba(22, 119, 255, .06); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.drop:focus-within { border-color: var(--p); }

.file {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--c2);
  border-radius: var(--r);
  padding: 8px 12px;
  text-align: left;
}
.file .name { min-width: 0; overflow-wrap: anywhere; }
.attached { margin-top: 8px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 15px;
  border-radius: var(--r);
  border: 1px solid var(--b);
  background: transparent;
  color: var(--t);
  font: inherit;
  line-height: 1.5715;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.btn:hover { color: var(--p-hover); border-color: var(--p-hover); }
.btn:focus-visible { outline: 2px solid rgba(22, 119, 255, .5); outline-offset: 1px; }
.btn.pr { background: var(--p); border-color: var(--p); color: #fff; }
.btn.pr:hover { background: var(--p-hover); border-color: var(--p-hover); color: #fff; }
.btn.lg { min-height: 40px; padding: 7px 24px; font-size: 16px; border-radius: var(--r-card); }
.btn.block { width: 100%; }
.btn.dn { color: var(--err); border-color: var(--err); }
.btn.dn:hover { color: #e86e6b; border-color: #e86e6b; }
.btn.sm { min-height: 24px; padding: 0 7px; font-size: 12px; border-radius: 4px; }
.btn.link { border-color: transparent; color: var(--p); padding-left: 0; padding-right: 0; }
.btn:disabled, .btn:disabled:hover {
  cursor: not-allowed;
  color: rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08);
  border-color: var(--b);
}
a.btn { color: var(--t); }
a.btn.pr { color: #fff; }

/* ---- alerts and tags ---- */
.alert {
  border: 1px solid #594214;
  background: #2b2111;
  border-radius: var(--r-card);
  padding: 8px 12px;
  color: var(--t);
  text-align: left;
  width: 100%;
}
.alert.err { border-color: #58181c; background: #2c1618; }
.alert.ok { border-color: #274916; background: #162312; }
.alert + .alert, .alert + form, .alert-gap { margin-bottom: 16px; }
form .alert { margin-bottom: 16px; }

.tag { display: inline-block; font-size: 12px; padding: 0 7px; border-radius: 4px; border: 1px solid; line-height: 20px; white-space: nowrap; }
.tag.w { color: #3c89e8; border-color: #15325b; background: #111a2c; }
.tag.o { color: #6abe39; border-color: #274916; background: #162312; }
.tag.e { color: var(--t3); border-color: var(--b); background: var(--c2); }
.tag.r { color: #e86e6b; border-color: #58181c; background: #2c1618; }
.ip-bad { color: var(--err); }

/* ---- links table (cards on phones) ---- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  background: var(--c2);
  color: var(--t);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--b2);
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--b2); color: var(--t2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.label-cell { color: var(--t); overflow-wrap: anywhere; }
.table td.label-cell.none { color: var(--t3); }
.table td.act { text-align: right; }
.empty { padding: 40px 16px; text-align: center; color: var(--t3); }
.legend { margin-top: 8px; }

@media (max-width: 719px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--b2); }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 2px 0; border: 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--t3); text-align: left; flex: none; }
  .table td.act { justify-content: flex-end; padding-top: 8px; }
  .table td.act::before { content: none; }
  .table td.act:empty { display: none; }
}

/* ---- reveal ---- */
.secret-box {
  width: 100%;
  min-height: 120px;
  background: var(--bg);
  border: 1px solid var(--b);
  border-radius: var(--r);
  padding: 12px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--t);
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview { display: block; max-width: 100%; max-height: 60vh; border-radius: var(--r); border: 1px solid var(--b2); background: var(--c2); }
.reveal-body { gap: 16px; padding: 24px 16px; }
.countdown { width: 100%; height: 6px; display: block; border: 0; border-radius: 3px; background: var(--c2); overflow: hidden; appearance: none; -webkit-appearance: none; }
.countdown::-webkit-progress-bar { background: var(--c2); border-radius: 3px; }
.countdown::-webkit-progress-value { background: var(--warn); border-radius: 3px; }
.countdown::-moz-progress-bar { background: var(--warn); border-radius: 3px; }

/* ---- enroll ---- */
.qr { display: block; width: 200px; height: 200px; margin: 0 auto 12px; background: #fff; padding: 8px; border-radius: var(--r-card); image-rendering: pixelated; }
.secret-code { display: block; text-align: center; font-family: var(--mono); font-size: 15px; letter-spacing: .5px; overflow-wrap: anywhere; user-select: all; color: var(--t); margin-bottom: 8px; }

/* ---- toast ---- */
.toasts { position: fixed; top: 60px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 10; padding: 0 16px; }
.toast {
  pointer-events: auto;
  max-width: 100%;
  background: var(--c2);
  color: var(--t);
  border: 1px solid var(--b2);
  border-radius: var(--r-card);
  padding: 9px 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .32);
}
.toast.ok { border-color: #274916; }
.toast.err { border-color: #58181c; }
.toast.warn { border-color: #594214; }

/* ---- wider screens ---- */
@media (min-width: 720px) {
  .top { padding: 0 20px; }
  .menu { gap: 24px; }
  main { padding: 24px; }
  .card { padding: 20px 24px; }
  .card.flush { padding: 0; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .input, .textarea { font-size: 14px; }
  .input.mono { font-size: 12px; }
  .center { padding: 56px 24px; }
}
