/* ─── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0a0a0a;
    --panel-bg:  #111111;
    --cell-bg:   #1a1a1a;
    --cell-edge: #2a2a2a;
    --amber:     #ffb300;
    --amber-dim: #996a00;
    --green:     #00ff88;
    --red:       #ff3333;
    --white:     #f0f0f0;
    --separator: #333;

    /* These are overridden by JS based on measured container size */
    --cell-w:    32px;
    --cell-h:    44px;
    --cell-font: 26px;
    --cell-gap:  2px;
    --row-gap:   4px;
    --flip-dur:  80ms;
}

html, body {
    width: 100%; height: 100%;
    background: var(--bg);
    color: var(--amber);
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    user-select: none;
}

/* ─── Layout ───────────────────────────────────────────────────── */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 10px;
}

#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    flex-shrink: 0;
}

#venue-name {
    font-size: clamp(13px, 2.2vh, 32px);
    font-weight: bold;
    letter-spacing: 0.25em;
    color: var(--white);
    text-shadow: 0 0 12px var(--amber);
}

#live-time {
    font-size: clamp(11px, 1.8vh, 26px);
    letter-spacing: 0.15em;
    color: var(--amber-dim);
}

/* ─── Board panel ──────────────────────────────────────────────── */
#board-panel {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--separator);
    border-radius: 6px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 0 0 1px #000;
    min-height: 0;
}

/* Column headers */
#col-headers {
    display: flex;
    margin-bottom: 8px;
    padding: 0 2px;
    flex-shrink: 0;
    gap: 4px;
}

.col-header {
    font-size: clamp(9px, 1.2vh, 16px);
    letter-spacing: 0.2em;
    color: var(--amber-dim);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

#divider {
    height: 1px;
    background: var(--separator);
    margin-bottom: 10px;
    flex-shrink: 0;
}

/* Beer list */
#board-scroll {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--row-gap);
    min-height: 0;
}

/* Promo view — same layout as beer list */
/* padding: 0 18px matches the two 18px column separators in the beer board,
   keeping the content area identical width so totalCols cells fill edge to edge */
#promo-scroll {
    flex: 1;
    overflow: hidden;
    flex-direction: column;
    gap: var(--row-gap);
    min-height: 0;
    justify-content: center;
    padding: 0 18px;
}

/* ─── Flip board rows ──────────────────────────────────────────── */
.beer-row {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0;
}

/* Vertical column divider */
.beer-row .flip-board + .flip-board {
    border-left: 2px solid #2a2a2a;
    margin-left: 8px;
    padding-left: 8px;
}

.flip-board {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow: hidden;
}

.flip-row {
    display: flex;
    gap: var(--cell-gap);
}

/* Fixed-width cells — cellW is calculated to fill the screen based on content */
.flip-cell {
    width: var(--cell-w);
    height: var(--cell-h);
    flex-shrink: 0;
    background: var(--cell-color, var(--cell-bg));
    border: 1px solid var(--cell-edge);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--cell-font);
    font-weight: bold;
    color: var(--amber);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04),
                inset 0 -1px 0 rgba(0,0,0,0.4);
}

/* Horizontal split line */
.flip-cell::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%; height: 1px;
    background: rgba(0,0,0,0.6);
    pointer-events: none;
}

.cell-inner {
    display: block;
    line-height: 1;
    transform-origin: center;
}

.cell-inner.flipping {
    animation: flip var(--flip-dur) ease-in-out;
}

/* 2D scaleY flip — same visual effect as 3D rotateX but GPU-composited,
   much cheaper on Pi / embedded hardware.
   flip2 is an identical alias used to restart the animation without a forced reflow. */
@keyframes flip {
    0%   { transform: scaleY(1); opacity: 1; }
    40%  { transform: scaleY(0); opacity: 0; }
    60%  { transform: scaleY(0); opacity: 0; }
    100% { transform: scaleY(1); opacity: 1; }
}
@keyframes flip2 {
    0%   { transform: scaleY(1); opacity: 1; }
    40%  { transform: scaleY(0); opacity: 0; }
    60%  { transform: scaleY(0); opacity: 0; }
    100% { transform: scaleY(1); opacity: 1; }
}

/* Unavailable beers */
.beer-row.unavailable .flip-cell { opacity: 0.35; color: var(--red); }

/* ─── Row separator line ───────────────────────────────────────── */
.row-sep {
    height: 1px;
    background: #1e1e1e;
    flex-shrink: 0;
}

/* ─── Footer ───────────────────────────────────────────────────── */
#footer {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px 0;
    border-top: 1px solid var(--separator);
    gap: 24px;
}

.footer-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
    will-change: opacity;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.footer-label {
    font-size: clamp(9px, 1.1vh, 14px);
    color: var(--amber-dim);
    letter-spacing: 0.15em;
}

/* ─── Marquee bar ──────────────────────────────────────────────── */
#marquee-bar {
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
    border-top: 1px solid var(--separator);
    padding: 4px 0;
    display: none;
}
#marquee-bar.active { display: block; }

.marquee-inner {
    display: inline-block;
    animation: marquee 30s linear infinite;
    font-size: clamp(10px, 1.3vh, 16px);
    color: var(--amber-dim);
    letter-spacing: 0.1em;
    will-change: transform;
}

@keyframes marquee {
    0%   { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* Scanline overlay removed — full-screen fixed layer hurts compositor
   performance on embedded hardware (Pi). Re-add if running on desktop only. */
