@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.14);
  --text-main: #f1f2f6;
  --text-dim: rgba(241, 242, 246, 0.65);
  --accent: #7c9cff;
  --accent-2: #b18aff;
  --success: #3ddc97;
  --danger: #ff6b81;
  --radius: 20px;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background: #0b0c1a;
  position: relative;
}

/* پس‌زمینه گرادیانت متحرک تیره برای دیده شدن افکت شیشه */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: radial-gradient(circle at 15% 20%, rgba(124, 156, 255, 0.35), transparent 45%),
              radial-gradient(circle at 85% 15%, rgba(177, 138, 255, 0.3), transparent 45%),
              radial-gradient(circle at 50% 85%, rgba(61, 220, 151, 0.2), transparent 50%),
              linear-gradient(160deg, #0b0c1a, #10122a 60%, #0b0c1a);
  animation: bgShift 18s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(35deg); }
}

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  z-index: -1;
  opacity: 0.55;
  pointer-events: none;
}
.blob.one { width: 320px; height: 320px; background: #7c9cff; top: -80px; left: -80px; animation: float1 14s ease-in-out infinite; }
.blob.two { width: 380px; height: 380px; background: #b18aff; bottom: -120px; right: -100px; animation: float2 16s ease-in-out infinite; }
.blob.three { width: 260px; height: 260px; background: #3ddc97; bottom: 10%; left: 10%; animation: float1 12s ease-in-out infinite reverse; }

@keyframes float1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 30px); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, -40px); }
}

.app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---------- Glass core ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 1px rgba(0, 0, 0, 0.2),
    0 15px 45px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.glass::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -60%;
  width: 220%;
  height: 220%;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.06) 45%, transparent 60%);
  animation: shine-move 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine-move {
  0%, 100% { transform: translate(-8%, -8%) rotate(0deg); }
  50% { transform: translate(8%, 8%) rotate(3deg); }
}

.card {
  width: 100%;
  max-width: 460px;
  padding: 36px 32px;
}

.card.wide {
  max-width: 640px;
}

.hidden { display: none !important; }

h1, h2, h3 {
  font-weight: 700;
}

.title {
  font-size: 26px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #a9c1ff, #d7bfff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 26px;
}

input[type="text"], input[type="number"], textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: 0.25s;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.18);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

.btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.35), 0 8px 20px rgba(124,156,255,0.25);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.4), 0 12px 28px rgba(124,156,255,0.35);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.secondary {
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.15);
}

.btn.small {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

/* ---------- Lobby ---------- */
.lobby-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  margin-bottom: 18px;
}

.online-count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

.player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0 24px;
  max-height: 220px;
  overflow-y: auto;
}

.player-list li {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-list li .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.hint {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 14px;
}

/* ---------- Game screen ---------- */
.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.q-counter {
  font-size: 13px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.06);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}

.timer-wrap {
  position: relative;
  width: 54px;
  height: 54px;
}

.timer-wrap svg { transform: rotate(-90deg); }

.timer-track {
  fill: none;
  stroke: rgba(255,255,255,0.12);
  stroke-width: 5;
}

.timer-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.2s linear, stroke 0.3s;
}

.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.question-text {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.7;
  margin-bottom: 26px;
  min-height: 60px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  font-size: 15px;
  text-align: right;
  color: var(--text-main);
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.option:hover:not(.disabled) {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent);
  transform: translateX(-2px);
}

.option .letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.option.selected {
  border-color: var(--accent);
  background: rgba(124, 156, 255, 0.18);
}

.option.correct {
  border-color: var(--success);
  background: rgba(61, 220, 151, 0.18);
}

.option.wrong {
  border-color: var(--danger);
  background: rgba(255, 107, 129, 0.18);
}

.option.disabled {
  cursor: default;
  opacity: 0.85;
}

.answer-note {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  min-height: 20px;
  font-weight: 600;
}

.answer-note.correct-text { color: var(--success); }
.answer-note.wrong-text { color: var(--danger); }
.answer-note.wait-text { color: var(--text-dim); }

.scoreboard-mini {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scoreboard-mini .row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 10px;
}

.scoreboard-mini .row.me {
  background: rgba(124,156,255,0.12);
  color: var(--text-main);
}

/* ---------- Results ---------- */
.results-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 22px 0;
}

.results-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
}

.results-list li.winner {
  border-color: #ffd76a;
  background: rgba(255, 215, 106, 0.12);
  box-shadow: 0 0 24px rgba(255, 215, 106, 0.15);
}

.rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.results-list li.winner .rank {
  background: linear-gradient(135deg, #ffd76a, #ff9f6a);
  color: #2b1a00;
}

.r-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}

.r-score {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 22px;
  border-radius: 14px;
  background: rgba(20, 22, 40, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  z-index: 999;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error { border-color: rgba(255,107,129,0.5); }
.toast.success { border-color: rgba(61,220,151,0.5); }

/* ---------- Admin page ---------- */
.admin-wrap {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.field-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: block;
}

.field { margin-bottom: 16px; }

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 4px 4px 4px 12px;
  background: rgba(255,255,255,0.05);
}

.option-input-row input[type="text"] {
  border: none;
  background: transparent;
  padding: 10px 6px;
}
.option-input-row input[type="text"]:focus {
  box-shadow: none;
  background: transparent;
}

.option-input-row input[type="radio"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.q-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.q-list li {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
}

.q-list .q-text {
  font-weight: 600;
  margin-bottom: 8px;
}

.q-list .q-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.q-list .q-options span {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
}

.q-list .q-options span.correct {
  background: rgba(61,220,151,0.18);
  color: var(--success);
}

.top-link {
  position: fixed;
  top: 20px;
  left: 20px;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  z-index: 50;
}

.top-link:hover { color: var(--text-main); }

@media (max-width: 480px) {
  .card { padding: 26px 20px; }
  .options-grid { grid-template-columns: 1fr; }
}
