/* ==========================================
   NAGRAJ PREMIUM HEADER - FINAL COMPATIBILITY
   ========================================== */

/* Header spacing */

.topbar.nagraj-premium-header {
  min-height: 64px;
  margin-bottom: 12px;
  gap: 0;
}

/* Three-dot menu */

.nagraj-premium-header .nagraj-menu-button {
  border-radius: 11px;
  background: #edf4f0;
  color: #174b36;
}

/* Install button */

.nagraj-premium-header .nagraj-install-action {
  background: #ddf8e8;
  color: #07864c;
  border-color: #bceacb;
}

/* Share button */

.nagraj-premium-header .nagraj-share-action {
  background: #e5efff;
  color: #2563eb;
  border-color: #cbdcff;
}

/* Theme button */

.nagraj-premium-header .nagraj-theme-action {
  padding: 0;
  border-radius: 10px;
  background: #fff1d5;
  color: #c18410;
  border-color: #f5dfaa;
}

/* Prevent hidden install button from appearing */

.nagraj-premium-header .nagraj-header-action[hidden] {
  display: none !important;
}

/* Dark mode header */

body.dark .nagraj-premium-header {
  background: #1d293b;
  border-color: #35445a;
  box-shadow: 0 5px 18px rgba(0,0,0,.18);
}

body.dark .nagraj-brand-name {
  color: #83edaf;
}

body.dark .nagraj-brand-tagline {
  color: #9cb9a9;
}

body.dark .nagraj-premium-header .nagraj-menu-button {
  background: #293e36;
  color: #b8f1d0;
  border-color: #3b5949;
}

body.dark .nagraj-premium-header .nagraj-install-action {
  background: #173e2c;
  color: #a4f2c4;
  border-color: #286849;
}

body.dark .nagraj-premium-header .nagraj-share-action {
  background: #233958;
  color: #a7d0ff;
  border-color: #38557c;
}

body.dark .nagraj-premium-header .nagraj-theme-action {
  background: #453b27;
  color: #ffe09b;
  border-color: #665333;
}

/* Keep action icons aligned */

.nagraj-premium-header .nagraj-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nagraj-premium-header .nagraj-header-action {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Small phones */

@media (max-width: 420px) {
  .topbar.nagraj-premium-header {
    min-height: 60px;
    padding: 8px 7px;
  }

  .nagraj-premium-header .nagraj-header-actions {
    gap: 3px;
  }
}

/* NAGRAJ — Game Mode Text Bold */

.mode-card strong,
.mode-card .mode-title,
.mode-option strong,
.mode-option .mode-title {
  font-weight: 700;
}

/* ==========================================
   NAGRAJ PREMIUM SELECTION UI
   ONLY MODE, SNAKE AND DIFFICULTY
   ========================================== */

/* SELECT MODE */

.game-setup .mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.game-setup .mode-card {
  position: relative;
  min-width: 0;
  min-height: 174px;
  padding: 18px 8px 15px;
  overflow: hidden;
  border: 3px solid transparent;
  border-radius: 22px;
  color: #fff;
  gap: 9px;
  isolation: isolate;
}

.game-setup .mode-card:nth-child(1) {
  background: linear-gradient(155deg, #00b86b, #006a4b 60%, #004934);
}

.game-setup .mode-card:nth-child(2) {
  background: linear-gradient(155deg, #087dc8, #3735aa 55%, #9211c5);
}

.game-setup .mode-card .mode-icon {
  font-size: 58px;
  line-height: 1.2;
  margin: 0;
  filter: drop-shadow(0 7px 5px #0004);
}

.game-setup .mode-card strong {
  color: #fff;
  font-size: clamp(15px, 4vw, 21px);
  font-weight: 900;
  text-shadow: 0 2px 4px #0004;
}

.game-setup .mode-card small {
  color: #fff;
  opacity: .94;
  font-size: clamp(10px, 2.6vw, 13px);
}

.game-setup .mode-card.selected,
.game-setup .mode-card.active {
  border-color: #48ff87;
  box-shadow:
    0 0 0 2px #fff,
    0 0 15px #00e56b,
    0 8px 20px #008c5b55;
}

.game-setup .mode-card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 9px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  color: #078c46;
  font-size: 19px;
  font-weight: 900;
}

/* SELECT YOUR SNAKE */

#snakeCustomization {
  padding: 15px 12px;
  border-radius: 23px;
  background: linear-gradient(135deg, #fff7f0, #f4e9ff);
  border: 1px solid #f2e1ec;
}

#snakeCharacterOptions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#snakeCharacterOptions .snake-character-card {
  position: relative;
  min-width: 0;
  min-height: 174px;
  padding: 20px 8px 13px;
  justify-content: flex-end;
  border: 3px solid transparent;
  border-radius: 22px;
  color: white;
  overflow: hidden;
}

#snakeCharacterOptions .snake-character-card:nth-child(1) {
  background: linear-gradient(155deg, #ffe66a, #d78b00 65%, #754000);
}

#snakeCharacterOptions .snake-character-card:nth-child(2) {
  background: linear-gradient(155deg, #ff8bbd, #eb2180 60%, #8c145c);
}

#snakeCharacterOptions .snake-character-icon {
  font-size: 51px;
  line-height: 1.4;
  filter: drop-shadow(0 5px 5px #0004);
}

#snakeCharacterOptions .snake-character-card strong {
  color: #fff;
  font-size: 23px;
  font-weight: 900;
  text-shadow: 0 2px 5px #0006;
}

#snakeCharacterOptions .snake-character-card.selected {
  border-color: #ffe45a;
  box-shadow:
    0 0 0 2px #fff,
    0 0 16px #ffcf25,
    0 8px 20px #b77a0050;
}

