:root {
  --green: #009640;
  --red: #e6003c;
  --blue: #0077b8;
  --dark: #080808;
  --white: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; background: var(--blue); color: var(--white); }
button, input { font: inherit; }
button { cursor: pointer; }

.display-page,
.button-page {
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--blue);
}

.map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 1;
}

.route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

.route-red,
.route-green {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.route-red {
  stroke: var(--red);
  stroke-width: 5;
  stroke-dasharray: 4 14;
}

.route-green {
  stroke: var(--green);
  stroke-width: 6;
}

.icons-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.venue-icon {
  position: absolute;
  width: 4.8828125%;
  height: 6.9444444%;
  object-fit: contain;
  transform: translate(-50%, -37.5%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .18));
}

.progress-marker {
  position: absolute;
  width: 1.6%;
  aspect-ratio: 1 / 1;
  border: 0.28vw solid var(--green);
  border-radius: 999px;
  background: var(--white);
  transform: translate(-50%, -50%);
  z-index: 7;
  box-shadow: 0 0 0 .18vw rgba(255, 255, 255, .85);
}

.berlino {
  position: absolute;
  width: 4.6%;
  height: auto;
  transform: translate(-50%, -88%) scaleX(var(--flip, 1));
  transform-origin: 50% 100%;
  z-index: 8;
  pointer-events: none;
  filter: drop-shadow(0 5px 6px rgba(0, 0, 0, .25));
}

.distance-box {
  position: absolute;
  top: 3.5%;
  right: 1.2%;
  width: 30.3%;
  min-height: 12.8%;
  background: var(--green);
  z-index: 20;
  padding: 1% 1% 1%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 0 0 .2vw rgba(0, 150, 64, .2);
}

.distance-label-small {
  font-size: clamp(12px, 1.45vw, 30px);
  font-weight: 800;
  font-style: italic;
  line-height: 1;
}

.distance-label-big {
  margin-top: .45vw;
  font-size: clamp(24px, 3vw, 74px);
  font-weight: 900;
  font-style: italic;
  line-height: .95;
  white-space: nowrap;
}

.distance-label-big strong { font-weight: 900; }

.thumb-rail {
  position: absolute;
  right: 1.1%;
  top: 17.5%;
  width: 18.9%;
  bottom: 2.1%;
  z-index: 19;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  gap: 1.65%;
  padding: .75%;
  background: rgba(0, 121, 194, .70);
}

.thumb-slot {
  position: relative;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.thumb-slot img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.thumb-next-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .7vw;
  padding: 0 4% 0 3.5%;
  background: rgba(230, 40, 69, .90);
  color: #fff;
  pointer-events: none;
}

.thumb-arrows {
  width: 18%;
  height: 78%;
  object-fit: contain;
  flex: 0 0 auto;
}

.thumb-next-label {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: .42vw;
  color: #fff;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -.04em;
  line-height: .9;
  white-space: nowrap;
  text-shadow: 0 .14vw .22vw rgba(0,0,0,.25);
}

.thumb-next-label span {
  font-size: clamp(11px, 1.08vw, 24px);
}

.thumb-next-label strong {
  font-size: clamp(20px, 1.5vw, 46px);
  font-weight: 900;
}

.fullscreen-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: #000;
  display: grid;
  place-items: center;
}

.fullscreen-overlay.hidden { display: none; }

.fullscreen-image,
.ad-video,
.jubel-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.fullscreen-image,
.ad-video { object-fit: cover; }
.jubel-video { object-fit: contain; z-index: 2; pointer-events: none; opacity: 1; transition: opacity .18s ease; }
.jubel-video.is-prewarming { opacity: 0; }
.jubel-video.hidden { display: none; }

.ad-overlay { z-index: 120; }
.ad-video { background: #000; }

/* Control */
.control-page {
  min-height: 100vh;
  background: linear-gradient(145deg, #0077b8 0%, #005b8e 100%);
  color: #111;
  padding: 32px;
}

.control-wrap {
  width: min(980px, 100%);
  margin: 0 auto;
}

.control-header {
  color: #fff;
  margin-bottom: 26px;
}

.control-header h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 72px);
  line-height: .9;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: -.04em;
}

.control-header p {
  margin: 8px 0 0;
  font-size: 20px;
  font-weight: 700;
}

.control-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, .18);
}

.control-card h2 {
  margin: 0 0 18px;
  font-size: 28px;
  line-height: 1.05;
}

.control-card label {
  display: block;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.input-row,
.button-row,
.stat-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.input-row input {
  width: 180px;
  padding: 14px 16px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 26px;
  font-weight: 900;
}

button {
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  padding: 14px 20px;
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .2);
  transition: transform .08s ease, box-shadow .08s ease, opacity .2s ease;
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}

button.danger { background: #e6003c; }
button[disabled] { opacity: .5; cursor: wait; }

.hint {
  color: #555;
  margin: 12px 0 0;
  line-height: 1.45;
}

.stat-line span { font-weight: 800; font-size: 20px; }
.stat-line strong { font-size: 36px; color: var(--green); }
.status-card p { margin: 0; font-weight: 700; color: #333; }

/* Button */
.button-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--blue);
  cursor: pointer;
  user-select: none;
  outline: none;
}

.button-screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.button-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background .16s ease;
}

.button-screen.pressed::after { background: rgba(255,255,255,.22); }

.button-feedback {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.8);
  opacity: 0;
  z-index: 2;
  background: var(--green);
  color: #fff;
  padding: 2.4vw 4vw;
  border-radius: 999px;
  font-size: clamp(32px, 7vw, 110px);
  font-weight: 900;
  font-style: italic;
  box-shadow: 0 20px 60px rgba(0,0,0,.32);
  pointer-events: none;
}

.button-feedback.show {
  animation: popFeedback .8s ease forwards;
}

@keyframes popFeedback {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  70% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(.95); }
}

.button-status {
  position: absolute;
  left: 2vw;
  bottom: 2vw;
  z-index: 2;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  padding: .75vw 1.2vw;
  border-radius: .7vw;
  font-size: clamp(14px, 1.4vw, 24px);
  font-weight: 800;
}

@media (max-width: 700px) {
  .control-page { padding: 18px; }
  .control-card { padding: 18px; border-radius: 14px; }
  .input-row input { width: 140px; }
  .button-row button { width: 100%; }
}

.ad-video-list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.ad-video-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 2px solid #e6e6e6;
  border-radius: 14px;
  background: #f7f9fb;
}

.ad-video-item.is-active {
  border-color: var(--green);
  background: rgba(0, 150, 64, .08);
}

.ad-video-meta {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.ad-video-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111;
  font-size: 18px;
}

.ad-video-meta span {
  color: #555;
  font-size: 14px;
  font-weight: 700;
}

.ad-video-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.ad-video-actions button {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
}

button.secondary-danger {
  background: #777;
}

.empty-list {
  padding: 14px;
  background: #f7f9fb;
  border-radius: 12px;
}

@media (max-width: 700px) {
  .ad-video-item { align-items: stretch; flex-direction: column; }
  .ad-video-actions button { flex: 1; }
}
