@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&display=swap");

:root {
  --theme-bg: #082838;
  --theme-primary: #ff8b2f;
  --theme-text: #f3f7f8;
  --bg-1: #061e28;
  --bg-2: #0b2c38;
  --bg-radial-1: #1a4b5f;
  --bg-radial-2: #143f50;
  --surface: #0f3642cc;
  --surface-strong: #0f3440;
  --ink: #f3f7f8;
  --ink-soft: #bdd0d7;
  --accent: #ff8b2f;
  --accent-soft: #ffb066;
  --placeholder: #173e4a;
  --topbar-border: #ffffff22;
  --topbar-bg-1: #113b48d9;
  --topbar-bg-2: #0d2f3ad9;
  --btn-border: #ffffff3b;
  --btn-bg: #ffffff15;
  --btn-ink: #e9f3f7;
  --progress-track: #ffffff22;
  --card-border: #ffffff1f;
  --card-bg-1: #0f3642cc;
  --card-bg-2: #0e313dd6;
  --logo-ring: #ffffff47;
  --logo-bg: #ffffff14;
  --placeholder-bg-1: #123b47c9;
  --placeholder-bg-2: #143f4cc9;
  --pairing-border: #ffffff28;
  --pairing-bg-1: #123a47e8;
  --pairing-bg-2: #0e2e39e8;
  --pairing-kicker: #aac6d0;
  --pairing-code: #ffb56f;
  --pairing-meta: #bdd0d7;
  --pairing-status: #d9e7ec;
  --pairing-btn-border: #ffffff43;
  --pairing-btn-bg: #ffffff14;
  --pairing-btn-ink: #f1f7f9;
  --danger: #f05e5e;
  --board-rows: 5;
  --logo-size: clamp(58px, 6vw, 92px);
  --logo-size-max: clamp(68px, 8.8vh, 128px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Sora", "Trebuchet MS", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, var(--bg-radial-1), transparent 34%),
    radial-gradient(circle at 88% 18%, var(--bg-radial-2), transparent 34%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

.tv-app {
  height: 100vh;
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
  grid-template-rows: auto 1fr;
}

.tv-app.hide-header {
  grid-template-rows: 1fr;
  padding-top: 0.8rem;
}

.tv-app.hide-header .topbar {
  display: none;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem 1.1rem 1rem;
  border: 1px solid var(--topbar-border);
  border-radius: 1.15rem;
  background: linear-gradient(120deg, var(--topbar-bg-1), var(--topbar-bg-2));
  backdrop-filter: blur(8px);
}

.tv-app:not(.hide-header) {
  gap: 0.72rem;
}

.tv-app:not(.hide-header) .topbar {
  padding: 0.62rem 1rem 0.78rem 0.88rem;
}

.tv-app:not(.hide-header) .brand-logo-wrap {
  width: clamp(54px, 5.1vw, 82px);
  height: clamp(54px, 5.1vw, 82px);
}

.tv-app:not(.hide-header) .brand-text h1 {
  font-size: clamp(1.28rem, 3.6vw, 3.4rem);
}

.tv-app:not(.hide-header) .brand-text p {
  margin-top: 0.2rem;
}

.tv-app:not(.hide-header) .beer-card {
  gap: 0.42rem;
  padding: 0.18rem 0.68rem 0.18rem 0.36rem;
}

.tv-app:not(.hide-header) .beer-logo-wrap {
  width: clamp(44px, 4.3vw, 72px);
  height: clamp(44px, 4.3vw, 72px);
}

.tv-app:not(.hide-header) .beer-name {
  font-size: clamp(0.96rem, 1.5vw, 1.56rem);
}

.tv-app:not(.hide-header) .brewery-name {
  font-size: clamp(0.78rem, 1.02vw, 1.08rem);
}

.tv-app:not(.hide-header) .beer-style {
  font-size: clamp(0.92rem, 1.14vw, 1.24rem);
}

.tv-app:not(.hide-header) .beer-prices {
  min-width: clamp(98px, 9.6vw, 150px);
}

.tv-app:not(.hide-header) .beer-price-line {
  grid-template-columns: 0.92em 4.9ch 5.8ch;
  font-size: clamp(0.76rem, 0.95vw, 0.98rem);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.brand-logo-wrap {
  width: var(--logo-size);
  height: var(--logo-size);
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid var(--logo-ring);
  background: var(--logo-bg);
  flex-shrink: 0;
}

.brand-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4.4vw, 4.2rem);
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.brand-text p {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.74rem, 1.1vw, 1rem);
}

.meta-wrap {
  text-align: right;
  flex-shrink: 0;
  display: grid;
  justify-items: end;
  gap: 0.28rem;
}

.clock {
  font-size: clamp(0.95rem, 1.9vw, 1.55rem);
  font-weight: 700;
}

.page-indicator {
  color: var(--ink-soft);
  font-size: clamp(0.72rem, 1.05vw, 0.95rem);
}

.fullscreen-btn {
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: inherit;
  font-size: clamp(0.62rem, 0.9vw, 0.82rem);
  padding: 0.24rem 0.6rem;
  cursor: pointer;
}

.page-progress-wrap {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 0.55rem;
  height: 4px;
  border-radius: 999px;
  background: var(--progress-track);
  overflow: hidden;
  z-index: 42;
  pointer-events: none;
}

.page-progress-bar {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
}

.board {
  min-height: 0;
  height: 100%;
  display: grid;
  gap: 0.55rem;
}

.board-two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--board-rows), minmax(0, 1fr));
}

