.select-screen {
  position: relative;
  z-index: 2;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 20px 60px;
  text-align: center;
}

.select-title {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.select-subtitle {
  color: var(--blue-light);
  opacity: 0.9;
  margin-top: 6px;
  margin-bottom: 28px;
  font-size: 1rem;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.char-card {
  position: relative;
  border: 3px solid transparent;
  border-radius: 28px;
  padding: 20px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: radial-gradient(circle at 35% 30%, var(--clay-light) 0%, var(--clay-dark) 100%);
  box-shadow:
    inset 0 4px 8px rgba(255, 255, 255, 0.5),
    inset 0 -8px 14px rgba(0, 0, 0, 0.25),
    0 10px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.char-card:hover {
  transform: translateY(-3px) scale(1.03);
}

.char-card:active {
  transform: translateY(0) scale(0.97);
}

.char-card.selected {
  border-color: var(--gold);
  box-shadow:
    inset 0 4px 8px rgba(255, 255, 255, 0.5),
    inset 0 -8px 14px rgba(0, 0, 0, 0.25),
    0 0 0 4px rgba(212, 175, 55, 0.25),
    0 10px 22px rgba(212, 175, 55, 0.4);
  animation: pop 0.35s ease;
}

@keyframes pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1.03); }
}

.char-card.selected::after {
  content: "✓";
  position: absolute;
  top: -8px;
  left: -8px;
  width: 26px;
  height: 26px;
  background: var(--gold);
  color: var(--black);
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.char-avatar-img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.85);
}

.char-name {
  /* شريط داكن تحت الاسم: يُقرأ بوضوح فوق كل ألوان البطاقات، حتى الذهبية الفاتحة. */
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--cream);
  background: rgba(10, 15, 30, 0.72);
  border-radius: 999px;
  padding: 2px 14px 4px;
}

.naming-section {
  margin: -8px 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

.naming-section[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chosen-hero {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 5px 16px 5px 6px;
  border-radius: 999px;
  color: var(--cream);
  font-size: 0.95rem;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.5);
}

.chosen-hero:empty {
  display: none;
}

.chosen-hero img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 2px solid var(--gold);
}

.chosen-hero b {
  color: var(--gold-light);
}

.naming-label {
  color: var(--gold-light);
  font-weight: 800;
  font-size: 1.1rem;
}

.naming-hint {
  color: rgba(247, 241, 227, 0.75);
  font-size: 0.85rem;
}

.name-input {
  font-family: 'Cairo', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--blue-light);
  border-radius: 999px;
  padding: 12px 26px;
  width: min(260px, 80vw);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.name-input::placeholder {
  color: rgba(247, 241, 227, 0.4);
}

.name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.2);
}

.continue-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  scroll-margin-bottom: 24px;
}

.continue-hint {
  color: rgba(247, 241, 227, 0.75);
  font-size: 0.85rem;
  font-weight: 600;
}

.continue-hint[hidden] {
  display: none;
}

.continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--black);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none;
  border-radius: 999px;
  padding: 15px 40px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.continue-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.continue-btn:not(:disabled):hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.45);
}

.photo-hero-section {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(300px, 85vw);
}

.photo-hero-hint {
  color: rgba(247, 241, 227, 0.75);
  font-size: 0.8rem;
  line-height: 1.5;
}

.photo-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--blue-light);
  background: rgba(255, 255, 255, 0.06);
  border: 2px dashed var(--blue-light);
  border-radius: 999px;
  padding: 10px 24px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.photo-hero-btn:hover {
  transform: translateY(-2px);
  background: rgba(96, 165, 250, 0.12);
}

.photo-hero-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--gold-light);
  font-size: 0.85rem;
  font-weight: 600;
}

.photo-hero-loading[hidden] {
  display: none;
}

.photo-hero-spinner {
  display: block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(212, 175, 55, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: photo-hero-spin 0.9s linear infinite;
}

@keyframes photo-hero-spin {
  to { transform: rotate(360deg); }
}

.photo-hero-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.photo-hero-result[hidden] {
  display: none;
}

.photo-hero-result img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.4);
}

.photo-hero-actions {
  display: flex;
  gap: 10px;
}

.photo-hero-accept,
.photo-hero-retry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.photo-hero-accept {
  color: var(--black);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.photo-hero-retry {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.photo-hero-accept:hover,
.photo-hero-retry:hover {
  transform: translateY(-2px);
}

.photo-hero-result.accepted .photo-hero-accept {
  opacity: 0.55;
  pointer-events: none;
}

.photo-hero-error {
  color: #f87171;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}
