* { box-sizing: border-box; }
html, body { height: 100%; }
@font-face {
  font-family: 'UpheavTT';
  src: url('assets/upheavtt.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
body {
  margin: 0;
  font-family: 'UpheavTT', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #eee;
  background-color: #121212;
  background-image: url('assets/fond.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  border: 36px solid transparent;
  border-image: url('assets/CSS_Border.webp') 60 round;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
  height: 56px;
}

.poll-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: center;
  max-width: 60vw;
}

.poll-input {
  flex: 1 1 auto;
  min-width: 280px;
  max-width: 600px;
  height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #444;
  background: rgba(18, 18, 18, 0.65);
  color: #eee;
  font-family: 'UpheavTT', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  appearance: none;
  border: 1px solid #888;
  background: #1f1f1f;
  color: #eee;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'UpheavTT', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}

.count-picker { display: flex; gap: 8px; }
.count-picker-label { font-size: 25px; color: #eee; align-items: center; align-self: center; }
.count-btn {
  appearance: none;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #eee;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .05s;
}
.count-btn:hover { background: #252525; }
.count-btn.active { border-color: #888; background: #2a2a2a; }
.count-btn:active { transform: scale(0.98); }

.random-btn {
  appearance: none;
  border: none;
  background: transparent url('assets/bouton.png') center / contain no-repeat;
  color: #000;
  padding: 10px 24px;
  border-radius: 0;
  cursor: pointer;
  font-family: 'UpheavTT', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 400;
  font-size: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  min-width: 200px;
  margin-top: 25px;
}
.random-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

main {
  padding: 16px;
  height: calc(100dvh - 56px - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* clip overflow so items never pass topbar or bottom */
}
.columns {
  display: grid;
  grid-template-columns: repeat(var(--col, 1), minmax(0, 1fr));
  gap: 36px;
  align-items: start;
  justify-items: center;
  width: 75vw;
  margin-left: auto;
  margin-right: auto;
}

.slot {
  position: relative;
  width: min(30vw, 300px);
  margin-block: 0;
}

.viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden; /* default: do not show outside the square */
  border-radius: 12px;
  background-color: transparent;
  background-image: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.viewport.spinning {
  overflow: visible; /* show above/below only during spin */
}

/* Hide captions during animation */
body.is-spinning .caption {
  visibility: hidden;
}

.reel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
  z-index: 1;
}

.reel > div {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel img {
  display: block;
  width: 75%;
  height: 75%;
  object-fit: contain;
  padding: 34px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.frame-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 3;
  pointer-events: none;
  user-select: none;
}

.caption {
  text-align: center;
  margin-top: 10px;
  line-height: 1.2;
}
.caption .item-name { font-size: 30px; color: #f0f0f0; }
.caption .item-id { font-size: 20px; color: #bbb; margin-top: 4px; }

@media (max-width: 720px) {
  body { border-width: 24px; }
  .columns { width: 92vw; }
  .slot { width: 100%; }
  main { height: calc(100dvh - 56px - 48px); }
}