#snakeCharacterOptions
.snake-character-card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: #d69a00;
  font-size: 20px;
  font-weight: 900;
}

/* SELECT DIFFICULTY */

.levels {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.levels .level-card {
  position: relative;
  min-width: 0;
  min-height: 150px;
  padding: 16px 5px 12px;
  border: 3px solid transparent;
  border-radius: 20px;
  color: #fff;
  overflow: hidden;
}

.levels .level-card:nth-child(1) {
  background: linear-gradient(160deg, #00c983, #008a62 60%, #00533d);
}

.levels .level-card:nth-child(2) {
  background: linear-gradient(160deg, #ffe95a, #ff9b24 60%, #a75c00);
}

.levels .level-card:nth-child(3) {
  background: linear-gradient(160deg, #ff4466, #e7003b 60%, #9d002c);
}

.levels .level-card .symbol {
  font-size: 44px;
  margin-bottom: 10px;
  filter: drop-shadow(0 5px 4px #0004);
}

.levels .level-card strong {
  font-size: clamp(14px, 3.5vw, 19px);
  font-weight: 900;
  color: #fff;
}

.levels .level-card small {
  font-size: 13px;
  color: #fff;
}

.levels .level-card.selected,
.levels .level-card.active {
  border-color: #55ffac;
  box-shadow:
    0 0 0 2px #fff,
    0 0 15px #00e98a,
    0 7px 18px #008b6250;
}

.levels .level-card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: #079b61;
  font-size: 17px;
  font-weight: 900;
}

/* DARK MODE: SAME PREMIUM CARD COLORS */

body.dark .game-setup .mode-card:nth-child(1) {
  background: linear-gradient(155deg, #00b86b, #006a4b 60%, #004934);
}

body.dark .game-setup .mode-card:nth-child(2) {
  background: linear-gradient(155deg, #087dc8, #3735aa 55%, #9211c5);
}

body.dark #snakeCustomization {
  background: #25243b;
  border-color: #45405c;
}

/* MOBILE */

@media (max-width: 420px) {
  .game-setup .mode-card {
    min-height: 158px;
  }

  #snakeCharacterOptions .snake-character-card {
    min-height: 158px;
  }

  .levels .level-card {
    min-height: 135px;
  }

  .levels .level-card .symbol {
    font-size: 35px;
  }

  #snakeCharacterOptions .snake-character-icon {
    font-size: 44px;
  }
}

/* ==========================================
   NAGRAJ — PREMIUM REFERENCE UI OVERRIDE
   Mode + Snake + Difficulty only
   ========================================== */

.game-setup .mode-options,
#snakeCharacterOptions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Shared premium card */

.game-setup .mode-card.premium-choice,
#snakeCharacterOptions .premium-choice,
.levels .level-card.premium-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  isolation: isolate;
  overflow: hidden;
  color: #fff;
  border: 3px solid transparent;
  border-radius: 22px;
  padding: 12px 7px 15px;
  box-shadow: 0 8px 17px #17233b30;
  -webkit-tap-highlight-color: transparent;
}

/* Decorative mountain silhouettes */

.premium-choice::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: 52%;
  z-index: -1;
  background: rgba(0, 36, 41, .28);
  clip-path: polygon(
    0 55%, 15% 25%, 28% 55%,
    46% 12%, 63% 55%, 80% 22%,
    100% 60%, 100% 100%, 0 100%
  );
}

.premium-choice::after {
  content: "✦";
  position: absolute;
  top: 24%;
  right: 13%;
  color: #fff6a5;
  font-size: 23px;
  text-shadow: 0 0 10px #fff;
  pointer-events: none;
}

/* MODE CARDS */

.game-setup .mode-card.premium-choice {
  min-height: 210px;
  gap: 5px;
}

.game-setup .mode-card.mode-single,
body.dark .game-setup .mode-card.mode-single {
  background: linear-gradient(
    155deg, #00a969 0%, #007c58 45%, #003f3d 100%
  );
}

.game-setup .mode-card.mode-computer,
body.dark .game-setup .mode-card.mode-computer {
  background: linear-gradient(
    150deg, #047ac5 0%, #3838b9 52%, #9b15cf 100%
  );
}

.premium-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 115px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 5px #0004);
}

