:root {
  --bg-base: #070a12;
  --fg: #f8fafc;
  --mut: #94a3b8;
  --card: rgba(23, 30, 48, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --ok: #10b981;
  --acc: #3b82f6;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(circle at 12% 8%, rgba(59, 130, 246, 0.16), transparent 42%),
    radial-gradient(circle at 88% 85%, rgba(16, 185, 129, 0.12), transparent 45%),
    radial-gradient(circle at 50% 45%, rgba(139, 92, 246, 0.06), transparent 60%);
  background-attachment: fixed;
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}

main {
  width: 100%;
  max-width: 640px;
  padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 24px);
}

h1 {
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

h2 {
  font-size: 1rem;
  margin: 0 0 10px;
}

p {
  color: var(--mut);
  margin: 6px 0 14px;
}

a {
  color: var(--acc);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.card, .panel {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin: 14px 0;
}

#n {
  font-size: clamp(3.5rem, 12vw, 4.5rem);
  font-weight: 800;
  text-align: center;
  margin: 8px 0;
  letter-spacing: -0.03em;
}

input, textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--fg);
  font: inherit;
  margin-bottom: 10px;
  outline: none;
}

input:focus, textarea:focus {
  border-color: var(--acc);
}

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  width: 100%;
  margin-top: 8px;
  background: var(--acc);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

button:hover {
  opacity: 0.92;
}

button:active {
  transform: scale(0.98);
}

button.sec {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
}

.row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.row:last-child {
  border-bottom: none;
}

.row span:last-child {
  color: var(--fg);
  text-align: right;
  font-weight: 500;
}

#log {
  font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace;
  color: var(--mut);
  max-height: 230px;
  overflow: auto;
}

#log div b {
  color: var(--fg);
}
/* Estilos específicos para el Libro de visitas */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.msg {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.msg:last-child {
  border-bottom: none;
}

.msg b {
  display: block;
  margin-bottom: 2px;
}

.msg small {
  color: var(--mut);
}

#err {
  color: #ff5c5c;
  font-size: 14px;
  min-height: 20px;
  margin: 8px 0 0;
}
/* Estilos específicos para la Página de pruebas */
.ver {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 10px;
  font-weight: 700;
  color: var(--fg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

td {
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: none;
}

td:last-child {
  text-align: right;
  word-break: break-all;
  color: var(--fg);
  font-weight: 500;
}
/* Estilos específicos para la Sala (QR) */
.center {
  text-align: center;
}

#qr {
  background: #fff;
  padding: 14px;
  border-radius: 14px;
  display: inline-block;
  margin: 6px 0 10px;
}

#qr img {
  display: block;
}

#lnk {
  font-size: 13px;
  word-break: break-all;
}

#msgs {
  max-height: 260px;
  overflow: auto;
  margin-top: 12px;
}

.bub {
  padding: 8px 12px;
  border-radius: 12px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.06);
  width: fit-content;
  max-width: 90%;
}

.bub.yo {
  background: rgba(59, 130, 246, 0.28);
  margin-left: auto;
}

.bub small {
  display: block;
  color: var(--mut);
  font-size: 12px;
}
