:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1b2128;
  --line: #262d36;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #e50914;
  --accent-2: #ff3b47;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1a0507 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(18px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mark { font-size: 24px; }

.status {
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  white-space: nowrap;
}

.status.ok    { color: var(--ok);   border-color: #1f3a24; }
.status.warn  { color: var(--warn); border-color: #3d3016; }
.status.err   { color: var(--err);  border-color: #3d1d1b; }

main {
  padding: clamp(18px, 4vw, 40px);
  max-width: 1100px;
  margin: 0 auto;
}

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

.loading { color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .15s, transform .15s;
}

.card:hover { border-color: #333c47; transform: translateY(-2px); }

.card-top { display: flex; align-items: center; gap: 11px; }
.card-emoji {
  font-size: 26px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.card-title { font-weight: 650; font-size: 16px; }
.card-hint  { color: var(--muted); font-size: 12.5px; }

/* TV-code row: input takes the space, Send keeps its own width.
   .btn-primary is width:100% by default, which otherwise crushes the
   input to a sliver inside this flex row. */
.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

input[type=text] {
  width: 100%;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.field .btn-primary { width: auto; }
input[type=text]:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-weight: 600;
  transition: filter .15s, background .15s;
}
button:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:not(:disabled):hover { background: var(--accent-2); }

.btn-ghost {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:not(:disabled):hover { border-color: #3a4450; }

.ghost {
  background: none;
  border: none;
  color: var(--muted);
  padding: 4px 8px;
}
.ghost:hover { color: var(--text); }

.spin {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* result ------------------------------------------------------- */
.result {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.result.hidden { display: none; }

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  background: var(--panel-2);
}

#result-body { padding: 18px; }

.banner {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 15px;
  border: 1px solid;
  /* fallback reasons are multi-line */
  white-space: pre-line;
}
.banner.err  { background: #2a1416; border-color: #4a2024; color: #ffb3b0; }
.banner.warn { background: #2b2412; border-color: #4a3d1a; color: #ffd88a; }
.banner.ok   { background: #14251a; border-color: #1f3a24; color: #93e0a5; }

.linkbox {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.linkbox code {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: #9fd0ff;
  overflow-wrap: anywhere;
  font-family: ui-monospace, Consolas, monospace;
}

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.actions-row .btn-primary { width: auto; min-width: 150px; }

/* One block per device link from the checker (PC / Phone / TV). */
.linkrow {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.linkrow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.linkrow-label {
  font-size: 13px;
  font-weight: 600;
  color: #e6edf3;
}
.linkrow code {
  display: block;
  font-size: 12.5px;
  color: #9fd0ff;
  overflow-wrap: anywhere;
  font-family: ui-monospace, Consolas, monospace;
  margin-bottom: 10px;
}

.transcript {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.transcript summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}
.transcript pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  color: #b9c4cf;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  margin: 10px 0 0;
  max-height: 320px;
  overflow: auto;
}

/* Per-source report: what was tried, and what each bot answered. */
.attempts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.attempt {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
}
.attempt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.attempt-name { font-size: 13.5px; font-weight: 600; }
.attempt-state {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.attempt-said {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  color: #b9c4cf;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  margin: 9px 0 0;
  font-family: ui-monospace, Consolas, monospace;
}

footer {
  text-align: center;
  color: #5d6772;
  font-size: 12px;
  padding: 26px 16px 34px;
}