.premium-art svg {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
}

.premium-card-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  z-index: 2;
  width: 100%;
}

.game-setup .mode-card .premium-card-copy strong {
  font-size: clamp(16px, 3.8vw, 23px);
  font-weight: 900;
  color: white;
  line-height: 1.2;
}

.game-setup .mode-card .premium-card-copy small {
  font-size: clamp(10px, 2.4vw, 13px);
  color: #fff;
  line-height: 1.3;
}

/* SNAKE CARDS */

#snakeCharacterOptions .snake-character-card.premium-choice {
  min-height: 220px;
  gap: 2px;
}

#snakeCharacterOptions .snake-king {
  background: linear-gradient(
    150deg, #ffe66a, #e5a00b 52%, #713800
  );
}

#snakeCharacterOptions .snake-queen {
  background: linear-gradient(
    150deg, #ff8cc3, #f02791 55%, #8d105d
  );
}

#snakeCharacterOptions .snake-art {
  height: 153px;
}

#snakeCharacterOptions .snake-character-card strong {
  position: relative;
  z-index: 2;
  font-size: clamp(21px, 4vw, 27px);
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 5px #0007;
}

/* DIFFICULTY */

.levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}

.levels .level-card.premium-choice {
  min-height: 175px;
  gap: 3px;
}

.levels .difficulty-easy {
  background: linear-gradient(
    155deg, #00c987, #008c65 60%, #004e3c
  );
}

.levels .difficulty-medium {
  background: linear-gradient(
    155deg, #ffe951, #ffa52a 60%, #a85c04
  );
}

.levels .difficulty-hard {
  background: linear-gradient(
    155deg, #ff3d65, #e3003d 60%, #91002d
  );
}

.levels .difficulty-art {
  height: 90px;
  margin-bottom: 5px;
}

.levels .level-card.premium-choice strong {
  font-size: clamp(14px, 3.2vw, 20px);
  font-weight: 900;
  color: white;
}

.levels .level-card.premium-choice small {
  font-size: clamp(11px, 2.7vw, 14px);
  color: #fff;
}

/* Badges and selection ticks */

