:root {
  --bg: #090512;
  --panel: rgba(20, 12, 35, 0.72);
  --line: #ba78ff;
  --line-glow: rgba(186, 120, 255, 0.7);
  --text: #f6ebff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, #1e1038, #090512 48%);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.container {
  width: min(1200px, 95vw);
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero {
  text-align: center;
  margin-bottom: 18px;
}

.neon-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: #f3d8ff;
  text-shadow: 0 0 8px var(--line), 0 0 18px var(--line-glow);
}

.subtitle {
  margin: 10px 0 0;
  color: #e9ddff;
}

.small {
  opacity: 0.85;
  font-size: 0.9rem;
}

.card {
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 0 10px var(--line-glow), inset 0 0 14px rgba(186, 120, 255, 0.2);
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
}

.neon-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--line);
  box-shadow: 0 0 10px var(--line-glow), inset 0 0 14px rgba(186, 120, 255, 0.2);
  background: rgba(18, 9, 33, 0.9);
}

.neon-table th,
.neon-table td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.neon-table td {
  font-size: clamp(0.9rem, 0.95vw, 1.15rem);
}

.neon-table th {
  color: #ffd8ff;
  text-shadow: 0 0 8px rgba(255, 216, 255, 0.7);
}

.neon-row {
  --rowColor: #f9a8ff;
  color: var(--rowColor);
  text-shadow: 0 0 6px color-mix(in srgb, var(--rowColor) 72%, white 28%);
}

.logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

input,
button {
  border: 1px solid #5b3386;
  border-radius: 10px;
  background: #140b24;
  color: var(--text);
  padding: 9px 10px;
}

button {
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(186, 120, 255, 0.4);
}

button:hover {
  filter: brightness(1.08);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.footer {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-link {
  color: #f4bcff;
}

body.public-tv .container {
  --tv-col-grifo: 11.2%;
  --tv-col-cerveza: 32.8%;
  --tv-col-estilo: 14.6%;
  --tv-col-graduacion: 10.1%;
  --tv-col-cana: 15.7%;
  --tv-col-pinta: 15.6%;
  width: 100vw;
  max-width: none;
  margin: 0;
  height: 100vh;
  padding: 0.7vh 0.9vw 1vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.6vh;
}

body.public-tv .table-wrap {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
}

body.public-tv .neon-table {
  width: 100%;
  height: 100%;
  table-layout: fixed;
  border: 3px solid #f2f2f2;
  box-shadow: inset 0 0 0 1px #ffffff;
  background: #020202;
  font-family: Impact, "Arial Narrow", "Franklin Gothic Medium", sans-serif;
  font-size: clamp(1.05rem, 1.35vw, 1.7rem);
}

/* Ajusta estos anchos por columna segun lo que necesites en TV */
body.public-tv .neon-table col#col-grifo {
  width: var(--tv-col-grifo);
}

body.public-tv .neon-table col#col-cerveza {
  width: var(--tv-col-cerveza);
}

body.public-tv .neon-table col#col-estilo {
  width: var(--tv-col-estilo);
}

body.public-tv .neon-table col#col-graduacion {
  width: var(--tv-col-graduacion);
}

body.public-tv .neon-table col#col-precio-cana {
  width: var(--tv-col-cana);
}

body.public-tv .neon-table col#col-precio-pinta {
  width: var(--tv-col-pinta);
}

body.public-tv .tv-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2vw, 24px);
  background: #040404;
  border: 3px solid #f2f2f2;
  border-bottom-width: 2px;
  padding: 0.5vh 0.7vw;
}

body.public-tv .social-chip {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  color: #8ff6ff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(0.8rem, 1.1vw, 1.22rem);
  text-shadow: 0 0 6px rgba(143, 246, 255, 0.95);
}

body.public-tv .social-icon {
  width: clamp(16px, 1.4vw, 24px);
  height: clamp(16px, 1.4vw, 24px);
  flex: 0 0 auto;
}

body.public-tv .social-label {
  line-height: 1;
}

body.public-tv .social-chip:first-child {
  color: #7fd7ff;
}

body.public-tv .social-chip:last-child {
  color: #ff9ee2;
}

body.public-tv .neon-table th,
body.public-tv .neon-table td {
  border: 2px solid #f2f2f2;
  padding: clamp(4px, 0.5vw, 8px) clamp(3px, 0.45vw, 8px);
  font-size: clamp(0.95rem, 1.1vw + 0.2rem, 1.65rem);
  line-height: 0.95;
  text-transform: uppercase;
}

body.public-tv .neon-table td.cell-fit {
  font-size: clamp(0.7rem, 0.85vw + 0.15rem, 1.2rem);
  line-height: 1;
}

