/**
 * QSR customer-facing token display — TV / tablet / kiosk.
 */
.token-display {
  margin: 0;
  min-height: 100dvh;
  box-sizing: border-box;
  overflow-x: hidden;
  background: var(--zy-charcoal, #1a1f24);
  color: var(--zy-white, #fff);
  font-family: var(--zy-font-sans, system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
}

.token-display *,
.token-display *::before,
.token-display *::after {
  box-sizing: border-box;
}

.td-screen {
  min-height: 100dvh;
  max-width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 3vw, 2.5rem);
  gap: clamp(1.25rem, 3vh, 2.5rem);
}

.td-brand {
  text-align: center;
  flex-shrink: 0;
}

.td-logo-wrap {
  margin-bottom: clamp(0.5rem, 1.5vh, 1rem);
}

.td-logo {
  max-height: clamp(3rem, 8vh, 5.5rem);
  max-width: min(280px, 70vw);
  width: auto;
  height: auto;
  object-fit: contain;
}

.td-brand-fallback .td-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(2.75rem, 7vw, 4rem);
  height: clamp(2.75rem, 7vw, 4rem);
  border-radius: 14px;
  background: var(--zy-emerald, #0f6b5c);
  color: #fff;
  font-weight: 700;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: 0.5rem;
}

.td-restaurant-name {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.td-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vh, 3rem);
  min-height: 0;
}

.td-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(0.85rem, 2vw, 1.25rem);
  border-radius: var(--zy-radius-lg, 16px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.td-section-ready {
  background: rgba(15, 107, 92, 0.12);
  border-color: rgba(134, 239, 172, 0.22);
}

.td-section-title {
  margin: 0 0 clamp(0.75rem, 2vh, 1.25rem);
  font-size: clamp(0.85rem, 2.2vw, 1.1rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.td-section-title-ready {
  color: #86efac;
}

.td-token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 5.5rem), 1fr));
  gap: clamp(0.65rem, 1.8vw, 1.1rem);
  align-content: start;
  flex: 1;
  min-height: clamp(4rem, 12vh, 7rem);
  overflow: hidden;
}

@media (min-width: 768px) {
  .td-token-grid {
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  }
}

@media (min-width: 1280px) {
  .td-token-grid {
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  }
}

.td-token {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(3.5rem, 10vw, 5.5rem);
  padding: clamp(0.4rem, 1vw, 0.65rem);
  border-radius: var(--zy-radius-md, 12px);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: clamp(2rem, 7vw, 4.75rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.td-token-grid-ready .td-token {
  background: var(--zy-emerald, #0f6b5c);
  color: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.35);
  font-size: clamp(2.25rem, 8vw, 5.25rem);
}

.td-token--just-ready {
  animation: td-ready-pop 680ms ease-out;
}

@keyframes td-ready-pop {
  0% {
    transform: scale(0.92);
    opacity: 0.65;
    box-shadow: 0 0 0 0 rgba(134, 239, 172, 0);
  }
  45% {
    transform: scale(1.04);
    box-shadow: 0 0 0 6px rgba(134, 239, 172, 0.35);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .td-token--just-ready {
    animation: none;
  }
}

.td-empty {
  margin: 0;
  padding: clamp(1rem, 3vh, 2rem) 0.5rem;
  text-align: center;
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.td-rotation-hint {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
}

.td-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
}

.td-live {
  font-variant-numeric: tabular-nums;
}

.td-live.ok {
  color: rgba(134, 239, 172, 0.75);
}

.td-live.warn {
  color: rgba(253, 224, 71, 0.75);
}

.td-error {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  max-width: min(90vw, 28rem);
  margin: 0;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.92);
  color: #fecaca;
  font-size: 0.9rem;
  text-align: center;
}

@media (min-width: 1024px) and (min-height: 700px) {
  .td-board {
    flex-direction: row;
    align-items: stretch;
  }

  .td-section {
    flex: 1;
  }
}