.premium-decoration {
  position: absolute;
  top: 8px;
  left: 9px;
  z-index: 3;
  font-size: 25px;
  filter: drop-shadow(0 2px 3px #0003);
}

.premium-check {
  display: none;
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 5;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  color: #00a15b;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 7px #0003;
}

.premium-choice.selected .premium-check,
.premium-choice.active .premium-check,
.premium-choice[aria-pressed="true"] .premium-check {
  display: flex;
}

/* Disable duplicate ticks from previous CSS */

.game-setup .premium-choice[aria-pressed="true"]::after,
#snakeCharacterOptions .premium-choice[aria-pressed="true"]::after,
.levels .premium-choice[aria-pressed="true"]::after {
  content: "✦";
  position: absolute;
  top: 24%;
  right: 13%;
  width: auto;
  height: auto;
  background: transparent;
  color: #fff6a5;
  border-radius: 0;
  box-shadow: none;
  font-size: 23px;
}

/* Selected card glow */

.game-setup .mode-card.premium-choice.selected,
.game-setup .mode-card.premium-choice.active,
.game-setup .mode-card.premium-choice[aria-pressed="true"] {
  border-color: #5cff8b;
  box-shadow:
    0 0 0 2px #fff,
    0 0 16px #00f37b,
    0 8px 18px #007c5b55;
}

#snakeCharacterOptions .premium-choice.selected,
#snakeCharacterOptions .premium-choice[aria-pressed="true"] {
  border-color: #ffe95c;
  box-shadow:
    0 0 0 2px #fff,
    0 0 18px #ffcc25,
    0 8px 18px #9e690055;
}

.levels .premium-choice.selected,
.levels .premium-choice.active,
.levels .premium-choice[aria-pressed="true"] {
  border-color: #59ffad;
  box-shadow:
    0 0 0 2px #fff,
    0 0 16px #00ec8a,
    0 8px 18px #007e5a55;
}

/* Keep artwork bright in dark mode */

body.dark .premium-choice {
  color: white;
}

body.dark #snakeCharacterOptions .snake-king {
  background: linear-gradient(150deg, #ffe66a, #e5a00b 52%, #713800);
}

body.dark #snakeCharacterOptions .snake-queen {
  background: linear-gradient(150deg, #ff8cc3, #f02791 55%, #8d105d);
}

/* Mobile layout */

@media (max-width: 650px) {
  .game-setup .mode-options,
  #snakeCharacterOptions {
    gap: 10px;
  }

  .game-setup .mode-card.premium-choice {
    min-height: 180px;
    padding: 9px 5px 12px;
  }

  .game-setup .mode-card .premium-art {
    height: 100px;
  }

  #snakeCharacterOptions .snake-character-card.premium-choice {
    min-height: 185px;
  }

  #snakeCharacterOptions .snake-art {
    height: 125px;
  }

  .levels {
    gap: 8px;
  }

  .levels .level-card.premium-choice {
    min-height: 145px;
    padding: 10px 3px;
  }

  .levels .difficulty-art {
    height: 70px;
  }
}

@media (max-width: 370px) {
  .game-setup .mode-card .premium-card-copy small {
    font-size: 9px;
  }

  #snakeCharacterOptions .snake-art {
    height: 105px;
  }

  .levels .difficulty-art {
    height: 58px;
  }

  .premium-check {
    width: 25px;
    height: 25px;
    font-size: 19px;
  }
}

/* ==========================================
   NAGRAJ PREMIUM PLAYER CARDS
   ========================================== */

.nagraj-lb .nagraj-premium-player,
.modal-content .nagraj-premium-player,
#modalContent .nagraj-premium-player {
  position: relative;
  display: grid;
  grid-template-columns: 44px 42px minmax(0, 1fr) 25px auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 82px;
  padding: 10px;
  box-sizing: border-box;
  border: 2px solid #e2e8f0;
  border-radius: 19px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 5px 12px rgba(20, 35, 70, .07);
}

/* GOLD */