body.public-tv .neon-table th {
  height: auto; /* Adjusted to allow dynamic height based on content */
  background: #090909;
  font-size: clamp(1rem, 1.2vw + 0.2rem, 1.5rem);
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.88);
}

body.public-tv .logo {
  width: clamp(48px, 4.7vw, 84px);
  height: clamp(48px, 4.7vw, 84px);
  border-radius: 50%;
  border: 1px solid #f6f6f6;
  display: block;
  margin: 0 auto;
}

body.public-tv .logo-empty {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.4);
}

body.public-tv .tap-no {
  font-size: clamp(1.3rem, 1.7vw, 2.4rem);
  line-height: 0.9;
}

body.public-tv .grifo-cell {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: clamp(4px, 0.5vw, 10px);
}

body.public-tv .beer-cell {
  text-align: left;
  letter-spacing: 0.04em;
  padding: 0;
}

body.public-tv .beer-split {
  display: grid;
  grid-template-rows: 1fr 1fr;
  min-height: 100%;
}

body.public-tv .beer-cell--single {
  padding: 0;
}

body.public-tv .beer-main,
body.public-tv .style-line {
  display: block;
}

body.public-tv .beer-main,
body.public-tv .beer-brewery {
  display: flex;
  align-items: center;
  padding: 0 clamp(6px, 0.9vw, 18px);
}

body.public-tv .beer-cell--single .beer-main {
  height: 100%;
  width: 100%;
  padding: 0 clamp(6px, 0.9vw, 18px);
}

body.public-tv .beer-brewery {
  border-top: 1px solid rgba(242, 242, 242, 0.85);
}

body.public-tv .beer-main {
  font-size: clamp(1.2rem, 1.5vw, 2rem);
}

body.public-tv #tapBody .beer-cell,
body.public-tv #tapBody .beer-split {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

body.public-tv #tapBody .beer-main,
body.public-tv #tapBody .beer-brewery {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.public-tv #tapBody .beer-main.text-scroll,
body.public-tv #tapBody .beer-brewery.text-scroll {
  display: inline-flex;
  width: max-content;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  animation: beer-text-marquee var(--marquee-duration, 8s) linear infinite;
  will-change: transform;
}

body.public-tv .beer-brewery,
body.public-tv .style-cell {
  font-size: clamp(0.82rem, 0.95vw, 1.3rem);
}

body.public-tv .style-cell {
  letter-spacing: 0.03em;
}

body.public-tv .degree-cell {
  font-size: clamp(1.45rem, 2vw, 2.5rem);
}

body.public-tv .price-cell {
  font-size: clamp(1.55rem, 1.95vw, 2.5rem);
}

/* Escala tipografias del cuerpo de tabla (tapBody) +30% */
body.public-tv #tapBody td {
  font-size: calc(clamp(0.95rem, 1.1vw + 0.2rem, 1.65rem) * 1.3);
}

body.public-tv #tapBody td.cell-fit {
  font-size: calc(clamp(0.7rem, 0.85vw + 0.15rem, 1.2rem) * 1.3);
}

body.public-tv #tapBody .tap-no {
  font-size: calc(clamp(1.3rem, 1.7vw, 2.4rem) * 1.3);
}

body.public-tv #tapBody .beer-main {
  font-size: calc(clamp(1.2rem, 1.5vw, 2rem) * 1.3);
}

body.public-tv #tapBody .beer-brewery {
  font-size: calc(clamp(0.82rem, 0.95vw, 1.3rem) * 1.3);
}

body.public-tv #tapBody .style-cell {
  font-size: calc(clamp(0.82rem, 0.95vw, 1.3rem) * 2);
}

body.public-tv #tapBody .degree-cell {
  font-size: calc(clamp(1.45rem, 2vw, 2.5rem) * 1.3);
}

body.public-tv #tapBody .price-cell {
  font-size: calc(clamp(1.55rem, 1.95vw, 2.5rem) * 1.3);
}

/* Solo cuando hay overflow vertical activamos compactacion de filas */
body.public-tv.tv-fit-rows .neon-table th,
body.public-tv.tv-fit-rows .neon-table td {
  height: var(--tv-row-height, 72px);
  padding: clamp(2px, calc(var(--tv-row-height, 72px) * 0.08), 10px)
    clamp(2px, calc(var(--tv-row-height, 72px) * 0.12), 8px);
  font-size: clamp(0.6rem, calc(var(--tv-row-height, 72px) * 0.34), 1.65rem);
  line-height: 1;
}

