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

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

:root {
  --bg: #0f0c29;
  --bg2: #1a1040;
  --card: #1e1550;
  --card2: #261a60;
  --pink: #ff6b9d;
  --purple: #a855f7;
  --cyan: #22d3ee;
  --yellow: #facc15;
  --green: #4ade80;
  --text: #f0eaff;
  --muted: #a89ec9;
  --border: rgba(168,85,247,0.3);
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* ── STARS BACKGROUND ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 20%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(2px 2px at 10% 70%, rgba(168,85,247,0.5) 0%, transparent 100%),
    radial-gradient(2px 2px at 90% 10%, rgba(34,211,238,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 50%, rgba(255,255,255,0.3) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── HUB ── */
.hub {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 60px 24px;
}

.hub-header {
  text-align: center;
  margin-bottom: 56px;
}

.hub-header h1 {
  font-size: 3.2rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  letter-spacing: -1px;
}

.hub-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 400;
}

.hub-user-bar {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}
.hub-logout-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.hub-logout-link:hover {
  color: var(--pink);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 24px;
}

.game-card {
  background: linear-gradient(145deg, var(--card), var(--card2));
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 24px;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--cyan));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
}

.game-card.active::before { opacity: 1; }
.game-card.active { cursor: pointer; }

.game-card.active:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 60px rgba(168,85,247,0.35);
}

.game-card.coming-soon {
  opacity: 0.45;
  cursor: default;
}

.game-icon {
  font-size: 3.4rem;
  filter: drop-shadow(0 0 12px rgba(168,85,247,0.6));
}
.game-card-img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.fraud-card-icon {
  width: 110px;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.game-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-desc {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

.badge.play {
  background: linear-gradient(90deg, var(--pink), var(--purple));
  color: #fff;
  box-shadow: 0 4px 20px rgba(168,85,247,0.4);
}

.badge.soon {
  background: rgba(255,255,255,0.08);
  color: var(--muted);
}

/* ── SCREENS ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── SELECT SCREEN ── */
.select-container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
}

.select-container h1 {
  font-size: 2.6rem;
  font-weight: 800;
  text-align: center;
  margin: 16px 0 8px;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.select-subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 40px;
  font-size: 1rem;
}

.philosopher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
}

/* ── PHILOSOPHER CARD ── */
.phil-card {
  background: linear-gradient(160deg, var(--card), var(--card2));
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 28px 20px 20px;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.phil-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 16px 50px rgba(168,85,247,0.3);
  border-color: var(--purple);
}

/* ── PHILOSOPHER AVATAR ── */
.phil-avatar {
  width: 150px;
  height: 150px;
  margin: 0 auto 14px;
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--purple);
  box-shadow: 0 0 20px rgba(168,85,247,0.5);
}

.phil-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* blink eye overlays — only used when real image is set */
.blink-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  pointer-events: none;
}

/* SVG cartoon face */
.phil-svg-face {
  width: 100px;
  height: 100px;
}

.eye {
  animation: blink 4s infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.eye:nth-child(2) { animation-delay: 0.08s; }

@keyframes blink {
  0%, 90%, 100%  { transform: scaleY(1); }
  95%            { transform: scaleY(0.05); }
}

.phil-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.phil-era {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.phil-topic {
  font-size: 0.84rem;
  color: #a8c8d8;
  line-height: 1.4;
}

/* ── BACK LINK ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--purple);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.back-link:hover { opacity: 1; }

/* ── CHAT LAYOUT ── */
.chat-layout {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

.chat-sidebar {
  width: 270px;
  background: rgba(15,12,41,0.85);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex-shrink: 0;
}

/* ── SIDEBAR AVATAR ── */
.sidebar-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto 4px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--purple);
  box-shadow: 0 0 20px rgba(168,85,247,0.5);
  position: relative;
}

.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-avatar .phil-svg-face {
  width: 80px;
  height: 80px;
}

.philosopher-info h2 {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2px;
}

.philosopher-info .era {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.task-box {
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.25);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.82rem;
  color: #c8dce8;
  line-height: 1.5;
}

.task-box strong {
  color: var(--pink);
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.progress-box {
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-item {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s;
}

.progress-item.done { color: var(--green); }
.progress-item.done .prog-icon { color: var(--green); }
.prog-icon { font-size: 1rem; }

.msg-counter {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 4px 0;
}

.msg-counter span {
  color: var(--yellow);
  font-weight: 700;
}

.btn-evaluate {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  margin-top: auto;
  box-shadow: 0 4px 20px rgba(168,85,247,0.4);
  font-family: 'Poppins', sans-serif;
}
.btn-evaluate:hover { opacity: 0.9; transform: scale(1.02); }
.btn-evaluate:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: rgba(168,85,247,0.12);
  color: var(--purple);
  border: 1.5px solid rgba(168,85,247,0.4);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  font-family: 'Poppins', sans-serif;
}
.btn-secondary:hover { background: rgba(168,85,247,0.22); }

/* ── CHAT MAIN ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(15,12,41,0.6);
  backdrop-filter: blur(8px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.4); border-radius: 10px; }

.message {
  max-width: 75%;
  padding: 13px 17px;
  border-radius: 18px;
  font-size: 0.93rem;
  line-height: 1.65;
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message.philosopher {
  background: linear-gradient(135deg, rgba(30,21,80,0.95), rgba(38,26,96,0.95));
  border: 1px solid rgba(168,85,247,0.3);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.user {
  background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(255,107,157,0.2));
  border: 1px solid rgba(255,107,157,0.3);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message .sender {
  font-size: 0.7rem;
  color: var(--purple);
  margin-bottom: 5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.message.user .sender {
  color: var(--pink);
  text-align: right;
}

.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
}

.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; background: var(--pink); }
.typing span:nth-child(3) { animation-delay: 0.4s; background: var(--cyan); }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: rgba(15,12,41,0.85);
  backdrop-filter: blur(12px);
}

#chat-input {
  flex: 1;
  background: rgba(30,21,80,0.7);
  border: 1.5px solid rgba(168,85,247,0.3);
  border-radius: 14px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.92rem;
  padding: 11px 16px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
#chat-input:focus { border-color: var(--purple); }
#chat-input::placeholder { color: var(--muted); }
#chat-input:disabled { opacity: 0.4; }

.btn-send {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 11px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  align-self: flex-end;
  font-family: 'Poppins', sans-serif;
  box-shadow: 0 4px 16px rgba(168,85,247,0.35);
}
.btn-send:hover { opacity: 0.9; transform: scale(1.04); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── RESULT SCREEN ── */
.result-container {
  position: relative;
  z-index: 1;
  max-width: 540px;
  margin: 70px auto;
  padding: 44px 36px;
  background: linear-gradient(160deg, var(--card), var(--card2));
  border: 1.5px solid var(--border);
  border-radius: 28px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.result-medal {
  font-size: 5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(250,204,21,0.6));
  animation: pop 0.5s cubic-bezier(.34,1.56,.64,1);
}

@keyframes pop {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.result-container h2 {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}

.result-feedback {
  color: #c8dce8;
  font-size: 0.97rem;
  line-height: 1.65;
  margin-bottom: 24px;
}

.result-details {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.result-detail-item {
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.25);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 90px;
}

.result-detail-item strong {
  display: block;
  color: var(--yellow);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  text-decoration: none;
  display: block;
  font-family: 'Poppins', sans-serif;
  box-shadow: 0 6px 24px rgba(168,85,247,0.4);
}
.btn-primary:hover { opacity: 0.9; transform: scale(1.02); }

/* ── LIMIT NOTICE ── */
.limit-notice {
  background: rgba(250,204,21,0.1);
  border: 1.5px solid var(--yellow);
  border-radius: 14px;
  padding: 13px 17px;
  color: var(--yellow);
  font-size: 0.88rem;
  text-align: center;
  font-weight: 600;
  animation: fadeUp 0.3s ease;
}

/* ── BLINK EYES ── */
.blink-eye {
  position: absolute;
  background: #ececec;
  border-radius: 40%;
  transform: scaleY(0);
  transform-origin: center center;
  animation: eye-blink 5s infinite;
  pointer-events: none;
}
.blink-eye:nth-child(odd)  { animation-delay: 0.06s; }

@keyframes eye-blink {
  0%, 88%, 100% { transform: scaleY(0); }
  92%, 96%      { transform: scaleY(1); }
}

/* ── CONCEPT CHIPS ── */
.concept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.concept-chip {
  background: rgba(34,211,238,0.12);
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 0.76rem;
  color: var(--cyan);
  font-weight: 600;
}

.hidden { display: none !important; }

/* ── MATH GAME ── */
.math-topic-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  min-height: 100vh;
}
.math-main-title {
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.math-main-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 40px;
}
.level-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 28px;
  max-width: 960px;
  width: 100%;
}
.level-btn {
  padding: 9px 22px;
  border-radius: 50px;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.17s, border-color 0.17s, color 0.17s, transform 0.12s;
}
.level-btn:hover {
  border-color: #6c63ff;
  color: #6c63ff;
  transform: translateY(-1px);
}
.level-btn.active {
  background: #6c63ff;
  border-color: #6c63ff;
  color: #fff;
  font-weight: 600;
}

.math-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 960px;
  width: 100%;
}
.math-topic-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  font-family: 'Poppins', sans-serif;
  color: var(--text);
}
.math-topic-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple);
  box-shadow: 0 0 24px rgba(168,85,247,0.35);
}
.math-formula {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.math-topic-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--pink);
}
.math-topic-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}
.math-topic-card--exam {
  border-color: rgba(251,191,36,0.3);
}
.math-topic-card--exam:hover {
  border-color: #7a5800;
  box-shadow: 0 0 24px rgba(251,191,36,0.3);
}
.math-topic-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.math-topic-badge--nocalc {
  background: rgba(248,113,113,0.12);
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.3);
}
.math-topic-badge--calc {
  background: rgba(74,222,128,0.12);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,0.3);
}

