/* =================== VARIABLES =================== */
:root {
  --beige: #F5F0E8;
  --beige-dark: #E8E0D0;
  --beige-light: #FAF7F2;
  --accent: #C4956A;
  --accent-dark: #A87B52;
  --accent-light: #F0E0CC;
  --brown: #8B7355;
  --brown-dark: #6B5740;
  --text: #4A3F35;
  --text-muted: #9E9284;
  --white: #FFFFFF;
  --green: #4CAF50;
  --red: #E53935;
  --shadow: 0 2px 12px rgba(75,55,30,0.08);
  --shadow-lg: 0 8px 30px rgba(75,55,30,0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

/* =================== RESET =================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Tajawal', sans-serif;
  background: var(--beige);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('Background.png') center/cover no-repeat;
  opacity: 0.08;
  z-index: 0;
  pointer-events: none;
}

/* =================== SCREENS =================== */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.5); opacity: 0; }
}
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes timerShrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* =================== JOIN SCREEN =================== */
.join-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  background: transparent;
  position: relative;
  z-index: 1;
}
.logo-section {
  text-align: center;
  margin-bottom: 30px;
  animation: popIn 0.5s ease;
}
.logo-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(196,149,106,0.3);
}
.logo-icon .material-icons-round { font-size: 40px; color: white; }
.logo-text {
  font-size: 36px;
  font-weight: 800;
  color: var(--brown-dark);
}
.logo-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 4px;
}
.join-card {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.5s ease 0.1s both;
}
.join-card h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 22px;
  color: var(--brown-dark);
}
.input-group {
  margin-bottom: 18px;
}
.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--brown);
  margin-bottom: 8px;
}
.input-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--beige-dark);
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 18px;
  text-align: center;
  background: var(--beige-light);
  color: var(--text);
  transition: border-color 0.3s, box-shadow 0.3s;
  outline: none;
  letter-spacing: 2px;
}
.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(196,149,106,0.15);
}
.input-group input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0;
  font-size: 15px;
}
.code-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.code-input-row input { flex: 1; }
.btn-scan {
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  cursor: pointer;
}
.btn-scan:hover { background: var(--accent-dark); }
.qr-scanner-area {
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--accent);
  animation: fadeIn 0.3s ease;
}
.qr-scanner-area #qr-reader {
  width: 100%;
}
.qr-scanner-area #qr-reader video { border-radius: 0 !important; }
#qr-reader__scan_region { min-height: 200px; }
#qr-reader { border: none !important; }
.btn-cancel-scan {
  width: 100%;
  background: var(--beige-dark);
  color: var(--text);
  border: none;
  padding: 10px;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.3s;
}
.btn-cancel-scan:hover { background: var(--beige); }
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.error-msg {
  background: #FFF3F0;
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 14px;
  text-align: center;
}
.hidden { display: none !important; }

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(196,149,106,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196,149,106,0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-large { padding: 16px 32px; font-size: 18px; border-radius: var(--radius); }
.btn-full { width: 100%; }
.btn-icon { padding: 12px; border-radius: 50%; min-width: 48px; min-height: 48px; }

/* =================== WAITING SCREEN =================== */
#screen-waiting {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--beige) 0%, var(--beige-dark) 100%);
}
.center-box {
  text-align: center;
  padding: 40px 20px;
  position: relative;
}
.pulse-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -70%);
  width: 100px; height: 100px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
.waiting-icon {
  width: 80px; height: 80px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  position: relative;
}
.waiting-icon .material-icons-round { font-size: 40px; color: var(--accent-dark); }
.center-box h2 { font-size: 24px; margin-bottom: 8px; color: var(--brown-dark); }
.student-name-display {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-light);
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.waiting-text { color: var(--text-muted); font-size: 15px; margin-bottom: 16px; }
.session-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brown);
  font-weight: 600;
  font-size: 18px;
  background: var(--white);
  padding: 8px 18px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.session-info .material-icons-round { font-size: 20px; color: var(--accent); }