.board-runtime {
  display: block;
  overflow: hidden;
}

.tv-runtime-screen {
  height: 100%;
  min-height: 0;
  display: grid;
  gap: 0.58rem;
}

.tv-runtime-screen-cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.tv-runtime-screen-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tv-runtime-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
}

.tv-runtime-column > * {
  min-height: 0;
}

.tv-runtime-column-empty {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 100%;
  border: 1px dashed var(--card-border);
  border-radius: 0.9rem;
  padding: 1rem;
  color: var(--ink-soft);
  font-size: clamp(0.72rem, 0.95vw, 0.94rem);
}

.tv-runtime-block {
  flex: 1 1 0;
  min-height: 0;
  border-radius: 0.95rem;
  border: 1px solid var(--card-border);
  background: linear-gradient(125deg, var(--card-bg-1), var(--card-bg-2));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tv-runtime-block-taplist {
  border: 0;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.tv-runtime-block-body {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
  padding: 0.42rem 0.58rem 0.52rem;
  overflow: hidden;
}

.tv-runtime-block-taplist .tv-runtime-block-body {
  padding: 0;
  gap: 0;
}

.tv-runtime-empty {
  margin: 0;
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink-soft);
  font-size: clamp(0.72rem, 0.94vw, 0.92rem);
}

.tv-runtime-list {
  min-height: 0;
  height: 100%;
  display: grid;
  gap: 0.36rem;
  align-content: start;
}

.tv-runtime-list-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 0.48rem;
}

.tv-runtime-list-tap {
  flex: 1 1 auto;
}

.tv-runtime-tap-board {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.tv-runtime-tap-board-1col {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(var(--board-rows, 1), minmax(0, 1fr));
}

.tv-runtime-list-tap-cols {
  display: grid;
  gap: 0.48rem;
  min-height: 0;
  height: 100%;
}

.tv-runtime-list-tap-cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.tv-runtime-list-tap-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tv-runtime-tap-col {
  min-height: 0;
  display: grid;
  gap: 0.36rem;
  grid-template-rows: repeat(var(--runtime-item-count, 1), minmax(0, 1fr));
}

.tv-runtime-tap-col .tv-runtime-item-tap,
.tv-runtime-tap-col > .card {
  height: 100%;
}

.tv-runtime-item {
  border: 1px solid #ffffff1e;
  border-radius: 0.75rem;
  background: #ffffff08;
  min-width: 0;
}

.tv-runtime-item-tap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.42rem;
  padding: 0.32rem 0.44rem 0.32rem 0.36rem;
}

.tv-runtime-item-tap.is-placeholder {
  background: #ffffff06;
}