body.public-tv.tv-fit-rows .neon-table th {
  font-size: clamp(0.62rem, calc(var(--tv-row-height, 72px) * 0.38), 1.5rem);
}

body.public-tv.tv-fit-rows .logo {
  width: clamp(40px, calc(var(--tv-row-height, 72px) * 1.44), 184px);
  height: clamp(40px, calc(var(--tv-row-height, 72px) * 1.44), 184px);
}

@media (max-width: 900px) {
  .container {
    width: min(100%, 100vw);
    padding: 14px 10px 24px;
  }

  .card {
    padding: 12px;
    border-radius: 12px;
  }

  .toolbar,
  .footer,
  .check-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body:not(.public-tv) .neon-table {
    min-width: 860px;
  }

  body:not(.public-tv) .neon-table th,
  body:not(.public-tv) .neon-table td {
    padding: 8px;
    font-size: 0.9rem;
  }

  body:not(.public-tv) .logo {
    width: 56px;
    height: 56px;
  }

  body.public-tv .container {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    height: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  body.public-tv .tv-social {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }

  body.public-tv .social-chip {
    font-size: 0.74rem;
    letter-spacing: 0.02em;
  }

  body.public-tv .table-wrap {
    height: auto;
    overflow: auto;
    border-radius: 10px;
  }

  body.public-tv .neon-table {
    min-width: 760px;
    width: max(100%, 760px);
    height: auto;
    table-layout: fixed;
    font-size: 0.95rem;
  }

  body.public-tv .neon-table th,
  body.public-tv .neon-table td {
    padding: 8px 6px;
    line-height: 1.02;
  }

  body.public-tv .neon-table col#col-grifo {
    width: 110px;
  }

  body.public-tv .neon-table col#col-cerveza {
    width: 250px;
  }

  body.public-tv .neon-table col#col-estilo {
    width: 165px;
  }

  body.public-tv .neon-table col#col-graduacion {
    width: 90px;
  }

  body.public-tv .neon-table col#col-precio-cana,
  body.public-tv .neon-table col#col-precio-pinta {
    width: 110px;
  }

  body.public-tv .logo,
  body.public-tv.tv-fit-rows .logo {
    width: 52px;
    height: 52px;
  }

  body.public-tv #tapBody .beer-main {
    font-size: clamp(2rem, 6.8vw, 2.7rem);
  }

  body.public-tv #tapBody .beer-brewery {
    font-size: clamp(1.64rem, 5.6vw, 2.16rem);
  }

  body.public-tv #tapBody .style-cell {
    font-size: clamp(0.82rem, 2.8vw, 1.08rem);
  }

  body.public-tv #tapBody .tap-no {
    font-size: clamp(1rem, 4vw, 1.5rem);
  }

  body.public-tv.tv-fit-rows .neon-table th,
  body.public-tv.tv-fit-rows .neon-table td {
    height: auto;
  }
}

@keyframes beer-text-marquee {
  0%,
  14% {
    transform: translateX(0);
  }

  56%,
  84% {
    transform: translateX(calc(-1 * var(--marquee-shift, 0px)));
  }

  100% {
    transform: translateX(0);
  }
}

@media (max-width: 700px) {
  .grid-form {
    grid-template-columns: 1fr;
  }

  .toolbar h2,
  .hero h1 {
    margin: 0;
  }

  body:not(.public-tv) .table-wrap {
    overflow: visible;
  }

  body:not(.public-tv) .neon-table,
  body:not(.public-tv) .neon-table thead,
  body:not(.public-tv) .neon-table tbody,
  body:not(.public-tv) .neon-table tr,
  body:not(.public-tv) .neon-table td {
    display: block;
    width: 100%;
  }

  body:not(.public-tv) .neon-table {
    min-width: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  body:not(.public-tv) .neon-table thead {
    display: none;
  }

  body:not(.public-tv) .neon-table tr {
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(18, 9, 33, 0.82);
    box-shadow: 0 0 8px var(--line-glow);
  }

  body:not(.public-tv) .neon-table td {
    border: 0;
    border-bottom: 1px dashed rgba(186, 120, 255, 0.55);
    text-align: left;
    white-space: normal;
    padding: 8px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }

  body:not(.public-tv) .neon-table td:last-child {
    border-bottom: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  body:not(.public-tv) .neon-table td::before {
    content: attr(data-label);
    flex: 0 0 92px;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: #ffd8ff;
    letter-spacing: 0.04em;
    opacity: 0.92;
  }

  body:not(.public-tv) .neon-table td button {
    min-width: 110px;
  }

  body:not(.public-tv) .neon-table td img.logo {
    margin-left: auto;
  }
}