.math-game-screen {
  min-height: 100vh;
  padding: 0 8px 8px;
  position: relative;
}
.math-bear-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.math-bear-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 8px;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22);
}
.math-bear-eye {
  position: absolute;
  background: #f4f4f2;
  border-radius: 40%;
  transform: scaleY(0);
  transform-origin: center center;
  animation: bear-blink 6s infinite;
  pointer-events: none;
  z-index: 1;
}
.math-bear-eye:nth-child(2) { animation-delay: 0.07s; }
@keyframes bear-blink {
  0%, 88%, 100% { transform: scaleY(0); }
  92%, 96%      { transform: scaleY(1); }
}
.math-layout {
  display: flex;
  gap: 12px;
  height: calc(100vh - 44px);
  width: 100%;
}
.math-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 380px;
  min-width: 320px;
  flex-shrink: 0;
}
.math-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.math-left.panel-full {
  flex: 1;
  width: auto;
  min-width: 0;
}
.math-problem-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.continue-banner {
  background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(236,72,153,0.10));
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text);
}
.continue-banner.hidden { display: none; }
.continue-btns { display: flex; gap: 8px; flex-shrink: 0; }
.continue-btn-yes {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.continue-btn-no {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  cursor: pointer;
}
.math-save-btn {
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.28);
  border-radius: 7px;
  color: var(--purple);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  transition: background 0.2s;
}
.math-save-btn:hover { background: rgba(168,85,247,0.26); }
.math-save-btn:disabled { opacity: 0.6; cursor: default; }
.math-problem-box-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.math-problem-toggle {
  flex-shrink: 0;
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.28);
  border-radius: 6px;
  color: var(--purple);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  line-height: 1.4;
  transition: background 0.2s;
}
.math-problem-toggle:hover {
  background: rgba(168,85,247,0.26);
}
.math-problem-content {
  margin-top: 12px;
}
.math-problem-content.collapsed {
  display: none;
}
.math-problem-box.collapsed {
  padding-bottom: 14px;
}
.math-topic-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-bottom: 8px;
}
.math-problem-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pink);
  margin-bottom: 10px;
}
.math-problem-text {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 16px;
  white-space: pre-line;
}
.math-next-btn {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 9px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.math-next-btn:hover { opacity: 0.85; }

.math-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-height: 0;
}
.math-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(168,85,247,0.12);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--purple);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 6px;
}
.math-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.math-points-counter {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan);
  white-space: nowrap;
}
.math-result-btn {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  cursor: pointer;
  animation: pulse-glow 1.5s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(245,158,11,0.5); }
  50% { box-shadow: 0 0 18px rgba(245,158,11,0.9); }
}
.point-anim {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: 40px;
  pointer-events: none;
  opacity: 0;
  z-index: 1000;
  transition: none;
}
.point-anim-show {
  animation: point-pop 1.8s ease forwards;
}
@keyframes point-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  60%  { opacity: 1; transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -85%) scale(0.9); }
}
.result-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.result-modal {
  background: var(--card-bg);
  border: 1px solid var(--purple);
  border-radius: 20px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: 0 0 40px rgba(168,85,247,0.4);
}
.result-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.result-title {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.result-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.5;
}
.result-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  margin-bottom: 6px;
}
.result-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.88rem;
  margin-bottom: 16px;
  outline: none;
  box-sizing: border-box;
}
.result-input:focus { border-color: var(--purple); }
.result-email-row { margin-bottom: 4px; }
.result-email-section {
  margin: 20px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-summary {
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 18px;
}
.result-send-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.result-send-btn:hover { opacity: 0.85; }
.math-share-btn {
  background: rgba(168,85,247,0.15);
  border: 1px solid var(--purple);
  color: var(--text);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.math-share-btn:hover { background: rgba(168,85,247,0.3); }
.math-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.math-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.87rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.math-msg-bot {
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.2);
  align-self: flex-start;
  color: var(--text);
}
.math-msg-loading { opacity: 0.5; font-style: italic; }
.math-msg-user {
  background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(34,211,238,0.15));
  border: 1px solid rgba(34,211,238,0.25);
  align-self: flex-end;
  color: var(--text);
}
.math-answer-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 4px;
  flex-shrink: 0;
}
.math-answer-btn {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 9px 18px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.math-answer-btn:disabled { opacity: 0.4; cursor: default; }
.math-input-row {
  display: flex;
  gap: 8px;
  padding: 4px 12px 12px;
  border-top: none;
  flex-shrink: 0;
}
.math-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 9px 16px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  outline: none;
}
.math-input:focus { border-color: var(--purple); }
.math-send-btn {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 9px 18px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.math-send-btn:disabled { opacity: 0.4; cursor: default; }

.math-ggb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}
.math-reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.math-reset-btn:hover { border-color: var(--pink); color: var(--pink); }
#ggb-container {
  flex: 1;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  background: #fff;
}
#ggb-container iframe,
#ggb-container canvas {
  width: 100% !important;
  display: block;
}

/* ── TRUTH TABLE ── */
#truth-table-container {
  margin: 14px 0 16px;
}
.tt-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.truth-table {
  border-collapse: collapse;
  font-family: 'Poppins', monospace;
  font-size: 0.88rem;
  width: 100%;
  min-width: max-content;
  margin-bottom: 12px;
}
.truth-table th {
  background: rgba(108, 99, 255, 0.15);
  color: var(--purple);
  font-weight: 700;
  padding: 8px 14px;
  border: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}
