* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wrap {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
  position: relative;
  z-index: 1;
}

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

h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px 0;
  text-align: center;
  letter-spacing: 0.02em;
}

p.hint {
  color: #aaa;
  font-size: 14px;
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

.share-field .hint {
  margin-bottom: 24px;
}

label {
  font-size: 13px;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}

input[type="text"],
input[type="email"],
select {
  width: 100%;
  background: #000;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 18px;
  font-family: inherit;
  outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus {
  border-color: #fff;
}

input.code-input {
  letter-spacing: 0.3em;
  text-align: center;
  font-size: 28px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

button {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 6px;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s;
}

button:hover:not(:disabled) {
  background: #fff;
  color: #000;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button.primary {
  background: #fff;
  color: #000;
}

button.primary:hover:not(:disabled) {
  background: #ddd;
}

button.danger {
  border-color: #f55;
  color: #f55;
}

button.danger:hover:not(:disabled) {
  background: #f55;
  color: #000;
}

button.small {
  padding: 8px 14px;
  font-size: 13px;
}

.field {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  gap: 12px;
}

.row > * {
  flex: 1;
}

.error {
  color: #f66;
  font-size: 14px;
  text-align: center;
  min-height: 1.2em;
}

.status {
  color: #888;
  font-size: 13px;
  text-align: center;
  min-height: 1.2em;
}

a {
  color: #fff;
  text-decoration: underline;
}

.meter {
  width: 100%;
  height: 10px;
  background: #222;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #444;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width 0.05s linear;
}

.text-center {
  text-align: center;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.share-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
  max-width: 260px;
}

/* Both cards are the same fixed box — same width (from the equal-flex
   column above) and same height — so the link and the QR read as one
   matched pair, with their Copy buttons landing at the same level. */
.share-card {
  width: 100%;
  height: 200px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #000;
  border: 1px solid #444;
  border-radius: 8px;
}

.link-card input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 15px;
  font-family: ui-monospace, monospace;
  text-align: center;
}

.qr-card img, .qr-card svg {
  width: 160px;
  height: 160px;
  display: block;
  /* The QR is generated as black modules on a light ground; inverting it
     in CSS keeps the black/white theme without touching the server-side
     generator — most phone cameras read light-on-dark QR codes fine. */
  filter: invert(1);
}

.subtitle-area {
  width: 100%;
  min-height: 3.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #050505;
}

.subtitle-text {
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1.4;
}

.subtitle-text.partial {
  color: #999;
  font-style: italic;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #333;
}

th {
  color: #aaa;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid #444;
}

.pill.live {
  border-color: #5f5;
  color: #5f5;
}

.footer-link {
  text-align: center;
  margin-top: 4px;
}

.footer-link a {
  color: #888;
  font-size: 13px;
}

/* Ambient soundboard-style animated background for operator/admin pages */
.viz-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* Full-black no-chrome mode for the pure viewer page */
body.viewer {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

body.viewer .wrap {
  max-width: 90vw;
  margin: 0 auto;
  height: 100vh;
}

/* Caption feed: newest line at the bottom, older lines stay put and get
   pushed up (and scrollable) instead of being replaced — see view.html. */
body.viewer .subtitle-area {
  border: none;
  background: transparent;
  min-height: unset;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* Not flex-end: content that overflows "before" a flex-end alignment isn't
     reachable by scrolling in any browser — see view.html for the JS that
     keeps this pinned to the latest line instead. */
  justify-content: flex-start;
  gap: 18px;
  padding: 48px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

body.viewer .caption-line {
  font-size: clamp(18px, 2.6vw, 30px);
  line-height: 1.4;
  text-align: center;
  color: #eee;
  flex: none;
}

body.viewer .caption-line.partial {
  color: #999;
  font-style: italic;
}