/* =================== QUESTION SCREEN =================== */
#screen-question {
  flex-direction: column;
  background: var(--beige-light);
}
.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.q-progress {
  font-size: 16px;
  font-weight: 700;
  color: var(--brown);
}
.q-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-dark);
  background: var(--accent-light);
  padding: 8px 16px;
  border-radius: 20px;
}
.q-timer .material-icons-round { font-size: 22px; }
.q-timer.urgent { color: var(--red); background: #FFEBEE; }
.question-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}
.question-text {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--brown-dark);
  margin-bottom: 28px;
  line-height: 1.6;
}
.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.option-btn {
  width: 100%;
  padding: 18px 20px;
  background: var(--white);
  border: 2px solid var(--beige-dark);
  border-radius: var(--radius);
  font-family: 'Tajawal', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 12px;
}
.option-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.option-btn:active { transform: scale(0.98); }
.option-btn.selected {
  border-color: var(--accent-dark);
  background: linear-gradient(135deg, var(--accent-light), #F5E6D3);
  color: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(196,149,106,0.2);
}
.option-btn.correct {
  border-color: var(--green);
  background: #E8F5E9;
  color: #2E7D32;
}
.option-btn.wrong {
  border-color: var(--red);
  background: #FFEBEE;
  color: #C62828;
  opacity: 0.7;
}
.option-letter {
  min-width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--beige);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--brown);
  flex-shrink: 0;
}
.option-btn.selected .option-letter { background: var(--accent-dark); color: white; }
.option-btn.correct .option-letter { background: var(--green); color: white; }
.option-btn.wrong .option-letter { background: var(--red); color: white; }

/* Order type - drag style */
.order-item {
  width: 100%;
  padding: 16px 20px;
  background: var(--white);
  border: 2px solid var(--beige-dark);
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  user-select: none;
}
.order-item:active { cursor: grabbing; background: var(--accent-light); }
.order-num {
  min-width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 800;
}
.order-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: auto;
}
.order-arrows button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  font-size: 18px;
  line-height: 1;
}
.order-arrows button:hover { color: var(--accent-dark); }
.order-submit {
  margin-top: 16px;
}

/* Input answer */
.input-answer-area {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}
.input-answer-area input {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid var(--beige-dark);
  border-radius: var(--radius-sm);
  font-family: 'Tajawal', sans-serif;
  font-size: 17px;
  background: var(--white);
  color: var(--text);
  outline: none;
}
.input-answer-area input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(196,149,106,0.15);
}