.nagraj-premium-player.nagraj-player-gold {
  background: linear-gradient(110deg, #fff1a9, #fff9db);
  border-color: #ffc329;
  box-shadow: 0 4px 14px #e6ad3640;
}

/* SILVER */

.nagraj-premium-player.nagraj-player-silver {
  background: linear-gradient(110deg, #e5ecff, #f2f7ff);
  border-color: #c9d6f5;
}

/* BRONZE */

.nagraj-premium-player.nagraj-player-bronze {
  background: linear-gradient(110deg, #fff0dc, #fffaf0);
  border-color: #e7b27a;
}

/* CURRENT PLAYER */

.nagraj-premium-player.nagraj-player-me {
  background: linear-gradient(110deg, #d5ffe2, #eafff0);
  border-color: #0dcb50;
  box-shadow: 0 4px 15px #13c95335;
}

/* MEDALS */

.nagraj-player-medal {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 35px;
  filter: drop-shadow(0 3px 3px #0002);
}

/* SNAKE AVATAR */

.nagraj-player-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(145deg, #006d48, #00452e);
  border: 2px solid #ffffff;
  font-size: 25px;
  box-shadow: 0 2px 7px #0002;
}

/* PLAYER NAME */

.nagraj-player-name {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 850;
  color: #202448;
}

/* DECORATIVE CROWN */

.nagraj-player-watermark {
  position: absolute;
  right: 95px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 56px;
  line-height: 1;
  opacity: .09;
  pointer-events: none;
}

/* TROPHY */

.nagraj-player-trophy {
  position: relative;
  z-index: 1;
  font-size: 22px;
  text-align: center;
}

/* SCORE */

.nagraj-player-score {
  position: relative;
  z-index: 1;
  font-size: 20px;
  font-weight: 900;
  color: #202448;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* CURRENT USER COLORS */

.nagraj-player-me .nagraj-player-name,
.nagraj-player-me .nagraj-player-score {
  color: #06482c;
}

/* MOBILE */

@media (max-width: 420px) {
  .nagraj-lb .nagraj-premium-player,
  #modalContent .nagraj-premium-player {
    grid-template-columns: 34px 34px minmax(0, 1fr) 20px auto;
    min-height: 68px;
    padding: 8px 7px;
    gap: 5px;
    border-radius: 15px;
  }

  .nagraj-player-medal {
    width: 34px;
    height: 34px;
    font-size: 29px;
  }

  .nagraj-player-avatar {
    width: 34px;
    height: 34px;
    font-size: 21px;
  }

  .nagraj-player-name {
    font-size: 12px;
  }

  .nagraj-player-trophy {
    font-size: 17px;
  }

  .nagraj-player-score {
    font-size: 16px;
  }

  .nagraj-player-watermark {
    right: 60px;
    font-size: 43px;
  }
}
/* NAGRAJ — DOWNLOAD APP HEADER BUTTON */

.nagraj-header-actions .nagraj-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;

  width: auto;
  min-width: 90px;
  height: 48px;
  padding: 6px 10px;

  border: 2px solid #ffffff;
  border-radius: 15px;

  background: linear-gradient(
    135deg,
    #00cf65 0%,
    #008b43 100%
  );

  color: #ffffff;

  box-shadow:
    0 0 0 1px #00b85b,
    0 3px 12px rgba(0, 170, 80, 0.28);

  cursor: pointer;
  flex-shrink: 0;
}

.nagraj-header-actions .nagraj-download-button[hidden] {
  display: none !important;
}

.nagraj-download-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nagraj-download-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;

  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
}

.nagraj-download-label small {
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.nagraj-header-actions .nagraj-download-button:hover {
  background: linear-gradient(
    135deg,
    #00e26d,
    #007b3c
  );
}

@media (max-width: 480px) {
  .nagraj-header-actions .nagraj-download-button {
    min-width: 77px;
    height: 43px;
    padding: 5px 7px;
    gap: 3px;
    border-radius: 12px;
  }

  .nagraj-download-icon svg {
    width: 19px;
    height: 19px;
  }

  .nagraj-download-label {
    font-size: 10px;
  }

  .nagraj-download-label small {
    font-size: 9px;
  }
}
/* DOWNLOAD APP — RESPONSIVE FIX */

.nagraj-header-actions .nagraj-download-button {
  box-sizing: border-box;
  width: auto;
  min-width: 94px;
  max-width: none;
  height: 44px;
  padding: 5px 9px;
  flex: 0 0 auto;
  gap: 5px;
}

.nagraj-header-actions .nagraj-download-button[hidden] {
  display: none !important;
}

.nagraj-download-icon {
  flex: 0 0 auto;
}

.nagraj-download-label {
  display: flex;
  flex-direction: column;
  width: auto;
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .nagraj-header-actions .nagraj-download-button {
    min-width: 86px;
    height: 42px;
    padding: 5px 7px;
  }

  .nagraj-download-label {
    font-size: 10px;
  }

  .nagraj-download-label small {
    font-size: 9px;
  }
}
/* Hide download button whenever install is unavailable */
.nagraj-header-actions .nagraj-download-button[hidden] {
  display: none !important;
}