/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Inter', 'Noto Sans', Arial, sans-serif;
  background: #1a1a2e;
  color: #e8e8f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Auth Pages ===== */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e2a4a 0%, #2d3561 50%, #1a1a40 100%);
  position: relative;
  overflow: auto;
  padding: 20px;
}

/* Floating keyboard keys background */
.auth-floating-keys {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: auto;
  overflow: hidden;
  z-index: 0;
}

.floating-key {
  position: absolute;
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(162, 155, 254, 0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: rgba(200, 190, 255, 0.5);
  font-weight: 700;
  animation: floatKey linear infinite;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  text-shadow: 0 0 8px rgba(162, 155, 254, 0.3);
}

.floating-key:nth-child(3n) {
  background: rgba(255, 118, 117, 0.12);
  border-color: rgba(255, 118, 117, 0.2);
  color: rgba(255, 160, 160, 0.5);
  text-shadow: 0 0 8px rgba(255, 118, 117, 0.3);
}

.floating-key:nth-child(3n+1) {
  background: rgba(85, 239, 196, 0.1);
  border-color: rgba(85, 239, 196, 0.2);
  color: rgba(130, 255, 210, 0.5);
  text-shadow: 0 0 8px rgba(85, 239, 196, 0.3);
}

.floating-key:nth-child(5n) {
  background: rgba(253, 203, 110, 0.12);
  border-color: rgba(253, 203, 110, 0.2);
  color: rgba(253, 220, 150, 0.5);
  text-shadow: 0 0 8px rgba(253, 203, 110, 0.3);
}

.floating-key.bumped {
  transform: scale(1.4) !important;
  background: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 0 20px rgba(162, 155, 254, 0.5);
  color: rgba(255, 255, 255, 0.8) !important;
}

@keyframes floatKey {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100px) rotate(20deg); opacity: 0; }
}

.auth-box {
  background: rgba(40, 42, 70, 0.88);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 36px 36px 32px;
  width: 420px;
  max-width: 90vw;
  max-height: 95vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(108,92,231,0.15), 0 4px 16px rgba(0,0,0,0.3);
  text-align: center;
  position: relative;
  z-index: 1;
  animation: authBoxIn 0.6s ease-out;
}

@keyframes authBoxIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo {
  width: 140px;
  height: auto;
  margin: 0 auto 8px;
  display: block;
  filter: drop-shadow(0 0 20px rgba(108, 92, 231, 0.4));
}

/* Typing animation demo */
.typing-demo {
  font-size: 15px;
  color: #a29bfe;
  margin-bottom: 24px;
  min-height: 24px;
  font-weight: 500;
}

.typing-cursor {
  color: #6c5ce7;
  animation: blink 0.8s step-end infinite;
  font-weight: 300;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Auth language toggle */
.auth-lang-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 3px;
}

.auth-lang-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6a6a8a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-lang-btn.active {
  background: rgba(108, 92, 231, 0.3);
  color: #a29bfe;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #8888a8;
  font-size: 13px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s, background 0.3s;
}