/* True/False buttons */
.tf-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.tf-btn {
  padding: 30px 20px;
  border: 2px solid var(--beige-dark);
  border-radius: var(--radius);
  background: var(--white);
  font-family: 'Tajawal', sans-serif;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.tf-btn .material-icons-round { font-size: 36px; }
.tf-btn.true-btn:hover, .tf-btn.true-btn.selected { background: #E8F5E9; border-color: var(--green); color: #2E7D32; }
.tf-btn.false-btn:hover, .tf-btn.false-btn.selected { background: #FFEBEE; border-color: var(--red); color: #C62828; }
.tf-btn.correct { background: #C8E6C9 !important; border-color: var(--green) !important; color: #1B5E20 !important; }
.tf-btn.wrong { background: #FFCDD2 !important; border-color: var(--red) !important; color: #B71C1C !important; opacity: 0.7; }

/* =================== ANSWER RESULT SCREEN =================== */
#screen-answer-result {
  align-items: center;
  justify-content: center;
  background: var(--beige-light);
}
.result-icon {
  width: 100px; height: 100px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  animation: popIn 0.4s ease;
}
.result-icon .material-icons-round { font-size: 56px; color: white; }
.result-icon.correct { background: var(--green); }
.result-icon.wrong { background: var(--red); }
.result-icon.timeout { background: var(--text-muted); }
.center-box .result-points {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-dark);
  margin: 12px 0;
}
.result-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  padding: 10px 20px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  font-size: 16px;
  color: var(--brown);
}
.result-score strong { font-size: 20px; color: var(--accent-dark); }

/* =================== LEADERBOARD SCREEN =================== */
#screen-leaderboard {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--beige-light), var(--beige));
}
.leaderboard-container {
  width: 100%;
  max-width: 500px;
  padding: 30px 20px;
  text-align: center;
}
.leaderboard-container h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 22px;
  color: var(--brown-dark);
  margin-bottom: 20px;
}
.leaderboard-container h2 .material-icons-round { color: var(--accent); }
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease both;
}
.lb-item.me { border: 2px solid var(--accent); background: var(--accent-light); }
.lb-rank {
  min-width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--beige);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--brown);
}
.lb-item:nth-child(1) .lb-rank { background: #FFD700; color: #7A5C00; }
.lb-item:nth-child(2) .lb-rank { background: #C0C0C0; color: #555; }
.lb-item:nth-child(3) .lb-rank { background: #CD7F32; color: white; }
.lb-name { flex: 1; text-align: right; font-weight: 600; font-size: 15px; }
.lb-score { font-weight: 800; color: var(--accent-dark); font-size: 16px; }
.my-rank-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--accent-light), #F5E6D3);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}
.rank-number { font-size: 24px; font-weight: 800; color: var(--accent-dark); }
.rank-name { flex: 1; text-align: right; font-size: 18px; font-weight: 700; color: var(--brown-dark); }
.rank-score { font-size: 20px; font-weight: 800; color: var(--accent-dark); }

/* =================== FINAL SCREEN =================== */
#screen-final {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--beige) 0%, var(--beige-dark) 100%);
  position: relative;
  overflow: hidden;
}
.final-container {
  text-align: center;
  padding: 30px 20px;
  position: relative;
  z-index: 2;
}
.final-medal {
  width: 100px; height: 100px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  animation: popIn 0.5s ease;
}
.final-medal .material-icons-round { font-size: 56px; }
.final-medal.gold { background: linear-gradient(135deg, #FFD700, #FFA000); }
.final-medal.gold .material-icons-round { color: #7A5C00; }
.final-medal.silver { background: linear-gradient(135deg, #E0E0E0, #9E9E9E); }
.final-medal.silver .material-icons-round { color: #424242; }
.final-medal.bronze { background: linear-gradient(135deg, #CD7F32, #A0522D); }
.final-medal.bronze .material-icons-round { color: white; }
.final-medal.other { background: var(--accent-light); }
.final-medal.other .material-icons-round { color: var(--accent-dark); }
#final-rank-text { font-size: 28px; font-weight: 800; color: var(--brown-dark); margin-bottom: 8px; }
.final-score { font-size: 22px; color: var(--accent-dark); font-weight: 700; margin-bottom: 24px; }
.final-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-bottom: 30px;
}
.podium-item {
  width: 90px;
  text-align: center;
  animation: slideUp 0.4s ease both;
}
.podium-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--brown-dark);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.podium-bar {
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
  font-size: 18px;
}
.podium-item:nth-child(1) .podium-bar { background: #C0C0C0; height: 70px; }
.podium-item:nth-child(2) .podium-bar { background: linear-gradient(180deg, #FFD700, #FFA000); height: 90px; }
.podium-item:nth-child(3) .podium-bar { background: #CD7F32; height: 55px; }
.podium-score { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 4px; }
.confetti-area {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px; height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

/* =================== DISCUSSION SCREEN =================== */
#screen-discussion {
  flex-direction: column;
  background: var(--beige-light);
}
.discussion-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.disc-header {
  background: var(--white);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.disc-header h2 {
  font-size: 20px;
  color: var(--brown-dark);
  margin-bottom: 8px;
}
.disc-timer-bar {
  height: 4px;
  background: var(--accent);
  border-radius: 4px;
  transition: width 1s linear;
}
.disc-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.disc-msg {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}
.disc-msg.mine { background: var(--accent-light); border: 1px solid var(--accent); }
.disc-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.disc-msg-name { font-weight: 700; font-size: 14px; color: var(--brown-dark); }
.disc-msg-time { font-size: 12px; color: var(--text-muted); }
.disc-msg-body { font-size: 15px; line-height: 1.6; }
.disc-msg-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.disc-msg-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}
.disc-msg-actions button:hover { color: var(--accent-dark); }
.disc-msg-actions button.liked { color: var(--red); }
.disc-input-bar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  background: var(--white);
  border-top: 1px solid var(--beige-dark);
}
.disc-input-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--beige-dark);
  border-radius: 25px;
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  background: var(--beige-light);
  color: var(--text);
  outline: none;
}
.disc-input-bar input:focus { border-color: var(--accent); }

/* =================== GROUP SCREEN =================== */
#screen-group {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--beige-light), var(--beige));
}
.group-container {
  width: 100%;
  max-width: 500px;
  padding: 30px 20px;
}
.group-header-card {
  text-align: center;
  margin-bottom: 20px;
}
.group-header-card .material-icons-round {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 8px;
}
.group-header-card h2 { font-size: 22px; color: var(--brown-dark); }
.my-team-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}
.my-team-card h3 {
  font-size: 20px;
  color: var(--accent-dark);
  margin-bottom: 16px;
  text-align: center;
}
.team-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.team-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--beige-light);
  border-radius: var(--radius-sm);
}
.team-member.me { background: var(--accent-light); border: 1px solid var(--accent); }
.member-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
}
.member-name { font-weight: 600; font-size: 15px; }
.member-role {
  margin-right: auto;
  font-size: 12px;
  color: var(--accent-dark);
  background: var(--accent-light);
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 600;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 768px) {
  .join-card, .question-body, .leaderboard-container, .group-container { width: 100%; max-width: 100%; }
  .final-container { padding: 20px; }
  .discussion-container { max-width: 100%; }
}

@media (max-width: 480px) {
  .join-card { padding: 20px 16px; width: 100%; }
  .join-container { padding: 20px 12px; }
  .logo-icon { width: 64px; height: 64px; border-radius: 18px; }
  .logo-icon img { width: 48px !important; height: 48px !important; }
  .logo-text { font-size: 28px; }
  .btn, button { min-height: 44px; }
  .code-input-row input { font-size: 16px; }
  .btn-scan { padding: 0 12px; }
  .qr-scanner-area #qr-reader { min-height: 200px; }
  .btn-cancel-scan { min-height: 44px; }
  .waiting-icon .material-icons-round { font-size: 48px; }
  .center-box h2 { font-size: 20px; }
  .question-text { font-size: 18px; }
  .option-btn { padding: 14px 16px; font-size: 15px; min-height: 48px; }
  .tf-btn { padding: 20px 16px; font-size: 18px; }
  .q-timer { font-size: 18px; }
  .result-icon .material-icons-round { font-size: 56px; }
  .result-points { font-size: 20px; }
  .leaderboard-container { padding: 16px; }
  .leaderboard-list { gap: 6px; }
  .final-medal .material-icons-round { font-size: 56px; }
  #final-rank-text { font-size: 22px; }
  .final-podium { gap: 8px; }
  .podium-item { width: 70px; }
  .podium-bar { height: 40px; }
  .podium-item:first-child .podium-bar { height: 60px; }
  .disc-feed { max-height: 55vh; }
  .disc-input-bar input { min-height: 44px; font-size: 15px; }
  .disc-input-bar .btn { min-height: 44px; }
  .my-team-card { padding: 16px; }
  .team-members-list { gap: 8px; }
}

@media (max-width: 360px) {
  .join-container { padding: 12px 8px; }
  .join-card { padding: 16px 12px; }
  .logo-text { font-size: 24px; }
  .question-text { font-size: 16px; }
  .option-btn { font-size: 14px; padding: 12px; }
  .podium-item { width: 60px; }
}
