:root {
  --bg: #f4f0ff;
  --ink: #14182b;
  --muted: #5c647a;
  --line: rgba(20, 24, 43, 0.08);
  --white: rgba(255, 255, 255, 0.94);
  --solid: #ffffff;
  --coral: #ff5a3c;
  --teal: #0fb5a8;
  --violet: #6d5efc;
  --gold: #f6c445;
  --blue: #2f7bff;
  --green: #17b26a;
  --shadow: 0 20px 50px rgba(47, 28, 92, 0.12);
  --radius: 28px;
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

h1,
h2,
.letter-ball,
.big,
.brand-name {
  font-family: "Baloo Bhaijaan 2", "IBM Plex Sans Arabic", sans-serif;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 10% -10%, #ffd7c8 0%, transparent 55%),
    radial-gradient(800px 480px at 100% 0%, #c9f3ee 0%, transparent 50%),
    radial-gradient(700px 500px at 80% 110%, #ddd6ff 0%, transparent 55%),
    var(--bg);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.55;
  animation: drift 12s ease-in-out infinite alternate;
}

.orb-a {
  width: 220px;
  height: 220px;
  background: #ffb199;
  top: 12%;
  right: -40px;
}

.orb-b {
  width: 180px;
  height: 180px;
  background: #8ae0d6;
  bottom: 8%;
  left: -30px;
  animation-delay: -4s;
}

.orb-c {
  width: 140px;
  height: 140px;
  background: #c4b6ff;
  top: 42%;
  left: 18%;
  animation-delay: -7s;
}

@keyframes drift {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-18px) scale(1.06);
  }
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 22px;
  display: flex;
  justify-content: center;
}

.screen {
  width: min(860px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.45s ease;
}

@keyframes rise {
  from {
    transform: translateY(10px);
  }
  to {
    transform: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(160deg, #ff7a5c, #ff4d2e);
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  box-shadow: 0 8px 18px rgba(255, 77, 46, 0.28);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero {
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  color: var(--violet);
  font-weight: 700;
  border-radius: 999px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.subtitle {
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
}

.letter-ball {
  width: min(168px, 42vw);
  height: min(168px, 42vw);
  margin: 18px auto 14px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(160deg, #ff7d5c, #ff3d2e);
  color: white;
  display: grid;
  place-items: center;
  font-size: clamp(5rem, 16vw, 7.2rem);
  font-weight: 800;
  line-height: 1;
  box-shadow:
    0 22px 50px rgba(255, 61, 46, 0.28),
    inset 0 -18px 30px rgba(120, 10, 0, 0.18);
  animation: float 3.2s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.card {
  background: var(--white);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.row {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  text-align: right;
}

.field span {
  font-weight: 700;
  color: var(--ink);
}

.code-board {
  text-align: center;
  background: #1b2033;
  color: white;
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: var(--shadow);
}

.code-board p {
  font-weight: 700;
  opacity: 0.8;
}

.code-board strong {
  display: block;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: clamp(3rem, 10vw, 5.2rem);
  line-height: 1.1;
  margin: 6px 0 8px;
}

.code-board span {
  display: block;
  font-weight: 600;
  opacity: 0.78;
}

.roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.role-card {
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: #ffffff;
  border-radius: 28px;
  padding: 22px 18px;
  text-align: right;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.role-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 40px rgba(47, 28, 92, 0.16);
}

.role-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  margin-bottom: 14px;
}

.role-card.student .role-icon {
  background: #d7ecff;
}

.role-card.teacher .role-icon {
  background: #e6e1ff;
}

a.teacher-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.hint {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.letters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.letter-pick {
  height: 64px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 18px;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  cursor: pointer;
}

.letter-pick.on {
  background: #1b2033;
  color: white;
  border-color: #1b2033;
}

.letter-pick[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quiz-card {
  border: 0;
  background: white;
  border-radius: 28px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

.quiz-card:hover {
  transform: translateY(-4px);
}

.letter-ball.mini {
  width: 84px;
  height: 84px;
  font-size: 2.8rem;
  margin: 0 auto 12px;
  animation: none;
}

.quiz-card strong {
  display: block;
  font-size: 1.2rem;
}

.quiz-code {
  display: block;
  margin: 8px 0 4px;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.quiz-card em {
  font-style: normal;
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 700px) {
  .quiz-grid {
    grid-template-columns: 1fr;
  }
}

.role-card strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.role-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
}

button,
input {
  font-family: inherit;
  font-size: 1.08rem;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  font-weight: 600;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(109, 94, 252, 0.15);
}

.btn {
  border: 0;
  border-radius: 18px;
  padding: 15px 18px;
  font-weight: 700;
  cursor: pointer;
  color: white;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn-coral {
  background: linear-gradient(180deg, #ff7358, var(--coral));
}
.btn-teal {
  background: linear-gradient(180deg, #24c9bc, var(--teal));
}
.btn-violet {
  background: linear-gradient(180deg, #8a7dff, var(--violet));
}
.btn-ink {
  background: #1b2033;
}

.btn.ghost {
  background: rgba(20, 24, 43, 0.06);
  color: var(--ink);
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.error {
  color: #d12b2b;
  font-weight: 700;
  min-height: 1.3em;
}

.lobby-names {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px 8px 8px;
  font-weight: 700;
}

.chip i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #9fd0ff, #7ee0c8);
  font-style: normal;
  font-size: 0.85rem;
}

.chip.off {
  opacity: 0.4;
}

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

.progress {
  flex: 1;
  height: 10px;
  background: rgba(20, 24, 43, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--coral));
  border-radius: inherit;
}

.timer {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  background:
    conic-gradient(var(--violet) calc(var(--p, 100) * 1%), rgba(20, 24, 43, 0.1) 0),
    white;
  box-shadow: var(--shadow);
  position: relative;
}

.timer::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: white;
}

.timer span {
  position: relative;
  z-index: 1;
}

.prompt {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.35;
}

.big {
  text-align: center;
  font-size: clamp(3.4rem, 11vw, 6.2rem);
  font-weight: 800;
  line-height: 1;
  margin: 10px 0 2px;
}

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

.option {
  min-height: 96px;
  border: 0;
  border-radius: 24px;
  color: white;
  font-weight: 700;
  font-size: 1.28rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  box-shadow: 0 14px 28px rgba(20, 24, 43, 0.12);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.option:hover {
  transform: translateY(-3px);
}

.option .shape {
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.95);
  flex: none;
}

.option:nth-child(1) {
  background: linear-gradient(180deg, #ff7460, #ef3d2f);
}
.option:nth-child(1) .shape {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.option:nth-child(2) {
  background: linear-gradient(180deg, #4d94ff, #246dff);
}
.option:nth-child(2) .shape {
  transform: rotate(45deg);
  border-radius: 3px;
}

.option:nth-child(3) {
  background: linear-gradient(180deg, #ffd45c, #f5b400);
  color: var(--ink);
}
.option:nth-child(3) .shape {
  border-radius: 50%;
  background: var(--ink);
}

.option:nth-child(4) {
  background: linear-gradient(180deg, #36d08a, #12a85c);
}
.option:nth-child(4) .shape {
  border-radius: 4px;
}

.option.picked {
  outline: 4px solid var(--ink);
}

.option.right {
  outline: 4px solid #0b7a40;
  transform: scale(1.03);
}

.option.wrong {
  filter: grayscale(0.3);
  opacity: 0.45;
}

.option[disabled] {
  cursor: default;
}

.board {
  display: grid;
  gap: 8px;
}

.rank {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 14px;
  font-weight: 700;
}

.rank.me {
  background: #e8fffa;
  border-color: #9de8da;
}

.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 12px;
  align-items: end;
  text-align: center;
}

.place {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 18px 10px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.place .medal {
  font-size: 2rem;
}

.place.first {
  min-height: 220px;
  background: linear-gradient(180deg, #ffe9a3, #fff);
  order: 2;
}
.place.second {
  min-height: 180px;
  order: 1;
}
.place.third {
  min-height: 150px;
  order: 3;
}

.wait {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-weight: 500;
  text-align: center;
}

.feedback {
  text-align: center;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 2rem;
  font-weight: 800;
}

.feedback.good {
  color: #128a4f;
}
.feedback.bad {
  color: #d12b2b;
}

.counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-weight: 700;
}

.count-pill {
  background: #f7f5ff;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}

@media (max-width: 700px) {
  #app {
    padding: 16px;
  }
  .roles,
  .options,
  .podium {
    grid-template-columns: 1fr;
  }
  .place.first,
  .place.second,
  .place.third {
    min-height: auto;
    order: unset;
  }
}