.form-group input:focus {
  border-color: #6c5ce7;
  background: rgba(108,92,231,0.08);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  width: 100%;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(108,92,231,0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(108,92,231,0.5);
  transform: translateY(-2px);
}

.auth-link {
  margin-top: 20px;
  color: #8888a8;
  font-size: 14px;
}

.auth-link a {
  color: #a29bfe;
  text-decoration: none;
  font-weight: 600;
}

.auth-link a:hover {
  text-decoration: underline;
}

.error-msg {
  background: rgba(255,70,70,0.15);
  color: #ff6b6b;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: none;
  font-size: 14px;
  border: 1px solid rgba(255,70,70,0.2);
}

.success-msg {
  background: rgba(46,213,115,0.15);
  color: #2ed573;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid rgba(46,213,115,0.2);
  text-align: center;
}

/* ===== Navigation ===== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 32, 55, 0.92);
  backdrop-filter: blur(12px);
  padding: 8px 16px;
  gap: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-home {
  position: absolute;
  left: 16px;
  width: 42px;
  height: 42px;
  background: rgba(108,92,231,0.15);
  border: 1px solid rgba(108,92,231,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  text-decoration: none;
  transition: all 0.3s;
}

.nav-home:hover {
  background: rgba(108,92,231,0.3);
}

.nav-user {
  position: absolute;
  right: 16px;
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  text-decoration: none;
  color: #fff;
  transition: all 0.3s;
}

.nav-user:hover {
  background: rgba(255,255,255,0.12);
}

.nav-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: #6a6a8a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s;
  text-decoration: none;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #c8c8e0;
}

.nav-btn.active {
  background: rgba(108,92,231,0.15);
  color: #a29bfe;
}

.nav-icon {
  display: block;
  font-size: 18px;
  margin-bottom: 2px;
}

/* ===== Language Tabs ===== */
.lang-tabs {
  display: flex;
  justify-content: center;
  padding: 16px;
  gap: 8px;
}

.lang-tab {
  font-size: 14px;
  font-weight: 600;
  color: #6a6a8a;
  cursor: pointer;
  padding: 8px 28px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: all 0.3s;
  background: none;
}

.lang-tab.active,
.lang-tab:hover {
  color: #a29bfe;
  background: rgba(108,92,231,0.1);
  border-color: rgba(108,92,231,0.2);
}

/* ===== Exercise Grid ===== */
.exercise-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 40px;
  max-width: 900px;
  margin: 0 auto;
}