.tv-runtime-logo-wrap {
  width: clamp(36px, 4.6vw, 68px);
  height: clamp(36px, 4.6vw, 68px);
  border-radius: 999px;
  border: 1px solid var(--logo-ring);
  background: var(--logo-bg);
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tv-runtime-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tv-runtime-logo-fallback {
  color: var(--ink-soft);
  font-weight: 700;
  letter-spacing: 0.07em;
  font-size: clamp(0.62rem, 0.82vw, 0.8rem);
}

.tv-runtime-item-main {
  min-width: 0;
  display: grid;
  gap: 0.06rem;
}

.tv-runtime-item-title,
.tv-runtime-item-meta,
.tv-runtime-item-submeta {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-runtime-item-title {
  color: var(--accent);
  font-size: clamp(0.82rem, 1.08vw, 1.16rem);
  font-weight: 800;
}

.tv-runtime-item-meta {
  color: var(--ink);
  font-size: clamp(0.76rem, 0.95vw, 1rem);
  font-weight: 600;
}

.tv-runtime-item-submeta {
  color: var(--ink-soft);
  font-size: clamp(0.72rem, 0.88vw, 0.92rem);
}

.tv-runtime-prices {
  min-width: clamp(92px, 9vw, 146px);
  display: grid;
  gap: 0.06rem;
  justify-items: stretch;
  align-content: center;
}

.tv-runtime-prices .beer-price-line {
  grid-template-columns: 0.92em 4.8ch 5.7ch;
  font-size: clamp(0.76rem, 0.92vw, 0.98rem);
  column-gap: 0.08rem;
}

.tv-runtime-list-wine .tv-runtime-group,
.tv-runtime-list-food .tv-runtime-group {
  border: 1px solid #ffffff1b;
  border-radius: 0.72rem;
  background: #ffffff08;
  padding: 0.34rem 0.42rem;
  display: grid;
  gap: 0.24rem;
}

.tv-runtime-list-wine {
  flex: 1 1 auto;
}

.tv-runtime-list-wine-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.48rem;
}

.tv-runtime-wine-col {
  min-height: 0;
  display: grid;
  gap: 0.36rem;
  align-content: start;
}

.tv-runtime-group-title {
  margin: 0;
  color: var(--accent);
  font-size: clamp(0.78rem, 0.98vw, 1.06rem);
  font-weight: 800;
}

.tv-runtime-group-subtitle {
  margin: 0.1rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.72rem, 0.88vw, 0.94rem);
  font-weight: 700;
}

.tv-runtime-item-wine,
.tv-runtime-item-food {
  border: 0;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px dashed #ffffff26;
  padding: 0.18rem 0;
}

.tv-runtime-item-wine:last-child,
.tv-runtime-item-food:last-child {
  border-bottom: 0;
}

.tv-runtime-item-wine {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.42rem;
}

.tv-runtime-item-price {
  color: #ffd09e;
  font-weight: 800;
  font-size: clamp(0.76rem, 0.95vw, 1.02rem);
  white-space: nowrap;
}

.tv-runtime-item-food-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.38rem;
}

.card {
  border-radius: 1rem;
  border: 1px solid var(--card-border);
  background: linear-gradient(125deg, var(--card-bg-1), var(--card-bg-2));
  display: grid;
  align-items: center;
  min-height: 0;
  overflow: hidden;
}

.beer-card {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.48rem;
  padding: 0.22rem 0.78rem 0.22rem 0.4rem;
  align-items: center;
  position: relative;
}

.beer-logo-wrap {
  width: clamp(48px, 4.8vw, 86px);
  height: clamp(48px, 4.8vw, 86px);
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: 999px;
  border: 1px solid var(--logo-ring);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  justify-self: center;
  align-self: center;
}

