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

:root {
  --font-scale: 1.3;
  --board-bg: linear-gradient(165deg, #d4d7dc 0%, #b8bcc4 35%, #c8ccd4 70%, #a8adb6 100%);
  --board-text: #0a1e4a;
  --board-border: #3d444c;
  --frame-outer: #2a3038;
  --frame-inner: #6a727c;
  --row-border: #4a5058;
  --header-ratio: 0.18;
  --header-emblem-scale: 1.5;
      --frame-w: 3px;
      --ticker-height: clamp(2rem, 4.8vh, 3.6rem);
      --section-header-bg: rgba(224, 242, 254, 0.88);
    }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #9aa0a8;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.board {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--board-bg);
  color: var(--board-text);
  overflow: hidden;
  border: 6px solid var(--frame-outer);
  box-shadow:
    inset 0 0 0 2px #e8eaed,
    inset 0 0 0 5px var(--frame-inner),
    inset 0 0 0 8px var(--frame-outer);
}

.board-inner {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0.8vh 0.8vw 0.9vh;
  border: var(--frame-w) solid var(--frame-inner);
  box-shadow: inset 0 0 0 1px var(--frame-outer);
  position: relative;
}

.board-content {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.board-header {
  flex: 0 0 calc(var(--header-ratio) * 100dvh);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5vh 0.5vw;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.header-banner {
  width: 80%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 2rem);
}

.herb,
.header-clock {
  flex-shrink: 0;
  height: calc(var(--header-ratio) * 100dvh * 0.72 * var(--header-emblem-scale));
  max-height: calc(8vh * var(--header-emblem-scale));
  width: auto;
}

.herb {
  justify-self: start;
  object-fit: contain;
}

.header-clock {
  justify-self: end;
  aspect-ratio: 1;
  max-width: calc(8vh * var(--header-emblem-scale));
}

.analog-clock {
  display: block;
  width: auto;
  height: 100%;
}

.board-title {
  margin: 0;
  justify-self: center;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
  font-size: clamp(1.8rem, calc(5.4vh * var(--font-scale)), 4.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.board-content.board-sea {
  position: relative;
  z-index: 0;
  overflow: hidden;
  border-radius: 0.5rem;
  flex: 1 1 0;
  min-height: 0;
}

.board-content.board-sea--wave::before,
.board-content.board-sea--wave::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}

.board-content.board-sea--wave::before {
  background: linear-gradient(
    118deg,
    #dbeafe 0%,
    #e0f2fe 12%,
    #bae6fd 24%,
    #f0f9ff 38%,
    #93c5fd 50%,
    #e0f7fa 62%,
    #eff6ff 76%,
    #7dd3fc 88%,
    #dbeafe 100%
  );
  background-size: 320% 320%;
  animation: tablica-sea-flow 11s ease-in-out infinite alternate;
  filter: saturate(1.06);
}

.board-content.board-sea--wave::after {
  opacity: 0.32;
  background:
    radial-gradient(ellipse 92% 58% at 6% 16%, rgba(56, 189, 248, 0.28) 0%, transparent 50%),
    radial-gradient(ellipse 88% 62% at 96% 88%, rgba(14, 165, 233, 0.24) 0%, transparent 47%),
    radial-gradient(ellipse 68% 48% at 48% 38%, rgba(191, 219, 254, 0.3) 0%, transparent 54%),
    radial-gradient(ellipse 52% 72% at 78% 8%, rgba(125, 211, 252, 0.22) 0%, transparent 48%),
    radial-gradient(ellipse 40% 40% at 22% 82%, rgba(224, 242, 254, 0.32) 0%, transparent 55%);
  animation: tablica-sea-ripple 8s ease-in-out infinite alternate;
}

@keyframes tablica-sea-flow {
  0%   { background-position: 8% 22%; }
  50%  { background-position: 62% 38%; }
  100% { background-position: 32% 58%; }
}

@keyframes tablica-sea-ripple {
  0%   { transform: translate(-2%, -1.5%) rotate(-0.4deg) scale(1); opacity: 0.28; }
  50%  { transform: translate(2%, 1.5%) rotate(0.35deg) scale(1.03); opacity: 0.38; }
  100% { transform: translate(-1.5%, 2%) rotate(-0.25deg) scale(1.02); opacity: 0.32; }
}

@media (prefers-reduced-motion: reduce) {
  .board-content.board-sea--wave::before,
  .board-content.board-sea--wave::after {
    animation: none;
  }
  .board-content.board-sea--wave::after {
    transform: none;
    opacity: 0.3;
  }
}

.board-columns-wrap {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.herb-watermark {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.herb-watermark img {
  position: absolute;
  top: 50%;
  height: 140%;
  width: auto;
  max-width: min(44vw, 56vh);
  object-fit: contain;
  object-position: center center;
  opacity: 0.11;
  filter: brightness(0);
  transform: translateY(-50%);
  will-change: left;
}

@media (prefers-reduced-motion: reduce) {
  .herb-watermark img {
    will-change: auto;
  }
}

.board-body {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.4vw;
  padding: 0.35vh 0.5vw 0.5vh;
}

.board-body--4col {
  grid-template-columns: repeat(4, 1fr);
}

.board-body--1col {
  grid-template-columns: 1fr;
  max-width: min(72vw, 110vh);
  margin: 0 auto;
  width: 100%;
}

.board-body > .floor-column {
  position: relative;
  z-index: 1;
}

.floor-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border: var(--frame-w) solid rgba(59, 130, 180, 0.45);
  box-shadow: 0 0.15rem 0.6rem rgba(30, 64, 175, 0.08);
  background: rgba(255, 255, 255, 0.94);
}

.floor-header {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  text-align: center;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: var(--hdr-font, clamp(0.55rem, 1.2vh, 0.9rem));
  padding: 0.4vh 0.3vw;
  border-bottom: var(--frame-w) solid var(--row-border);
  background: var(--section-header-bg);
  line-height: 1.15;
}

.floor-column.col-other .floor-header {
  font-size: var(--hdr-font-small, clamp(0.48rem, 1.05vh, 0.8rem));
}

.column-items {
  position: relative;
  z-index: 3;
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(var(--row-count, 1), 1fr);
}

.column-item {
  min-height: 0;
  border-bottom: 1px solid var(--row-border);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
}

.column-item:last-child {
  border-bottom: none;
}

.cell-entry {
  display: grid;
  grid-template-columns: 1fr minmax(2rem, 32%);
  width: 100%;
  font-size: var(--row-font, clamp(0.5rem, 1.2vh, 0.9rem));
  line-height: 1.14;
}

.cell-entry .col-name {
  padding: 0.2vh 0.35vw;
  font-weight: 700;
  font-size: 1.15em;
  overflow: hidden;
  border-right: 1px solid rgba(74, 80, 88, 0.4);
  align-self: stretch;
  display: flex;
  align-items: center;
  word-break: break-word;
  hyphens: auto;
}

.cell-entry .col-rooms {
  padding: 0.2vh 0.35vw 0.2vh 0.3vw;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: stretch;
  text-align: right;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-line;
}

.cell-subheader,
.cell-building {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.25vh 0.3vw;
  font-size: var(--sub-font, clamp(0.5rem, 1.1vh, 0.85rem));
  background: var(--section-header-bg);
  letter-spacing: 0.04em;
}

.cell-building {
  font-weight: 700;
  text-transform: none;
  font-size: var(--bld-font, clamp(0.48rem, 1vh, 0.78rem));
  line-height: 1.12;
}

/* Wariant 3.1: pełna tablica → powolne znikanie wszystkiego poza piwnicą */
.morph-fade-out-column,
.morph-fade-out-item {
  transition: opacity 0.15s ease;
}

.board-morph--stage-isolated.board-body--4col {
  grid-template-columns: 1fr;
  max-width: min(72vw, 110vh);
  margin: 0 auto;
  width: 100%;
}

.board-morph--stage-isolated .morph-fade-out-column,
.board-morph--stage-isolated .morph-fade-out-item {
  display: none !important;
}

/* Czerwony pasek informacyjny (marquee) — wariant 3 */
.board--has-ticker .board-content {
  flex: 1 1 0;
  min-height: 0;
}

.board-ticker {
  flex: 0 0 0;
  height: 0;
  max-height: 0;
  z-index: 1;
  background: linear-gradient(180deg, #d4223a 0%, #b91c1c 55%, #991b1b 100%);
  color: #fff;
  box-shadow: 0 -0.15rem 0.6rem rgba(153, 27, 27, 0.35);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition:
    height 0.65s ease,
    max-height 0.65s ease,
    flex-basis 0.65s ease,
    opacity 0.65s ease;
}

.board-ticker.is-visible {
  flex: 0 0 var(--ticker-height);
  height: var(--ticker-height);
  max-height: var(--ticker-height);
  opacity: 1;
  pointer-events: auto;
}

.board-ticker__viewport {
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.board-ticker__text {
  margin: 0;
  padding: 0 0.5rem;
  white-space: nowrap;
  font-weight: 700;
  font-size: clamp(0.85rem, 2.2vh, 1.45rem);
  letter-spacing: 0.03em;
  text-transform: none;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .board-ticker__text {
    transform: none !important;
    transition: none !important;
  }
}

/* Strona indeksu (podgląd wariantów) */
.board-index {
  min-height: 100vh;
  padding: 2rem;
  font-family: "Segoe UI", sans-serif;
  background: #e8ecf0;
  color: #0a1e4a;
}

.board-index h1 {
  margin-top: 0;
}

.board-index ul {
  line-height: 1.8;
}

.board-index a {
  color: #1d4ed8;
  font-weight: 600;
}
