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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #f7f3ee 0%, #e8e2d5 100%);
  min-height: 100vh;
  color: #2c3e50;
  position: relative;
  overflow-x: hidden;
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 44px 40px 36px;
  border-radius: 20px;
  box-shadow:
    0 25px 60px rgba(0,0,0,0.15),
    0 8px 20px rgba(0,0,0,0.06);
  text-align: center;
  width: 380px;
  backdrop-filter: blur(12px);
}

.logo { width: 72px; height: auto; margin-bottom: 8px; border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.app-title {
  font-family: 'Georgia', serif;
  font-size: 36px;
  color: #2c3e50;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
.auth-subtitle { color: #95a5a6; font-size: 14px; margin-bottom: 24px; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 14px 18px; border: 2px solid #e8e3da; border-radius: 12px;
  font-size: 16px; background: #faf8f5; outline: none; transition: all 0.2s;
}
.auth-form input:focus { border-color: #3498db; box-shadow: 0 0 0 4px rgba(52,152,219,0.12); }

.btn-primary {
  padding: 14px 24px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 12px rgba(41,128,185,0.35);
  transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(41,128,185,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  padding: 8px 18px; border: 2px solid #d4cfc7; border-radius: 10px;
  background: transparent; color: #5a6a7a; font-size: 13px; cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { background: rgba(0,0,0,0.04); border-color: #2980b9; color: #2980b9; }

#game-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.game-header {
  width: 100%;
  max-width: 780px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 8px 0;
}
.header-left { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.header-left-row { display: flex; align-items: center; gap: 14px; }

.logo-link { display: flex; transition: opacity 0.15s; }
.logo-link:hover { opacity: 0.8; }
.logo-small { height: 42px; width: auto; }
.game-title {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 26px; font-weight: 700;
  color: #2c3e50; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-right { display: flex; align-items: center; gap: 10px; }

.header-btn {
  padding: 7px 16px; border-radius: 8px;
  background: #f0ede8; color: #5a6a7a; text-decoration: none;
  font-size: 13px; font-weight: 600;
  transition: all 0.15s; white-space: nowrap;
}
.header-btn:hover { background: #e0dcd5; color: #2c3e50; }

.user-menu { position: relative; }

.header-user {
  cursor: pointer; padding: 6px 12px; border-radius: 10px;
  transition: all 0.15s; display: flex; align-items: center; gap: 8px;
  background: #f0ede8; user-select: none;
}
.header-user:hover { background: #e0dcd5; }
.header-user::after {
  content: ''; display: inline-block; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid #95a5a6; transition: transform 0.15s;
}
.header-user.open::after { transform: rotate(180deg); }
.header-user-main { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.header-user-row { display: flex; align-items: center; gap: 6px; }

.header-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.header-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.header-username { font-size: 14px; color: #2c3e50; font-weight: 600; }
.header-score {
  font-size: 15px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  padding: 3px 12px; border-radius: 20px;
  min-width: 28px; text-align: center;
  box-shadow: 0 2px 6px rgba(39,174,96,0.3);
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 3px;
}
.header-score::before {
  content: '\2605'; font-size: 13px;
}

.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.08);
  min-width: 240px; z-index: 100; overflow: hidden;
}

.dropdown-header {
  display: flex; align-items: center; gap: 12px; padding: 16px;
}

.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.dropdown-user-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.dropdown-username { font-size: 15px; font-weight: 700; color: #2c3e50; }
.dropdown-score { font-size: 14px; color: #27ae60; font-weight: 700; }
.dropdown-score::before { content: '\2605\00a0'; }

.dropdown-divider { height: 1px; background: #e8e3da; }

.dropdown-item-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
}
.dropdown-item-row input {
  flex: 1; padding: 8px 12px; border: 2px solid #e8e3da; border-radius: 8px;
  font-size: 13px; outline: none; transition: border-color 0.15s;
}
.dropdown-item-row input:focus { border-color: #3498db; }

.dropdown-btn {
  padding: 8px 14px; border: none; border-radius: 8px;
  background: #3498db; color: #fff; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.dropdown-btn:hover { background: #2980b9; }
.dropdown-btn-danger { background: #e74c3c; }
.dropdown-btn-danger:hover { background: #c0392b; }

.avatar-upload-label {
  flex: 1; cursor: pointer; padding: 8px 12px;
  border: 2px dashed #d4cfc7; border-radius: 8px;
  text-align: center; transition: all 0.15s;
}
.avatar-upload-label:hover { border-color: #3498db; background: #eaf2f8; }
.avatar-upload-text { font-size: 13px; font-weight: 600; color: #7f8c8d; }
.avatar-upload-label:hover .avatar-upload-text { color: #3498db; }

.dropdown-item {
  padding: 12px 16px; font-size: 14px; color: #e74c3c;
  cursor: pointer; transition: background 0.12s; font-weight: 500;
}
.dropdown-item:hover { background: #fdf2f2; }
.dropdown-quit-btn {
  width: 100%; border: none; border-radius: 0; text-align: left;
  background: none; font-family: inherit;
}
.admin-link-item { color: #2c3e50 !important; text-decoration: none; }
.admin-link-item:hover { background: #eaf2f8 !important; }

.game-info-bar {
  width: 100%;
  max-width: 780px;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 10px 18px;
  background: rgba(255,255,255,0.9);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  gap: 10px;
  flex-wrap: wrap;
}
.game-info-bar > * { flex: 1 1 auto; min-width: 0; }

.difficulty-selector { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.diff-label { font-size: 12px; color: #95a5a6; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; margin-right: 4px; flex-shrink: 0; }
.diff-pts { font-size: 9px; color: #95a5a6; line-height: 1; }
.diff-btn.active .diff-pts { color: rgba(255,255,255,0.7); }
.diff-btn {
  padding: 5px 12px; border: 2px solid #e8e3da; border-radius: 20px;
  background: #fff; font-size: 11px; font-weight: 600; cursor: pointer; color: #7f8c8d;
  transition: all 0.15s; white-space: nowrap; line-height: 1.4;
}
.diff-btn:hover { border-color: #3498db; color: #3498db; }
.diff-btn.active { background: #2c3e50; border-color: #2c3e50; color: #fff; }

.game-actions { display: flex; align-items: center; gap: 12px; justify-content: center; flex-shrink: 0; }