.exercise-card {
  background: rgba(40, 42, 68, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.exercise-card:hover {
  border-color: rgba(108,92,231,0.4);
  background: rgba(40, 40, 65, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.exercise-card .card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-icon.basic { background: linear-gradient(135deg, #dfe6e9, #b2bec3); }
.card-icon.left-upper { background: linear-gradient(135deg, #ff7675, #fab1a0); }
.card-icon.second { background: linear-gradient(135deg, #74b9ff, #a29bfe); }
.card-icon.right-upper { background: linear-gradient(135deg, #55efc4, #81ecec); }
.card-icon.left-lower { background: linear-gradient(135deg, #fdcb6e, #f39c12); }
.card-icon.right-lower { background: linear-gradient(135deg, #a29bfe, #6c5ce7); }
.card-icon.upper-lower { background: linear-gradient(135deg, #ffeaa7, #fdcb6e); }
.card-icon.word { background: linear-gradient(135deg, #fd79a8, #e84393); }
.card-icon.sentence { background: linear-gradient(135deg, #74b9ff, #0984e3); }

.exercise-card .card-title {
  font-size: 15px;
  font-weight: 600;
  color: #e8e8f0;
}

.exercise-card .card-record {
  font-size: 12px;
  color: #6a6a8a;
  margin-top: 3px;
}

.exercise-card .card-arrow {
  position: absolute;
  right: 16px;
  color: #6a6a8a;
  font-size: 16px;
}

/* ===== Empty Slots ===== */
.exercise-empty {
  background: rgba(30, 32, 52, 0.4);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 18px 20px;
  min-height: 80px;
}

/* ===== Animal Progress Bar ===== */
.animal-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(25, 28, 48, 0.95);
  backdrop-filter: blur(10px);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-top: 1px solid rgba(255,255,255,0.1);
  overflow-x: auto;
}

.animal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  color: #5a5a7a;
  gap: 2px;
  min-width: 45px;
}

.animal-item .animal-emoji {
  font-size: 20px;
  transition: transform 0.3s;
}

.animal-item.achieved .animal-emoji {
  transform: scale(1.3);
}

.animal-item.current {
  color: #ffd700;
  font-weight: bold;
}

.animal-item.current .animal-emoji {
  transform: scale(1.4);
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

/* ===== Typing Game Page ===== */
.game-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 80px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.game-header .back-btn {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #e8e8f0;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.game-header .back-btn:hover {
  background: rgba(255,255,255,0.1);
}

.game-score-label {
  font-size: 18px;
  color: #74b9ff;
  font-weight: 700;
}

.game-timer {
  font-size: 26px;
  font-weight: 700;
  color: #ff6b6b;
  background: rgba(255,107,107,0.1);
  padding: 4px 14px;
  border-radius: 10px;
}

/* Score progress bar with animals */
.score-progress {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  overflow-x: auto;
  margin-bottom: 10px;
}

.score-mark {
  font-size: 10px;
  color: #5a5a7a;
  min-width: 35px;
  text-align: center;
  opacity: 0.4;
  transition: all 0.3s;
}

.score-mark .mark-emoji {
  font-size: 16px;
  display: block;
  transition: transform 0.3s, filter 0.3s;
}

.score-mark.animal-reached {
  opacity: 1;
  color: #8888a8;
}

.score-mark.animal-current {
  opacity: 1;
  color: #ffd700;
  font-weight: bold;
}

.score-mark.animal-current .mark-emoji {
  transform: scale(1.4);
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.6));
}

/* Character Display */
.char-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 0 10px;
  min-height: 120px;
}

.char-prev,
.char-next {
  font-size: 40px;
  color: #4a4a6a;
  opacity: 0.5;
  transition: all 0.3s;
}

.char-current {
  font-size: 68px;
  font-weight: 700;
  color: #fff;
  background: rgba(108,92,231,0.12);
  padding: 10px 28px;
  border-radius: 16px;
  border: 2px solid rgba(108,92,231,0.4);
  min-width: 100px;
  text-align: center;
  box-shadow: 0 0 30px rgba(108,92,231,0.15);
}

.char-name {
  text-align: center;
  font-size: 15px;
  color: #a29bfe;
  margin-bottom: 20px;
  font-weight: 500;
}

/* ===== Virtual Keyboard ===== */
.keyboard-wrapper {
  position: relative;
  margin-top: 10px;
  overflow: visible !important;
  margin-bottom: 20px;
}

.keyboard {
  background: rgba(30, 32, 52, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px;
  position: relative;
  z-index: 1;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.key {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 4px;
  min-width: 42px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #8888a8;
  transition: all 0.15s;
  user-select: none;
}

.key.wide-1 { min-width: 60px; }
.key.wide-2 { min-width: 80px; }
.key.wide-3 { min-width: 100px; }
.key.space { flex: 1; max-width: 300px; }

.key.highlight {
  background: rgba(108, 92, 231, 0.4);
  border-color: rgba(108, 92, 231, 0.6);
  color: #fff;
  box-shadow: 0 0 14px rgba(108, 92, 231, 0.35);
}

.key.pressed {
  background: rgba(85, 239, 196, 0.3);
  transform: scale(0.95);
}

.key.key-down {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: scale(0.92);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  transition: transform 0.05s, background 0.05s;
}

.key.success-flash {
  background: rgba(85, 239, 196, 0.5);
  border-color: rgba(85, 239, 196, 0.7);
  color: #fff;
  transform: scale(1.12);
  box-shadow: 0 0 16px rgba(85, 239, 196, 0.5);
  animation: successPop 0.4s ease-out;
}

@keyframes successPop {
  0%   { transform: scale(1); background: rgba(85, 239, 196, 0.7); box-shadow: 0 0 20px rgba(85, 239, 196, 0.7); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); background: rgba(85, 239, 196, 0.2); box-shadow: none; }
}

.key.wrong {
  background: rgba(255, 107, 107, 0.4);
  border-color: rgba(255, 107, 107, 0.6);
  animation: shakeKey 0.3s ease-out;
}

@keyframes shakeKey {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-3px); }
  50%  { transform: translateX(3px); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* ===== Hand Guide (static, below keyboard) ===== */
.hands-guide {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  pointer-events: none;
}

.hand-svg {
  width: 140px;
  height: auto;
}

.finger-path {
  fill: rgba(200, 190, 220, 0.6);
  stroke: rgba(150, 140, 180, 0.3);
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: fill 0.2s, filter 0.2s;
}

.palm-path {
  fill: rgba(190, 180, 210, 0.5);
  stroke: rgba(140, 130, 170, 0.25);
  stroke-width: 1;
  stroke-linejoin: round;
}

/* ===== Layout Warning Toast ===== */
.layout-warning {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: rgba(20, 20, 35, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 200, 50, 0.3);
  border-radius: 14px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2000;
  max-width: 600px;
  transition: transform 0.4s ease;
  pointer-events: none;
  opacity: 0;
}

.layout-warning.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.layout-warning-icon {
  font-size: 22px;
  color: #ffc832;
  flex-shrink: 0;
}

.layout-warning #layout-warning-msg {
  font-size: 13px;
  color: #d0d0e0;
  line-height: 1.4;
}

.layout-warning-close {
  background: none;
  border: none;
  color: #6a6a8a;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

.layout-warning-close:hover {
  color: #fff;
}

/* ===== Game Footer ===== */
.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  margin-top: 10px;
}

.game-footer .exercise-label {
  font-size: 18px;
  font-weight: 600;
  color: #e8e8f0;
}

.game-footer .font-label {
  font-size: 16px;
  color: #6a6a8a;
}

/* ===== Sentence Exercise ===== */
.sentence-card {
  background: rgba(40, 42, 68, 0.7);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.sentence-card:hover {
  border-color: rgba(108,92,231,0.4);
  transform: translateY(-2px);
  background: rgba(40, 40, 65, 0.7);
}

.sentence-card .sentence-length {
  color: #6c5ce7;
  font-size: 13px;
  margin-bottom: 4px;
}

.sentence-card .sentence-title {
  font-size: 15px;
  font-weight: 600;
  color: #e8e8f0;
}

.sentence-card .sentence-record {
  font-size: 12px;
  color: #6a6a8a;
  margin-top: 4px;
}

.sentence-card .card-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #6a6a8a;
  font-size: 18px;
}

/* ===== Mouse Exercise ===== */
.mouse-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 30px 40px;
  max-width: 700px;
  margin: 0 auto;
}

.mouse-card {
  background: rgba(40, 42, 68, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s;
  aspect-ratio: 1;
}

.mouse-card:hover {
  border-color: rgba(108,92,231,0.4);
  background: rgba(40, 40, 65, 0.7);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}

.mouse-card .mouse-icon {
  font-size: 40px;
}

.mouse-card .mouse-label {
  font-size: 13px;
  color: #c8c8e0;
  text-align: center;
  font-weight: 600;
}

/* ===== Word Game Display ===== */
.word-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 30px 20px;
  min-height: 100px;
}

.word-char {
  font-size: 32px;
  padding: 4px 2px;
  transition: all 0.2s;
}

.word-char.typed-correct {
  color: #55efc4;
}

.word-char.typed-wrong {
  color: #ff6b6b;
  text-decoration: underline;
}

.word-char.current {
  color: #ffd700;
  border-bottom: 3px solid #ffd700;
}

.word-char.pending {
  color: #4a4a6a;
}

.word-input {
  width: 80%;
  max-width: 600px;
  margin: 0 auto;
  display: block;
  padding: 14px 20px;
  font-size: 22px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  color: #fff;
  outline: none;
  text-align: center;
  transition: border-color 0.3s;
}

.word-input:focus {
  border-color: #6c5ce7;
  box-shadow: 0 0 20px rgba(108,92,231,0.15);
}

/* ===== Results Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay .modal {
  transform: scale(0.92) translateY(10px);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

.modal {
  background: rgba(35, 38, 62, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 36px;
  width: 420px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.modal h2 {
  font-size: 24px;
  color: #ffd700;
  margin-bottom: 16px;
  font-weight: 700;
}

.modal .result-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 16px;
}

.modal .result-row .label {
  color: #6a6a8a;
}

.modal .result-row .value {
  color: #e8e8f0;
  font-weight: 600;
}

.modal .btn-restart {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  padding: 12px 36px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(108,92,231,0.3);
}

.modal .btn-restart:hover {
  box-shadow: 0 6px 24px rgba(108,92,231,0.5);
  transform: translateY(-2px);
}

.modal .btn-back {
  background: transparent;
  color: #8888a8;
  padding: 10px 28px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.3s;
}

.modal .btn-back:hover {
  border-color: rgba(108,92,231,0.4);
  color: #e8e8f0;
}

/* ===== Results Modal (wide with leaderboard) ===== */
.results-modal-wide {
  width: 520px;
  max-width: 95vw;
  padding: 28px 24px 20px;
}

.result-score-big {
  font-size: 52px;
  font-weight: 800;
  color: #ffd700;
  text-align: center;
  margin: 4px 0 2px;
  text-shadow: 0 0 30px rgba(255,215,0,0.3);
}

.result-best-label {
  text-align: center;
  font-size: 14px;
  color: #55efc4;
  margin-bottom: 12px;
  min-height: 20px;
  font-weight: 600;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
}

.result-stat {
  text-align: center;
  background: rgba(255,255,255,0.04);
  padding: 8px 14px;
  border-radius: 10px;
}

.result-stat .label {
  display: block;
  font-size: 11px;
  color: #6a6a8a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-stat .value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #e8e8f0;
  margin-top: 2px;
}

/* Leaderboard tabs */
.lb-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0;
}

.lb-tab {
  flex: 1;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #5a5a7a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.lb-tab:hover {
  color: #c8c8e0;
}

.lb-tab.active {
  color: #a29bfe;
  border-bottom-color: #a29bfe;
}

/* Leaderboard table */
.lb-table-wrap {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lb-table thead th {
  position: sticky;
  top: 0;
  background: rgba(25, 25, 45, 0.95);
  color: #5a5a7a;
  padding: 6px 8px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lb-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.lb-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.lb-table tbody td {
  padding: 6px 8px;
  color: #8888a8;
}

.lb-table tbody tr:nth-child(1) td:first-child { color: #ffd700; }
.lb-table tbody tr:nth-child(2) td:first-child { color: #c0c0c0; }
.lb-table tbody tr:nth-child(3) td:first-child { color: #cd7f32; }

.lb-table tbody tr.lb-me {
  background: rgba(108, 92, 231, 0.08);
}

.lb-table tbody tr.lb-me td {
  color: #a29bfe;
  font-weight: 600;
}

.lb-best-row {
  text-align: center;
  font-size: 13px;
  color: #5a5a7a;
  padding: 4px 0;
}

/* ===== Countdown Overlay ===== */
.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  display: none;
}

.countdown-overlay.show {
  display: flex;
}

.countdown-number {
  font-size: 120px;
  font-weight: 800;
  color: #a29bfe;
  animation: countPulse 1s ease-in-out;
  text-shadow: 0 0 40px rgba(162,155,254,0.5);
}

@keyframes countPulse {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .exercise-grid {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }

  .mouse-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 20px 16px;
  }

  .nav-btn {
    padding: 8px 12px;
    font-size: 11px;
  }

  .char-current {
    font-size: 48px;
  }

  .char-prev, .char-next {
    font-size: 26px;
  }

  .auth-box {
    padding: 32px 24px;
  }
}

/* ===== User Dropdown ===== */
.user-dropdown {
  position: absolute;
  right: 16px;
  top: 56px;
  background: rgba(35, 38, 62, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.4);
  display: none;
  z-index: 200;
  min-width: 160px;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown button {
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: #c8c8e0;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
  transition: background 0.2s;
}

.user-dropdown button:hover {
  background: rgba(255,255,255,0.06);
}

/* Page content padding for fixed bottom bar */
.page-content {
  padding-bottom: 70px;
}

/* Mouse click game styles */
.click-game-area {
  position: relative;
  width: 100%;
  height: 500px;
  background: rgba(20, 20, 35, 0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  overflow: hidden;
  margin: 20px 0;
}

.click-target {
  position: absolute;
  cursor: pointer;
  transition: transform 0.1s;
  user-select: none;
}

.click-target:hover {
  transform: scale(1.1);
}

.click-target:active {
  transform: scale(0.9);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}