.beer-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.beer-logo-fallback {
  color: var(--ink-soft);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.beer-main {
  min-width: 0;
  align-self: center;
  margin-left: 20px;
}

.beer-mid {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

.beer-abv {
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(0.78rem, 0.95vw, 1rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.beer-prices {
  min-width: clamp(106px, 10.5vw, 164px);
  display: grid;
  gap: 0.06rem;
  justify-items: stretch;
  align-content: center;
  padding-right: 0;
}

.beer-price-line {
  display: grid;
  grid-template-columns: 0.98em 5.2ch 6.1ch;
  align-items: center;
  justify-content: end;
  column-gap: 0.1rem;
  font-size: clamp(0.8rem, 1.02vw, 1.06rem);
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.03;
}

.beer-price-line .price-icon {
  width: 1.04em;
  height: 1.34em;
  flex: 0 0 auto;
  opacity: 0.98;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  justify-self: center;
  display: block;
}

.beer-price-line .price-volume {
  text-align: right;
  font-variant-numeric: tabular-nums;
  justify-self: end;
}

.beer-price-line .price-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  justify-self: end;
}

.beer-price-line .price-icon--glass {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 96' fill='none'%3E%3Cdefs%3E%3ClinearGradient id='beerFill' x1='18' y1='26' x2='46' y2='92' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23f9cc2f'/%3E%3Cstop offset='1' stop-color='%23e3960f'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M14 20h36l-3.8 62.2A6 6 0 0 1 40.2 88H23.8a6 6 0 0 1-5.98-5.8L14 20Z' fill='url(%23beerFill)'/%3E%3Cpath d='M13.2 17.8h37.6c1.8 0 3.2 1.4 3.2 3.2 0 2.6-2 4.8-4.6 5l-31 .6c-3.6 0-7-1.6-8.8-4.4-1.1-1.8.2-4.4 3.6-4.4Z' fill='%23f6f8fb'/%3E%3Cpath d='M14 20h36l-3.8 62.2A6 6 0 0 1 40.2 88H23.8a6 6 0 0 1-5.98-5.8L14 20Z' stroke='%23ecf5f8' stroke-width='3'/%3E%3Cpath d='M18.2 35.2h2.8v44h-2.8z' fill='%23fff6c8' fill-opacity='.42'/%3E%3Cpath d='M44.4 34.6h2.2v42h-2.2z' fill='%23cb7f0c' fill-opacity='.42'/%3E%3Cpath d='M15.5 19.8h33' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

.beer-price-line .price-icon--bottle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 96' fill='none'%3E%3Cpath d='M26 10h12v10l4 6v7.5l2.8 51A6 6 0 0 1 38.8 91H25.2a6 6 0 0 1-5.98-6.5L22 33.5V26l4-6V10Z' fill='%233f2a1b'/%3E%3Cpath d='M24.4 38h15.2v35H24.4z' fill='%23f7bb1f'/%3E%3Cpath d='M26 10h12v10l4 6v7.5l2.8 51A6 6 0 0 1 38.8 91H25.2a6 6 0 0 1-5.98-6.5L22 33.5V26l4-6V10Z' stroke='%23ecf5f8' stroke-width='3'/%3E%3Cpath d='M27.2 44h2.3v28h-2.3z' fill='%23ffe4a6' fill-opacity='.65'/%3E%3Cpath d='M26 13h12' stroke='%23ecf5f8' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

.beer-name,
.brewery-name,
.beer-style {
  margin: 0;
}

.beer-name {
  color: var(--accent);
  font-size: clamp(1.05rem, 1.72vw, 1.76rem);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brewery-name {
  margin-top: 0.16rem;
  color: var(--ink-soft);
  font-size: clamp(0.82rem, 1.14vw, 1.18rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.beer-style {
  margin-top: 0.2rem;
  color: var(--accent);
  font-size: clamp(0.98rem, 1.28vw, 1.34rem);
  font-weight: 700;
}

.beer-style-abv {
  color: var(--ink-soft);
}

.placeholder-card {
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: center;
  padding: 0.5rem;
  background: linear-gradient(125deg, var(--placeholder-bg-1), var(--placeholder-bg-2));
}

.placeholder-logo-wrap {
  width: var(--logo-size);
  height: var(--logo-size);
  border-radius: 999px;
  background: var(--placeholder);
  border: 1px solid #ffffff36;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.placeholder-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-initials {
  color: var(--ink-soft);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.error-banner {
  margin-top: 0.3rem;
  color: var(--danger);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.pairing-panel {
  min-height: 0;
  display: grid;
  place-items: center;
}

.pairing-card {
  width: min(860px, 95vw);
  border-radius: 1.1rem;
  border: 1px solid var(--pairing-border);
  background: linear-gradient(125deg, var(--pairing-bg-1), var(--pairing-bg-2));
  padding: 1rem;
  display: grid;
  justify-items: center;
  gap: 0.46rem;
  text-align: center;
}

.pairing-kicker {
  margin: 0;
  color: var(--pairing-kicker);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pairing-card h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
}

.pairing-status {
  margin: 0;
  color: var(--pairing-status);
  font-size: clamp(0.82rem, 1.2vw, 1.02rem);
}

.pairing-code {
  font-size: clamp(2.2rem, 6.7vw, 4.7rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--pairing-code);
  line-height: 1;
  border: 1px solid var(--pairing-border);
  border-radius: 12px;
  padding: 0.34em 0.44em;
  background: var(--surface);
}

.pairing-meta {
  margin: 0;
  color: var(--pairing-meta);
  font-size: clamp(0.76rem, 1.05vw, 0.95rem);
  word-break: break-word;
}

.pairing-qr {
  width: clamp(130px, 20vw, 230px);
  height: auto;
  border-radius: 10px;
  border: 1px solid #ffffff36;
  background: #fff;
}

.pairing-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.pairing-btn {
  border: 1px solid var(--pairing-btn-border);
  border-radius: 999px;
  background: var(--pairing-btn-bg);
  color: var(--pairing-btn-ink);
  font-family: inherit;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .tv-app {
    padding: 0.55rem;
    gap: 0.55rem;
  }

  .topbar {
    padding: 0.62rem;
  }

  .tv-runtime-screen-cols-2,
  .tv-runtime-list-2col,
  .tv-runtime-list-tap-cols-2,
  .tv-runtime-list-wine-cols {
    grid-template-columns: 1fr;
  }
}
