* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #3a3a3a;
  font-family: Arial, sans-serif;
}

body {
  user-select: none;
}

.game-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.minigame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 300px;
}

/* A Lua eredeti 300x16-os sávja */
.bar {
  position: relative;
  width: 300px;
  height: 16px;
  background: #4a4a4a;
  overflow: hidden;
}

.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 16px;
  background: #e74c3c;
  transform: translateX(0);
  transition: background-color 40ms linear;
}

.icon-row {
  width: 300px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.state-icon {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
}

/* Az arc két rétegből áll: egy halvány körvonal (regular) mindig
   látszik alatta, és egy színes solid réteg, amit a JS clip-path-tal
   alulról felfelé "tölt fel" - pont mint a Lua dxDrawImageSection-je.
   Nincs külön háttér-elem, maga az emoji telik fel. */
.icon-outline,
.icon-fill {
  position: absolute;
  font-size: 24px;
}

.state-icon.angry .icon-outline {
  color: #e74c3c;
}

.state-icon.center-face .icon-outline {
  color: #3ddc97;
}

.icon-fill {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 60ms linear;
}

.state-icon.angry .icon-fill {
  color: #e74c3c;
}

.state-icon.center-face .icon-fill {
  color: #3ddc97;
}

.icon-outline,
.icon-fill {
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .5));
}

.countdown {
  color: white;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 38px;
  line-height: 1;
  text-shadow: 1px 1px 0 #000;
  min-height: 38px;
}

.hint {
  width: max-content;
  max-width: 100%;
  padding: 7px 11px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .35);
  color: #eee;
  font-size: 13px;
  opacity: .9;
  text-align: center;
}

.result {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 30px;
  color: white;
  text-shadow: 2px 2px 0 #000;
  min-height: 30px;
}

@media (max-width: 500px) {
  .minigame { width: 260px; }
  .bar { width: 260px; }
  .icon-row { width: 260px; }
}

/* === Toplista === */
.leaderboard {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  width: 200px;
  max-height: 70vh;
  background: rgba(0, 0, 0, .35);
  border-radius: 8px;
  padding: 16px;
  color: #eee;
  font-size: 14px;
  overflow-y: auto;
}

.leaderboard-title {
  margin: 0 0 10px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: .5px;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  text-align: center;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .05);
}

.leaderboard-list li .lb-rank {
  color: #3ddc97;
  font-weight: bold;
  width: 18px;
  flex: none;
}

.leaderboard-list li .lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-list li .lb-time {
  color: #bbb;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.leaderboard-empty {
  text-align: center;
  color: #999;
  font-size: 13px;
  margin: 0;
}

@media (max-width: 900px) {
  .leaderboard {
    position: static;
    transform: none;
    width: 260px;
    margin: 16px auto 0;
  }
  .game-wrap {
    position: relative;
    height: auto;
    min-height: 100vh;
    padding: 40px 0;
  }
}

/* === Névbekérő modal === */
.name-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: auto;
}

.name-modal-backdrop.visible {
  display: flex;
}

.name-modal {
  background: #2e2e2e;
  border-radius: 10px;
  padding: 24px 28px;
  width: 260px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

.name-modal-title {
  margin: 0 0 4px;
  color: #3ddc97;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 26px;
}

.name-modal-time {
  margin: 0 0 14px;
  color: #eee;
  font-size: 14px;
}

.name-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid #555;
  background: #1f1f1f;
  color: #fff;
  font-size: 14px;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.name-input:focus {
  outline: 2px solid #3ddc97;
}

.name-modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.name-modal-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: 5px;
  border: none;
  background: #444;
  color: #eee;
  font-size: 13px;
  cursor: pointer;
}

.name-modal-btn:hover {
  background: #555;
}

.name-modal-btn.primary {
  background: #3ddc97;
  color: #113;
  font-weight: bold;
}

.name-modal-btn.primary:hover {
  background: #4be7a5;
}

.discord-login-hint {
  margin: 0 0 12px;
  color: #ccc;
  font-size: 13px;
}

.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #5865f2;
  color: #fff;
  font-weight: bold;
}

.discord-btn:hover {
  background: #6b74f5;
}

.discord-btn i {
  font-size: 16px;
}

.back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .35);
  color: #eee;
  font-size: 13px;
  text-decoration: none;
  z-index: 5;
  pointer-events: auto;
}

.back-link:hover {
  background: rgba(0, 0, 0, .55);
}