.truth-table td {
  padding: 7px 14px;
  border: 1px solid var(--border);
  text-align: center;
  font-weight: 600;
  min-width: 48px;
}
.tt-given {
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
}
.tt-given.tt-s { color: #4ade80; }
.tt-given.tt-f { color: #f87171; }
.tt-blank {
  cursor: pointer;
  color: var(--text-muted);
  background: rgba(108, 99, 255, 0.06);
  border: 1px dashed rgba(108, 99, 255, 0.4) !important;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}
.tt-blank:hover:not(.tt-locked) {
  background: rgba(108, 99, 255, 0.14);
  transform: scale(1.08);
}
.tt-blank.tt-filled.tt-s { color: #4ade80; border-style: solid !important; }
.tt-blank.tt-filled.tt-f { color: #f87171; border-style: solid !important; }
.tt-blank.tt-correct {
  background: rgba(74, 222, 128, 0.15) !important;
  border: 1px solid #4ade80 !important;
  color: #4ade80;
}
.tt-blank.tt-wrong {
  background: rgba(248, 113, 113, 0.15) !important;
  border: 1px solid #f87171 !important;
  color: #f87171;
}
.tt-blank.tt-locked { cursor: default; }
.tt-check-btn {
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 9px 22px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.tt-check-btn:hover { opacity: 0.85; }
.tt-check-btn:disabled { opacity: 0.45; cursor: default; }

/* ── MOBILE TABS (math game) ── */
.mobile-tabs {
  display: none;
}
@media (max-width: 768px) {
  .mobile-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin: 0 -8px 8px;
    padding: 0 8px;
  }
  .mobile-tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
  }
  .mobile-tab.active {
    color: var(--purple);
    border-bottom-color: var(--purple);
  }

  /* Stack panels vertically; hide inactive one */
  .math-layout {
    flex-direction: column;
    height: auto;
    gap: 0;
  }
  .math-left {
    width: 100%;
    min-width: 0;
    flex-shrink: unset;
  }
  .math-right {
    width: 100%;
  }
  .panel-hidden {
    display: none !important;
  }
  .math-left.panel-full {
    width: 100%;
    max-width: 100%;
  }

  /* GeoGebra panel height on mobile */
  .math-right {
    height: calc(100dvh - 96px);
  }
  #ggb-container {
    height: calc(100dvh - 140px);
  }

  /* Chat fills available height on mobile */
  .math-game-screen {
    padding: 0 8px 0;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .math-layout {
    flex: 1;
    overflow: hidden;
  }
  .math-left {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 96px);
  }
  .math-chat {
    flex: 1;
    min-height: 0;
  }
  .math-problem-box {
    flex-shrink: 0;
  }

  /* Topic grid: 1 column on mobile */
  .math-topic-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Level selector: scrollable row on mobile */
  .level-selector {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .level-selector::-webkit-scrollbar { display: none; }
  .level-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 0.82rem;
  }

  /* Topic screen padding on mobile */
  .math-topic-screen {
    padding: 20px 12px 40px;
  }
  .math-main-title { font-size: 1.6rem; }
  .math-main-subtitle { font-size: 0.92rem; margin-bottom: 20px; }

  /* Back link */
  .back-link { top: 10px; left: 10px; }

  /* Header shrinks on mobile */
  .math-chat-header {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }
  .math-header-right {
    gap: 6px;
  }
  .math-points-counter { font-size: 0.75rem; }
  .math-share-btn, .math-result-btn {
    font-size: 0.7rem;
    padding: 5px 8px;
  }
}

/* ── RESPONSIVE (other screens) ── */
@media (max-width: 640px) {
  .chat-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .chat-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .chat-main { height: 60vh; }
  .message { max-width: 90%; }
  .hub-header h1 { font-size: 2rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* FÖRRÄDAREN — Spy thriller / Modesty Blaise game                            */
/* ═══════════════════════════════════════════════════════════════════════════ */

.traitor-page {
  background: #c8d4de;
  color: #1a2e3c;
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.tr-screen {
  display: none;
  min-height: 100vh;
}
.tr-screen.active { display: flex; align-items: center; justify-content: center; }

/* ── Shared nav ──────────────────────────────────────────────────────────── */
.tr-back {
  display: inline-block;
  color: #38b8cc;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.4rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.tr-back:hover { opacity: 1; }
.tr-back-small {
  color: #38b8cc;
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.7;
}
.tr-back-small:hover { opacity: 1; }

/* ── Intro screen ────────────────────────────────────────────────────────── */
.tr-intro-wrap {
  max-width: 680px;
  width: 100%;
  padding: 2.5rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tr-logo {
  margin-bottom: 0.5rem;
}
.tr-logo-img {
  width: 280px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.tr-logo-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.tr-logo-small-img {
  width: 56px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.tr-guess-brand {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #38b8cc;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.tr-title {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #38b8cc;
  text-shadow: 0 0 24px #38b8cc66;
  margin: 0 0 0.3rem;
  text-transform: uppercase;
}

.tr-subtitle {
  font-size: 1.05rem;
  color: #2a5878;
  margin-bottom: 2rem;
  letter-spacing: 0.04em;
}

.tr-intro-chars {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.tr-intro-char {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.tr-intro-char img {
  width: 90px;
  height: 120px;
  object-fit: cover;
  object-position: top;
  border: 2px solid #38b8cc66;
  border-radius: 4px;
  filter: saturate(1.15) contrast(1.05);
  transition: border-color 0.2s, transform 0.2s;
}
.tr-intro-char img:hover { border-color: #38b8cc; transform: translateY(-3px); }

.tr-intro-char span {
  font-size: 0.78rem;
  color: #2a5878;
  text-align: center;
  letter-spacing: 0.03em;
}

.tr-rules {
  background: #dce6ef;
  border: 1px solid #38b8cc44;
  border-left: 3px solid #38b8cc;
  border-radius: 4px;
  padding: 1rem 1.4rem;
  margin-bottom: 1.8rem;
  text-align: left;
  max-width: 480px;
}
.tr-rules p {
  margin: 0.4rem 0;
  font-size: 0.92rem;
  color: #1a2e3c;
  line-height: 1.5;
}
.tr-rules strong { color: #9a8828; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.tr-btn-primary {
  background: #38b8cc;
  color: #0c1820;
  border: none;
  padding: 0.75rem 2.2rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 0 20px #38b8cc44;
}
.tr-btn-primary:hover {
  background: #e0ae50;
  transform: translateY(-1px);
  box-shadow: 0 0 28px #38b8cc77;
}
.tr-btn-primary:active { transform: translateY(0); }

.tr-btn-secondary {
  background: transparent;
  color: #2a5878;
  border: 1px solid #2a587840;
  padding: 0.75rem 1.8rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: border-color 0.2s, color 0.2s;
}
.tr-btn-secondary:hover { border-color: #2a5878; color: #1a2e3c; }

.tr-btn-reveal { margin-top: 1.2rem; font-size: 1.1rem; }

/* ── Game screen ─────────────────────────────────────────────────────────── */
.tr-game-wrap {
  max-width: 760px;
  width: 100%;
  padding: 1.2rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.tr-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #38b8cc33;
}

.tr-round-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.tr-round-indicator span {
  font-size: 0.85rem;
  color: #2a5878;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tr-round-pips {
  display: flex;
  gap: 0.5rem;
}

.tr-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #38b8cc55;
  background: transparent;
  transition: all 0.3s;
}
.tr-pip.active  { border-color: #38b8cc; background: #38b8cc44; }
.tr-pip.correct { border-color: #7ec860; background: #7ec860; }
.tr-pip.wrong   { border-color: #c86878; background: #c86878; }

.tr-score-display {
  font-size: 0.95rem;
  color: #38b8cc;
  font-weight: 700;
}

/* ── Character row ───────────────────────────────────────────────────────── */
.tr-chars-row {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}

.tr-char-card {
  flex: 1;
  max-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: #dce6ef;
  border: 2px solid #b4c4d4;
  border-radius: 5px;
  padding: 0.6rem 0.4rem 0.5rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.tr-char-card.speaking {
  border-color: #38b8cc;
  box-shadow: 0 0 18px #38b8cc55;
}

.tr-char-portrait-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 3px;
}

.tr-char-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  object-position: top;
  display: block;
  filter: saturate(1.1) contrast(1.05);
}

.tr-char-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a2e3c;
  letter-spacing: 0.04em;
  text-align: center;
}

.tr-char-tag {
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tr-char-tag.sexy   { background: #f0d4da; color: #9a2840; border: 1px solid #9a284040; }
.tr-char-tag.nerdy  { background: #d0dff4; color: #1a4090; border: 1px solid #1a409040; }
.tr-char-tag.cool   { background: #d0ecda; color: #1a6030; border: 1px solid #1a603040; }

/* ── Question box ────────────────────────────────────────────────────────── */
.tr-question-box {
  background: #dce6ef;
  border: 2px solid #38b8cc66;
  border-radius: 5px;
  padding: 1rem 1.3rem;
}

/* ── In-game GeoGebra panel ──────────────────────────────────────────────── */
.tr-ggb-panel {
  background: #c8d4de;
  border: 1.5px solid #38b8cc44;
  border-radius: 8px;
  overflow: hidden;
}
.tr-ggb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  background: rgba(201,151,58,0.07);
  border-bottom: 1px solid #38b8cc33;
}
.tr-ggb-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #38b8cc;
}
.tr-ggb-reset-btn {
  background: rgba(201,151,58,0.1);
  border: 1px solid #38b8cc44;
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  color: #38b8cc;
  cursor: pointer;
  transition: background 0.18s;
  font-family: inherit;
}
.tr-ggb-reset-btn:hover { background: rgba(201,151,58,0.22); }
.tr-ggb-hint {
  font-size: 0.75rem;
  color: #7a7060;
  font-style: italic;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid #38b8cc1a;
}
#tr-ggb-container { width: 100%; display: block; }

.tr-question-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #38b8cc;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.tr-question-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a2e3c;
  line-height: 1.4;
}

/* ── Hints ───────────────────────────────────────────────────────────────── */
.tr-hints-area {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 80px;
}

.tr-hints-loading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #2a5878;
  font-size: 0.9rem;
  padding: 0.8rem;
}

.tr-loading-dots {
  display: flex;
  gap: 4px;
}
.tr-loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38b8cc;
  animation: trDot 1.2s infinite ease-in-out;
}
.tr-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.tr-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes trDot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.7); }
  40%           { opacity: 1;   transform: scale(1); }
}

.tr-hints-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.tr-hint-bubble {
  background: #dce6ef;
  border: 1px solid #b4c4d4;
  border-left: 3px solid #b0c0d0;
  border-radius: 4px;
  padding: 0.9rem 1.1rem;
  font-size: 1rem;
  line-height: 1.65;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s, transform 0.5s;
}
.tr-hint-bubble.appearing {
  opacity: 1;
  transform: translateY(0);
}
.tr-hint-text {
  display: block;
}
.tr-hint-summary {
  display: block;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid #b0c0d0;
  font-weight: 700;
  font-size: 0.95rem;
  color: #9a8828;
  letter-spacing: 0.01em;
}

#hint-valentina { border-left-color: #a04060; }
#hint-erik      { border-left-color: #4060a0; }
#hint-rex       { border-left-color: #408040; }

.tr-hint-name {
  font-weight: 700;
  color: #38b8cc;
  margin-right: 0.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}
#hint-valentina .tr-hint-name { color: #d08090; }
#hint-erik      .tr-hint-name { color: #7090d0; }
#hint-rex       .tr-hint-name { color: #60c060; }

.tr-hint-text { color: #1a2e3c; }

/* ── Answer row ──────────────────────────────────────────────────────────── */
.tr-answer-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: #dce6ef;
  border: 1px solid #38b8cc44;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}
.tr-answer-label {
  color: #2a5878;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.tr-answer-input {
  background: #c8d4de;
  border: 1px solid #38b8cc66;
  color: #1a2e3c;
  font-size: 1.15rem;
  padding: 0.6rem 1rem;
  border-radius: 5px;
  width: 180px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.tr-answer-input:focus { border-color: #38b8cc; }
.tr-answer-unit {
  color: #2a5878;
  font-size: 0.85rem;
  min-width: 24px;
}

/* ── Pick row ──────────────────────────────────────────────────────────── */
.tr-pick-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}
.tr-pick-label {
  color: #38b8cc;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}
.tr-pick-chars {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
}
.tr-pick-card {
  background: #dce6ef;
  border: 2px solid #b4c4d4;
  border-radius: 5px;
  padding: 0.5rem 0.5rem 0.8rem;
  cursor: pointer;
  width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}
.tr-pick-card img {
  width: 115px;
  height: 155px;
  object-fit: cover;
  object-position: top;
  border-radius: 3px;
  filter: saturate(1.1);
}
.tr-pick-card:hover:not(:disabled) {
  border-color: #38b8cc88;
  transform: translateY(-3px);
  box-shadow: 0 6px 24px #38b8cc33;
}
.tr-pick-card.selected { border-color: #38b8cc; box-shadow: 0 0 28px #38b8cc66; }
.tr-pick-card:disabled, .tr-pick-none-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tr-pick-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a2e3c;
  letter-spacing: 0.04em;
}
.tr-pick-none-btn {
  background: #d4e0ea;
  border: 2px solid #b0c0d0;
  border-radius: 5px;
  color: #2a5878;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.8rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.tr-pick-none-btn:hover:not(:disabled) {
  border-color: #38b8cc88;
  color: #9a8828;
  background: #ccd8e4;
}
.tr-pick-none-btn.selected {
  border-color: #38b8cc;
  color: #9a8828;
  background: #ccd8e4;
}

/* ── Guess screen ────────────────────────────────────────────────────────── */
.tr-guess-wrap {
  max-width: 680px;
  width: 100%;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  text-align: center;
}

.tr-guess-header { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }

.tr-guess-title {
  font-size: 2rem;
  font-weight: 900;
  color: #38b8cc;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}
.tr-guess-sub { color: #2a5878; font-size: 0.95rem; margin: 0; }

.tr-guess-chars {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tr-guess-card {
  background: #dce6ef;
  border: 2px solid #b4c4d4;
  border-radius: 5px;
  padding: 0.5rem 0.5rem 0.8rem;
  cursor: pointer;
  width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}
.tr-guess-card img {
  width: 115px;
  height: 155px;
  object-fit: cover;
  object-position: top;
  border-radius: 3px;
  filter: saturate(1.1);
}
.tr-guess-card:hover {
  border-color: #38b8cc88;
  transform: translateY(-3px);
  box-shadow: 0 6px 24px #38b8cc33;
}
.tr-guess-card.selected {
  border-color: #38b8cc;
  box-shadow: 0 0 28px #38b8cc66;
}
.tr-guess-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a2e3c;
  letter-spacing: 0.04em;
}

.tr-guess-selected {
  background: #dce6ef;
  border: 1px solid #38b8cc66;
  border-radius: 4px;
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  color: #2a5878;
}
.tr-guess-selected strong { color: #9a8828; }

/* ── Result screen ───────────────────────────────────────────────────────── */
.tr-result-wrap {
  max-width: 680px;
  width: 100%;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  text-align: center;
}

.tr-result-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.tr-reveal-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #38b8cc;
  text-transform: uppercase;
}

.tr-reveal-score {
  font-size: 2.8rem;
  font-weight: 900;
  color: #38b8cc;
  letter-spacing: 0.05em;
  line-height: 1;
}
.tr-reveal-portrait img {
  width: 170px;
  height: 225px;
  object-fit: cover;
  object-position: top;
  border: 3px solid #38b8cc;
  border-radius: 5px;
  filter: saturate(1.2) contrast(1.08);
  box-shadow: 0 0 32px #38b8cc55;
}

.tr-reveal-name {
  font-size: 1.5rem;
  font-weight: 900;
  color: #1a2e3c;
  letter-spacing: 0.06em;
}

.tr-result-verdicts {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 460px;
}

.tr-verdict {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #dce6ef;
  border: 1px solid #b4c4d4;
  border-radius: 4px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  color: #1a2e3c;
}
.tr-verdict.correct { border-left: 3px solid #7ec860; }
.tr-verdict.wrong   { border-left: 3px solid #c86878; }
.tr-verdict-math    { border-left: 3px solid #38b8cc; }

.tr-verdict-icon { font-size: 1.2rem; }

.tr-round-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  max-width: 520px;
}

.tr-round-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #dce6ef;
  border: 1px solid #1c1e2e;
  border-radius: 4px;
  padding: 0.55rem 0.9rem;
  font-size: 0.82rem;
  text-align: left;
}
.tr-round-row.correct { border-left: 2px solid #7ec860; }
.tr-round-row.wrong   { border-left: 2px solid #c86878; }

.tr-round-icon { font-size: 0.85rem; flex-shrink: 0; margin-top: 1px; }
.tr-round-q    { color: #2a5878; flex: 1; line-height: 1.4; }
.tr-round-ans  { color: #7a8890; font-size: 0.78rem; flex-shrink: 0; }

.tr-result-btns {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tr-title { font-size: 2.2rem; }
  .tr-chars-row { gap: 0.3rem; }
  .tr-char-card { max-width: 110px; }
  .tr-char-img { height: 80px; }
  .tr-guess-chars { gap: 0.5rem; }
  .tr-guess-card { width: 100px; padding: 0.4rem 0.3rem 0.6rem; }
  .tr-guess-card img { width: 90px; height: 120px; }
  .tr-intro-char img { width: 75px; height: 100px; }
}

/* ── Interrogation screen ─────────────────────────────────────────────────── */
.tr-interro-wrap {
  max-width: 820px;
  width: 100%;
  padding: 2rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

.tr-interro-header { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }

.tr-interro-title {
  font-size: 2rem;
  font-weight: 900;
  color: #38b8cc;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

.tr-interro-sub {
  color: #2a5878;
  font-size: 0.95rem;
  margin: 0;
}
.tr-interro-sub strong { color: #9a8828; }

.tr-interro-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  width: 100%;
}

.tr-interro-card {
  background: #dce6ef;
  border: 2px solid #b4c4d4;
  border-radius: 6px;
  padding: 0.8rem 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 210px;
  max-width: 260px;
  transition: border-color 0.3s;
}
.tr-interro-card:has(.tr-interro-answer:not(:empty)) {
  border-color: #38b8cc55;
}

.tr-interro-img {
  width: 100%;
  height: 145px;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  filter: saturate(1.1) contrast(1.05);
}

.tr-interro-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a2e3c;
  letter-spacing: 0.05em;
  text-align: center;
}

.tr-interro-input-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

.tr-interro-input {
  background: #c8d4de;
  border: 1px solid #38b8cc55;
  color: #1a2e3c;
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
  border-radius: 3px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
}
.tr-interro-input:focus { border-color: #38b8cc; }
.tr-interro-input:disabled { opacity: 0.5; }

.tr-btn-ask {
  background: #1e2035;
  color: #38b8cc;
  border: 1px solid #38b8cc55;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.2s, border-color 0.2s;
  width: 100%;
}
.tr-btn-ask:hover { background: #252840; border-color: #38b8cc; }
.tr-btn-ask:disabled { opacity: 0.4; cursor: default; }

.tr-interro-qa {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tr-interro-q-display {
  font-size: 0.8rem;
  color: #7090a0;
  font-style: italic;
  line-height: 1.4;
}

.tr-interro-a-display {
  background: #c8d4de;
  border-left: 3px solid #38b8cc66;
  padding: 0.5rem 0.7rem;
  border-radius: 0 3px 3px 0;
  min-height: 36px;
}

.tr-interro-loading { display: flex; align-items: center; }

.tr-interro-answer {
  font-size: 0.85rem;
  color: #1a2e3c;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .tr-interro-grid { flex-direction: column; align-items: center; }
  .tr-interro-card { max-width: 100%; }
}

/* ── Setup Wizard (Intro steps) ──────────────────────────────────────────── */
.tr-step-dots {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.4rem;
}

.tr-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #b0c0d0;
  background: #dce6ef;
  color: #555770;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}
.tr-step-dot.active {
  border-color: #38b8cc;
  background: #38b8cc;
  color: #0c1820;
}
.tr-step-dot.done {
  border-color: #7ec86066;
  background: #7ec86022;
  color: #7ec860;
}

.tr-step-line {
  flex: 1;
  height: 2px;
  background: #d0dce8;
  min-width: 24px;
  max-width: 60px;
}

/* Setup step container */
.tr-setup-step {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: trStepIn 0.25s ease;
}
@keyframes trStepIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tr-setup-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #9a8828;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  text-align: center;
}

.tr-setup-input {
  background: #dce6ef;
  border: 2px solid #38b8cc66;
  color: #1a2e3c;
  font-size: 1.1rem;
  padding: 0.65rem 1rem;
  border-radius: 4px;
  width: 100%;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}
.tr-setup-input:focus { border-color: #38b8cc; }

.tr-setup-nav {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.tr-btn-back-step {
  background: transparent;
  color: #2a5878;
  border: 1px solid #6898b855;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.tr-btn-back-step:hover { border-color: #2a5878; color: #1a2e3c; }

/* Program cards */
.tr-program-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.tr-program-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: #dce6ef;
  border: 2px solid #b4c4d4;
  border-radius: 5px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  text-align: left;
}
.tr-program-card:hover { border-color: #38b8cc88; transform: translateX(3px); }
.tr-program-card.selected { border-color: #38b8cc; background: #ccd8e4; }

.tr-prog-icon { font-size: 1.4rem; flex-shrink: 0; }
.tr-prog-name { font-size: 0.9rem; font-weight: 600; color: #1a2e3c; }
.tr-prog-sub  { font-size: 0.75rem; color: #8a8070; margin-top: 0.15rem; }

/* Year cards */
.tr-year-grid {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.tr-year-card {
  background: #dce6ef;
  border: 2px solid #b4c4d4;
  border-radius: 5px;
  padding: 0.9rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: #1a2e3c;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.tr-year-card:hover { border-color: #38b8cc88; transform: translateY(-2px); }
.tr-year-card.selected { border-color: #38b8cc; background: #ccd8e4; color: #9a8828; }

/* Wider cards for university categories ("🏛️ Samhällsvetenskap" etc.) */
.tr-year-card--wide {
  padding: 0.9rem 1.2rem;
  font-size: 0.95rem;
}

/* Horizontally scrollable bar shown when picking university category.
   Drag with the visible scrollbar to reveal all six options clearly. */
.tr-year-grid--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0 0.9rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #38b8cc #c8d4de;
  scrollbar-width: thin;
}
.tr-year-grid--scroll .tr-year-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
}
/* Visible, draggable scrollbar (WebKit/Blink) */
.tr-year-grid--scroll::-webkit-scrollbar {
  height: 12px;
}
.tr-year-grid--scroll::-webkit-scrollbar-track {
  background: #c8d4de;
  border-radius: 6px;
  border: 1px solid #3a2a40;
}
.tr-year-grid--scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #9a8828 0%, #38b8cc 50%, #8a6420 100%);
  border-radius: 6px;
  border: 2px solid #b4c4d4;
  cursor: grab;
}
.tr-year-grid--scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #f0d080 0%, #d9a74a 50%, #9a7430 100%);
}
.tr-year-grid--scroll::-webkit-scrollbar-thumb:active {
  cursor: grabbing;
}

/* Select dropdowns */
.tr-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.tr-select-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #38b8cc;
}

.tr-select {
  background: #dce6ef;
  border: 2px solid #38b8cc55;
  color: #1a2e3c;
  font-size: 0.95rem;
  padding: 0.55rem 0.9rem;
  border-radius: 4px;
  width: 100%;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c9973a' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
}
.tr-select:focus { border-color: #38b8cc; }
.tr-select:disabled { opacity: 0.4; cursor: default; }
.tr-select option { background: #dce6ef; color: #1a2e3c; }

/* Player context bar (in game screen) */
.tr-game-context {
  font-size: 0.8rem;
  color: #2a5878;
  text-align: center;
  letter-spacing: 0.04em;
  padding: 0.25rem 0;
}
.tr-ctx-sep { margin: 0 0.4rem; opacity: 0.5; }

/* Character tags – updated */
.tr-char-tag.kvinna    { background: #f0d8e4; color: #e080a0; border: 1px solid #e080a066; }
.tr-char-tag.ickebinaer { background: #25103a; color: #b080e0; border: 1px solid #b080e066; }
.tr-char-tag.man       { background: #102540; color: #60a0e0; border: 1px solid #60a0e066; }

/* Hint name colors */
.valentina-name { color: #e080a0; }
.alex-name      { color: #b080e0; }
.rex-name       { color: #60a0e0; }

#hint-valentina { border-left-color: #a04060; }
#hint-alex      { border-left-color: #7040a0; }
#hint-rex       { border-left-color: #4060a0; }

/* ── Win tracker (result screen) ─────────────────────────────────────────── */
.tr-win-tracker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0 0.5rem;
}
.tr-win-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2a5878;
}
.tr-win-pips {
  display: flex;
  gap: 0.7rem;
}
.tr-win-pip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #33354055;
  background: #dce6ef;
  transition: all 0.4s;
}
.tr-win-pip.lit {
  border-color: #9a8828;
  background: #38b8cc;
  box-shadow: 0 0 8px #38b8cc88;
}

.tr-wins-to-go {
  text-align: center;
  font-size: 0.88rem;
  color: #38b8cc;
  letter-spacing: 0.03em;
  padding: 0.3rem 0 0.6rem;
  font-style: italic;
}

/* ── Boss unlock teaser ───────────────────────────────────────────────────── */
.tr-boss-unlock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
  padding: 1.2rem;
  border: 2px solid #e8384055;
  background: #1a0a0a;
  border-radius: 6px;
  animation: bossGlow 2s ease-in-out infinite alternate;
}
@keyframes bossGlow {
  from { border-color: #e8384055; box-shadow: none; }
  to   { border-color: #e83840cc; box-shadow: 0 0 18px #e8384044; }
}
.tr-boss-unlock-img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #e83840;
  filter: grayscale(20%) contrast(1.1);
}
.tr-boss-unlock-msg {
  font-size: 0.9rem;
  color: #1a2e3c;
  text-align: center;
  line-height: 1.5;
  margin: 0;
}
.tr-boss-unlock-msg strong { color: #f05060; }
.tr-btn-boss-challenge {
  background: linear-gradient(135deg, #8b0000, #c0303a);
  color: #fff;
  border: none;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  transition: filter 0.2s, transform 0.15s;
}
.tr-btn-boss-challenge:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

/* ── Boss Screen ──────────────────────────────────────────────────────────── */
#tr-boss.active {
  align-items: flex-start;
  padding: 2rem 0 5rem;
}

.boss-page {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* Top badge */
.boss-top-badge {
  display: inline-block;
  background: #8b0000;
  color: #ffcccc;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.3rem 1rem;
  border-radius: 2px;
  align-self: center;
}

/* Profile */
.boss-profile {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: #d8e4ee;
  border: 1px solid #c03030aa;
  border-radius: 8px;
  padding: 1rem;
}
.boss-portrait {
  width: 80px;
  min-width: 80px;
  height: 110px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid #c03030aa;
}
.boss-bio { flex: 1; }
.boss-name-lbl {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #c03030;
  margin-bottom: 0.1rem;
}
.boss-role-lbl {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: #3a5070;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.boss-intro-text {
  font-size: 0.88rem;
  color: #0d1826;
  line-height: 1.55;
  margin: 0;
}

/* Challenge — scrollable so it doesn't push Q&A off screen */
.boss-challenge {
  background: #e8d8da;
  border: 2px solid #8b0000;
  border-radius: 6px;
  padding: 1rem 1.2rem;
}
.boss-challenge-lbl {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c03030;
  margin-bottom: 0.5rem;
}
.boss-challenge-body {
  font-size: 0.93rem;
  color: #0d1826;
  line-height: 1.6;
  max-height: 9rem;
  overflow-y: auto;
}

/* ── Chat section ─────────────────────────────────────────────────────────── */
.boss-chat-section {
  background: #f0f5fa;
  border: 2px solid #38b8cc;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.boss-chat-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a7090;
}
/* Gibson reply box — shown right below the input, replaces on each new answer */
.boss-reply-box {
  background: #1a3050;
  color: #ffffff;
  border-left: 4px solid #38b8cc;
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.93rem;
  line-height: 1.6;
  min-height: 3rem;
}
.boss-reply-placeholder {
  background: #e8edf3;
  color: #7a8a99;
  border-left: 4px solid #aabbcc;
  font-style: italic;
}

/* Gibson messages — dark navy, impossible to miss */
.bchat-gibson {
  background: #1a3050;
  color: #ffffff;
  border-left: 4px solid #38b8cc;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  font-size: 0.93rem;
  line-height: 1.6;
}
.bchat-gibson .bchat-name {
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #38b8cc;
  margin-bottom: 0.4rem;
}

/* Player messages — light blue */
.bchat-player {
  background: #dbeafe;
  color: #0d1826;
  border-left: 4px solid #3880d8;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  font-size: 0.93rem;
  line-height: 1.6;
  align-self: flex-end;
  max-width: 92%;
}
.bchat-player .bchat-name {
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a60b8;
  margin-bottom: 0.4rem;
}

/* Concept help buttons */
.boss-concept-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 0;
}
.boss-concept-btn {
  background: #ffffff;
  color: #1a3050;
  border: 2px solid #38b8cc;
  border-radius: 20px;
  padding: 0.38rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.boss-concept-btn:hover:not(:disabled) {
  background: #38b8cc;
  color: #ffffff;
}
.boss-concept-btn:disabled {
  opacity: 0.35;
  cursor: default;
  text-decoration: line-through;
}
/* Each definition entry inside boss-dialog */
.boss-concept-entry + .boss-concept-entry {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.bchat-concept-name {
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #38b8cc;
  margin-bottom: 0.3rem;
}

/* ── Answer section ───────────────────────────────────────────────────────── */
.boss-answer-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.boss-answer-lbl {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2a5878;
}
.boss-answer-ta {
  background: #dce6ef;
  border: 2px solid #8b000055;
  color: #0d1826;
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 0.8rem;
  border-radius: 4px;
  width: 100%;
  min-height: 120px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}
.boss-answer-ta:focus { border-color: #c03030; }
.boss-submit-btn {
  align-self: flex-end;
  background: linear-gradient(135deg, #8b0000, #c0303a);
  color: #fff;
  border: none;
  padding: 0.7rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  transition: filter 0.2s;
}
.boss-submit-btn:hover:not(:disabled) { filter: brightness(1.15); }
.boss-submit-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Model answer ─────────────────────────────────────────────────────────── */
.boss-model-section {
  background: #e8f0e4;
  border: 1px solid #4a9040;
  border-radius: 6px;
  padding: 1rem;
}
.boss-model-lbl {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a6830;
  margin-bottom: 0.5rem;
}
.boss-model-body { font-size: 0.92rem; color: #0d1826; line-height: 1.65; }

/* ── Result section ───────────────────────────────────────────────────────── */
.boss-result-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #33354055;
  border-radius: 8px;
  background: #d8e4ee;
}
/* Keep tr-boss-verdict-box for JS compatibility */
.tr-boss-verdict-box {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border-radius: 6px;
}
.tr-boss-verdict-box.passed { background: #c4eedd; border: 1px solid #2a8050; }
.tr-boss-verdict-box.failed { background: #f8d4d4; border: 1px solid #c03030; }
.boss-verdict-icon { font-size: 1.6rem; flex-shrink: 0; }
.boss-verdict-text { font-size: 0.95rem; font-weight: 700; color: #0d1826; }
.boss-feedback-body { font-size: 0.88rem; color: #0d1826; line-height: 1.65; }
.boss-score-display {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #38b8cc;
  text-transform: uppercase;
}
.boss-learning {
  background: #e8f0f8;
  border-left: 3px solid #38b8cc;
  border-radius: 4px;
  padding: 0.8rem 1rem;
}
.boss-learning-lbl {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a7090;
  margin-bottom: 0.4rem;
}
.boss-learning-body { font-size: 0.9rem; color: #0d1826; line-height: 1.6; }
.boss-email-area { display: flex; flex-direction: column; gap: 0.5rem; }
.boss-email-prompt { font-size: 0.88rem; color: #0d1826; margin: 0; }
.boss-email-row { display: flex; gap: 0.6rem; }
.boss-result-btns { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* ── Session resume banner ────────────────────────────────────────────────── */
.tr-resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #d4e8f8;
  border: 1px solid #4080c066;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.2rem;
  animation: fadeSlideIn 0.4s ease;
  flex-wrap: wrap;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tr-resume-info {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  min-width: 0;
}
.tr-resume-icon { font-size: 1.3rem; flex-shrink: 0; }
.tr-resume-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.tr-resume-text strong {
  font-size: 0.95rem;
  color: #c8d8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-resume-text span {
  font-size: 0.72rem;
  color: #6090b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-resume-btns {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.tr-btn-resume {
  background: linear-gradient(135deg, #1a5080, #2a7abf);
  color: #fff;
  border: none;
  padding: 0.5rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: filter 0.2s;
  white-space: nowrap;
}
.tr-btn-resume:hover { filter: brightness(1.2); }
.tr-btn-clear-save {
  background: transparent;
  color: #6090b0;
  border: 1px solid #6090b055;
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.tr-btn-clear-save:hover { color: #e05060; border-color: #e0506055; }

/* ── Save & exit button ───────────────────────────────────────────────────── */
.tr-btn-save-exit {
  border: 1px solid #4080c055;
  color: #6090b0;
  background: transparent;
  font-size: 0.88rem;
  padding: 0.6rem 1.1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tr-btn-save-exit:hover { color: #90c0e8; border-color: #4080c0; }

/* ── Hub byline ───────────────────────────────────────────────────────────── */
.hub-byline {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.3rem;
  letter-spacing: 0.03em;
}

/* ── Nero mode-choice ─────────────────────────────────────────────────────── */
.tr-name-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 360px;
  margin: 1.2rem auto 0;
}
.tr-name-label {
  color: #38b8cc;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tr-intro-name-input {
  width: 100%;
  text-align: center;
  font-size: 1.1rem;
}
.tr-input--locked {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  cursor: default;
}

.tr-mode-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  max-width: 360px;
  margin: 0.8rem auto 0.5rem;
}

.tr-btn-quickstart {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  width: auto;
  align-self: center;
  padding: 0.35rem 0.9rem;
  background: linear-gradient(135deg, #38b8cc 0%, #a07020 100%);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 8px #38b8cc33;
}
.tr-btn-quickstart:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 14px #38b8cc55;
}
.tr-qs-icon  { font-size: 0.8rem; line-height: 1; }
.tr-qs-label { font-size: 0.72rem; font-weight: 800; color: #0d0e18; letter-spacing: 0.04em; }
.tr-qs-sub   { display: none; }

.tr-mode-sep {
  color: #555;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.tr-btn-customize {
  background: transparent;
  border: 2px solid #38b8cc;
  border-radius: 10px;
  color: #c8a8e8;
  font-size: 1.35rem;
  font-weight: 700;
  padding: 1.15rem 2rem;
  width: 100%;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 18px #38b8cc44;
}
.tr-btn-customize:hover {
  background: rgba(176, 136, 208, 0.12);
  color: #e0c8f8;
  box-shadow: 0 0 28px #38b8cc77;
}

/* Quick-start loading */
.tr-qs-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #38b8cc;
  font-size: 1rem;
  margin: 1.5rem auto;
  justify-content: center;
}

/* ── Question image ──────────────────────────────────────────────────────── */
.tr-question-img-wrap {
  margin-top: 1rem;
  text-align: center;
}
.tr-question-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 6px;
  border: 1px solid rgba(200,180,120,0.25);
  object-fit: contain;
}

/* ── Pick row ────────────────────────────────────────────────────────────── */
.tr-pick-row {
  margin: 1rem auto 0;
  max-width: 580px;
  text-align: center;
}
.tr-pick-label {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a7a60;
  margin-bottom: 0.55rem;
}
.tr-pick-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.tr-pick-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(200,180,120,0.3);
  color: #c8b870;
  border-radius: 5px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  letter-spacing: 0.03em;
}
.tr-pick-btn:hover { background: rgba(200,180,120,0.12); border-color: #c8b870; }
.tr-pick-btn.selected {
  background: rgba(200,180,120,0.22);
  border-color: #f0d070;
  color: #f0d070;
  box-shadow: 0 0 8px rgba(200,180,80,0.3);
}
.tr-pick-none {
  color: #a0a0b0;
  border-color: rgba(160,160,176,0.3);
}
.tr-pick-none.selected {
  background: rgba(160,160,176,0.18);
  border-color: #a0a0b0;
  color: #d0d0e0;
}

/* ── Answer textarea ─────────────────────────────────────────────────────── */
.tr-answer-textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ── Eval loading ────────────────────────────────────────────────────────── */
.tr-eval-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #8a9ab0;
  margin: 0.4rem 0;
  font-style: italic;
}

/* ── Facit section ───────────────────────────────────────────────────────── */
.tr-facit-section {
  margin: 1.2rem auto 0;
  max-width: 580px;
  border-top: 1px solid rgba(200,180,120,0.2);
  padding-top: 1rem;
}
.tr-facit-title {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a7a60;
  margin-bottom: 0.7rem;
}
.tr-facit-item {
  margin-bottom: 0.8rem;
  background: rgba(255,255,255,0.03);
  border-radius: 5px;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid rgba(200,180,120,0.3);
}
.tr-facit-q {
  font-size: 0.82rem;
  color: #a0a0b0;
  margin-bottom: 0.25rem;
}
.tr-facit-a {
  font-size: 0.92rem;
  font-weight: 700;
  color: #d4c080;
}
.tr-facit-who {
  font-size: 0.75rem;
  color: #708090;
  margin-top: 0.2rem;
}
.tr-facit-pick {
  font-size: 0.75rem;
  margin-top: 0.15rem;
}
.tr-facit-pick.pick-right { color: #4ade80; }
.tr-facit-pick.pick-wrong { color: #f87171; }

/* Immediate answer feedback */
.tr-submit-feedback {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}
.tr-submit-feedback.feedback-correct {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #4ade80;
}
.tr-submit-feedback.feedback-wrong {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #f87171;
}

/* ── Math game progress dots ──────────────────────────────────────────── */
.math-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.math-progress-dots {
  display: flex;
  gap: 4px;
}
.mpd {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.25);
  transition: background 0.25s, transform 0.25s;
}
.mpd--done {
  background: #4ade80;
  border-color: #4ade80;
}
.mpd--next {
  border-color: #86efac;
  animation: mpd-pulse 1s ease-in-out infinite;
}
@keyframes mpd-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}

/* ── Math celebration overlay ──────────────────────────────────────────── */
.math-celebration {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  animation: cel-in 0.35s ease;
}
.math-celebration.hidden { display: none; }
@keyframes cel-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.math-confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.math-celebration-box {
  position: relative;
  text-align: center;
  background: #1a1a2e;
  border: 2px solid #4ade80;
  border-radius: 16px;
  padding: 2.5rem 3rem;
  box-shadow: 0 0 60px #4ade8055;
  animation: cel-pop 0.4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cel-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.math-celebration-emoji { font-size: 3.5rem; margin-bottom: 0.4rem; }
.math-celebration-title {
  font-size: 2rem;
  font-weight: 800;
  color: #4ade80;
  margin-bottom: 0.4rem;
}
.math-celebration-sub {
  font-size: 1rem;
  color: #1a2e3c;
}

.tr-boss-model-answer {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.35);
}
.tr-boss-model-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #7a5800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.tr-boss-model-text {
  font-size: 0.95rem;
  color: #0d1826;
  line-height: 1.6;
  white-space: pre-wrap;
}

.tr-inline-facit {
  margin-top: 0.75rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  background: rgba(147, 197, 253, 0.1);
  border: 1px solid rgba(147, 197, 253, 0.35);
  font-size: 0.9rem;
  line-height: 1.4;
}
.tr-inline-facit-label {
  font-weight: 600;
  color: #93c5fd;
  margin-right: 0.4rem;
}
.tr-inline-facit-answer {
  color: #0d1826;
}
.tr-next-round-btn {
  margin-top: 0.9rem;
  width: 100%;
}

/* Traitor reveal on result screen */
.tr-traitor-reveal {
  text-align: center;
  margin: 1.2rem 0 0.5rem;
}
.tr-btn-reveal {
  font-size: 0.9rem;
  padding: 0.5rem 1.4rem;
  opacity: 0.85;
}
.tr-traitor-panel {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  animation: fadeIn 0.4s ease;
}
.tr-traitor-portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #f87171;
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.4);
}
.tr-traitor-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f87171;
  letter-spacing: 0.03em;
}
.tr-traitor-desc {
  font-size: 0.8rem;
  color: rgba(200, 180, 255, 0.7);
}

/* Boss learning summary */
.tr-boss-learning-summary {
  margin: 1.5rem auto 0;
  max-width: 560px;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.08), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  text-align: left;
  animation: fadeIn 0.5s ease;
}
.tr-boss-learning-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #6a4e00;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}
.tr-boss-learning-text {
  font-size: 0.92rem;
  color: rgba(220, 210, 255, 0.9);
  line-height: 1.65;
}

/* Music toggle button */
.tr-music-toggle {
  position: fixed;
  bottom: 4.5rem;
  right: 1.2rem;
  z-index: 900;
  background: rgba(20, 12, 40, 0.82);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s, opacity 0.2s, transform 0.15s;
  opacity: 0.75;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
.tr-music-toggle:hover {
  opacity: 1;
  border-color: rgba(250, 204, 21, 0.7);
  transform: scale(1.08);
}
.tr-music-toggle.music-off {
  border-color: rgba(180, 140, 140, 0.3);
  opacity: 0.5;
}

/* Shared copyright footer (math, mord, etc.) */
.game-copyright {
  text-align: center;
  color: rgba(168, 158, 201, 0.4);
  font-size: 0.7rem;
  padding: 1.5rem 1rem 1rem;
  line-height: 1.6;
  font-family: inherit;
}

/* Copyright footer — alltid längst ned, full bredd, under all grafik */
.tr-copyright {
  display: block;
  width: 100%;
  clear: both;
  text-align: center;
  color: rgba(168, 158, 201, 0.55);
  font-size: 0.7rem;
  padding: 1.4rem 1rem 1.6rem;
  line-height: 1.5;
  background: rgba(10, 6, 22, 0.85);
  border-top: 1px solid rgba(168, 158, 201, 0.12);
  position: relative;
  z-index: 1000;
}

/* Boss email section */
.tr-boss-email-section {
  margin: 1.5rem auto 0;
  max-width: 520px;
  background: linear-gradient(135deg, rgba(74,222,128,0.1), rgba(34,211,238,0.1));
  border: 1px solid rgba(74,222,128,0.4);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  text-align: center;
}
.tr-boss-email-prompt {
  color: #4ade80;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.9rem;
  letter-spacing: 0.02em;
}
.tr-boss-email-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.tr-boss-email-input {
  flex: 1;
  min-width: 200px;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
}
.tr-btn-email-send {
  white-space: nowrap;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
}

/* ── Hub background music toggle ───────────────────────────────────── */
.hub-mute-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: rgba(20, 20, 40, 0.75);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hub-mute-btn:hover {
  transform: scale(1.08);
  background: rgba(40, 40, 80, 0.9);
  border-color: rgba(255, 255, 255, 0.7);
}
.hub-mute-btn.muted {
  background: rgba(80, 20, 20, 0.75);
  border-color: rgba(255, 100, 100, 0.6);
}

/* ── Highscore section on hub ──────────────────────────────────────────── */
.hs-section {
  max-width: 900px;
  margin: 2rem auto 0;
  text-align: center;
}
.hs-toggle-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 0.6rem 1.4rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.hs-toggle-btn:hover { background: rgba(255,255,255,0.22); }
.hs-panel {
  margin-top: 1rem;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 1rem;
  animation: hs-fade 0.25s ease;
}
@keyframes hs-fade {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hs-game { margin-bottom: 1.2rem; }
.hs-game-title {
  font-size: 1rem;
  color: #ffd84a;
  margin-bottom: 0.4rem;
  text-align: left;
}
.hs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  color: #eee;
}
.hs-table th {
  text-align: left;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  color: #ffd84a;
  font-weight: 600;
}
.hs-table td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.hs-table tr:hover td { background: rgba(255,255,255,0.06); }

/* ═══════════════════════════════════════════════════════════════════════════
   FÖRRÄDAREN – Guess Modal
   ═══════════════════════════════════════════════════════════════════════════ */
.tr-guess-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,7,18,0.88);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}
.tr-guess-modal.hidden { display: none; }

.tr-guess-inner {
  background: #1e1430;
  border: 1.5px solid #38b8cc44;
  border-radius: 14px;
  padding: 2rem 1.5rem 1.5rem;
  max-width: 440px;
  width: 92%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.tr-guess-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a2e3c;
  margin-bottom: 0.3rem;
}
.tr-guess-sub {
  font-size: 0.85rem;
  color: #2a5878;
  margin-bottom: 1.3rem;
}
.tr-guess-cards {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tr-guess-card {
  background: #dce6ef;
  border: 2px solid #2e2048;
  border-radius: 10px;
  padding: 0.9rem 0.7rem 0.6rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 130px;
  transition: border-color 0.18s, transform 0.15s, background 0.18s;
  color: #1a2e3c;
  font-size: 0.82rem;
  font-weight: 600;
}
.tr-guess-card:hover:not(:disabled) {
  border-color: #38b8cc;
  transform: translateY(-3px);
  background: #251840;
}
.tr-guess-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #2e2048;
}
.tr-guess-card.guess-correct {
  border-color: #7ec860;
  background: #182414;
}
.tr-guess-card.guess-correct img { border-color: #7ec860; }
.tr-guess-card.guess-wrong {
  border-color: #c86878;
  background: #281420;
}
.tr-guess-card.guess-traitor {
  border-color: #9a8828;
  background: #24200a;
}
.tr-guess-card.guess-traitor img { border-color: #9a8828; }
.tr-guess-feedback {
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}
.tr-guess-feedback.correct {
  color: #7ec860;
  background: #182414;
}
.tr-guess-feedback.wrong {
  color: #c86878;
  background: #281420;
}
.tr-guess-skip-btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  opacity: 0.7;
}
.tr-guess-skip-btn:hover { opacity: 1; }

.tr-logout-link {
  display: inline-block;
  margin-top: 1.8rem;
  font-size: 0.78rem;
  color: #2a5878;
  text-decoration: none;
  opacity: 0.6;
  letter-spacing: 0.03em;
  transition: opacity 0.2s;
}
.tr-logout-link:hover { opacity: 1; color: #c86878; }

.tr-input-error {
  border-color: #c86878 !important;
  animation: inputShake 0.35s ease;
}
@keyframes inputShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  60%     { transform: translateX(6px); }
  80%     { transform: translateX(-3px); }
}

/* ── Guess summary on result screen ──────────────────────────────────────── */
.tr-guess-summary {
  padding: 0.9rem 1rem;
  background: #dce6ef;
  border: 1px solid #2e2048;
  border-radius: 8px;
  margin: 0.7rem 0;
  text-align: center;
}
.tr-guess-summary-title {
  font-size: 0.82rem;
  color: #2a5878;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.tr-guess-summary-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: #38b8cc;
  margin-bottom: 0.5rem;
}
.tr-guess-row {
  font-size: 0.82rem;
  padding: 0.15rem 0;
  line-height: 1.5;
}
.tr-guess-row.guess-right { color: #7ec860; }
.tr-guess-row.guess-wrong { color: #c86878; }
