/* KOUNGA v34: isolated, intentional visual system repair.
   Profiles, player chips and theme treatment are defined as whole components
   rather than layering competing fixes into the legacy stylesheet. */

/* Profile: the identity heading has its own single alignment context. */
#modal-profile .profile-modal {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 14px !important;
  width: min(760px, calc(100vw - 28px)) !important;
  max-width: 760px !important;
  max-height: min(90dvh, 960px) !important;
  padding: 22px 24px !important;
  margin: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  text-align: left !important;
  box-sizing: border-box !important;
}
#modal-profile .profile-modal > *:not(#btnCloseProfile) {
  min-width: 0;
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
#modal-profile .profile-modal .hidden { display: none !important; }
#modal-profile .profile-heading-v34 {
  display: grid;
  grid-template-columns: 100px minmax(0,1fr);
  align-items: stretch;
  column-gap: 16px;
  min-height: 100px;
  width: 100%;
}
#modal-profile .profile-avatar {
  width: 100px !important;
  height: 100px !important;
  margin: 0 !important;
  justify-self: start !important;
  align-self: stretch !important;
  box-sizing: border-box !important;
  padding: 7px;
}
#modal-profile .profile-title-v34 {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 0 0;
  min-width: 0;
}
#modal-profile .profile-name {
  width: 100% !important;
  margin: 0 !important;
  font-size: clamp(31px, 4.6vw, 45px) !important;
  line-height: 1.05 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#modal-profile .profile-status {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  width: max-content !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 7px 14px !important;
  min-height: 29px;
  line-height: 1.1 !important;
  font-family: var(--ui-display);
  font-size: 15px !important;
  font-weight: 700;
  border: 1px solid rgba(185, 217, 189, .16);
  background: rgba(13, 39, 26, .35);
  color: #bfe8cf;
  border-radius: 999px;
  box-sizing: border-box;
}
#modal-profile .profile-identity-edit {
  padding: 16px 18px !important;
  border-radius: 14px;
}
#modal-profile .profile-edit-field { margin-bottom: 14px !important; }
#modal-profile .profile-edit-field:last-child { margin-bottom: 0 !important; }
#modal-profile .profile-edit-field > span {
  font-size: 17px !important;
  margin-bottom: 8px !important;
}
#modal-profile .profile-username-row {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) 126px !important;
  gap: 12px !important;
  align-items: stretch !important;
  width: 100%;
}
#modal-profile .profile-name-input,
#modal-profile .profile-username-claim {
  height: 56px !important;
  min-height: 56px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  align-self: stretch !important;
  font-family: var(--ui-display);
  font-size: 23px !important;
  line-height: 1.1 !important;
}
#modal-profile .profile-username-claim {
  display: flex !important;
  justify-content: center;
  align-items: center;
  padding: 0 10px !important;
  box-shadow: 0 2px 0 rgba(0,0,0,.42) !important;
  transform: none !important;
}
#modal-profile .profile-username-hint {
  display: block;
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.35;
}
#modal-profile .profile-avatar-picker {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  justify-content: stretch;
  gap: 7px !important;
}
#modal-profile .profile-avatar-picker .avatar-opt {
  width: min(100%, 64px) !important;
  aspect-ratio: 1;
  height: auto !important;
  padding: 5px;
}

/* Signed-in account: compact two-column information/action card. */
#modal-profile #profileAccount {
  display: grid !important;
  grid-template-columns: 168px minmax(0,1fr) !important;
  gap: 14px !important;
  align-items: center !important;
  padding: 14px 16px !important;
  min-height: 0 !important;
  background: linear-gradient(130deg, rgba(66,100,106,.16), rgba(23,24,23,.35));
  border-radius: 14px;
}
#modal-profile #profileAccount.hidden { display: none !important; }
#modal-profile .profile-account-head {
  display: flex !important;
  flex-direction: row;
  align-items: center !important;
  gap: 9px;
  margin: 0 !important;
  min-width: 0;
}
#modal-profile .profile-account-head img {
  width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px;
}
#modal-profile .profile-account-head strong {
  font-size: 20px !important;
  line-height: 1.05;
}
#modal-profile .profile-account-head span {
  font-size: 12px !important;
  margin-top: 5px !important;
  line-height: 1.2;
}
#modal-profile .profile-account-state {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 16px !important;
  margin: 0 !important;
  min-height: 0 !important;
  min-width: 0;
}
#modal-profile .profile-account-state.hidden { display: none !important; }
#modal-profile .account-connected-row {
  flex: 1 1 220px;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
}
#modal-profile .account-connected-row strong { font-size: 16px; line-height: 1.1; }
#modal-profile .account-connected-row small {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.2;
}
#modal-profile #accountSignedState p {
  flex: 1 1 100%;
  order: 3;
  margin: 0 !important;
  font-size: 12px !important;
  line-height: 1.3;
  color: rgba(246,236,210,.66);
}
#modal-profile #btnSignOut {
  flex: 0 0 auto;
  min-height: 42px;
  font-size: 16px !important;
  padding: 8px 16px !important;
  box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
#modal-profile #accountGuestState p { margin: 0 !important; flex: 1 1 200px; }
#modal-profile #googleSignInMount { min-height: 38px; flex: 0 0 auto; }
#modal-profile #profileHint { display: none !important; }

/* Stats/level/activity have consistent hierarchy and no narrow grid tracks. */
#modal-profile .profile-game-title {
  font-family: var(--ui-display) !important;
  font-size: 22px !important;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 2px !important;
}
#modal-profile .profile-stats-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}
#modal-profile .profile-stat { min-width: 0; padding: 10px 14px; }
#modal-profile .profile-stat strong {
  font-family: var(--ui-display) !important;
  font-size: 26px !important;
  margin-bottom: 3px;
}
#modal-profile .profile-stat span { font-size: 13px !important; }
#modal-profile .profile-progress { padding: 12px 15px; }
#modal-profile .profile-progress-top { font-size: 15px !important; }
#modal-profile .profile-progress-link { font-size: 14px !important; }
#modal-profile .profile-activity { padding: 14px !important; }
#modal-profile .profile-activity-head strong { font-size: 21px !important; }
#modal-profile .profile-activity-grid {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important;
  gap: 16px !important;
}
#modal-profile .profile-activity-label { font-size: 13px !important; }
#modal-profile .profile-recent-players,
#modal-profile .profile-recent-matches { min-width: 0; }
#modal-profile .profile-recent-match { min-width: 0; }
#modal-profile .profile-activity-empty {
  min-width: 0 !important;
  line-height: 1.35;
  overflow-wrap: break-word;
}
#modal-profile #btnCloseProfile {
  align-self: flex-end !important;
  margin: 2px 0 0 !important;
  min-width: 136px !important;
  min-height: 46px !important;
  font-size: 20px !important;
  box-shadow: 0 3px 0 rgba(0,0,0,.42);
}
@media (max-width: 690px) {
  #modal-profile .profile-modal { padding: 14px 15px !important; gap: 11px !important; }
  #modal-profile .profile-heading-v34 { grid-template-columns: 76px minmax(0,1fr); min-height: 76px; gap: 12px; }
  #modal-profile .profile-avatar { width: 76px !important; height: 76px !important; }
  #modal-profile .profile-name { font-size: 31px !important; }
  #modal-profile .profile-status { font-size: 12px !important; padding: 6px 10px !important; }
  #modal-profile .profile-username-row { grid-template-columns: minmax(0,1fr) 94px !important; gap: 8px !important; }
  #modal-profile .profile-name-input, #modal-profile .profile-username-claim { height: 49px !important; min-height: 49px !important; font-size: 18px !important; }
  #modal-profile .profile-avatar-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: start; }
  #modal-profile #profileAccount { grid-template-columns: minmax(0,1fr) !important; gap: 12px !important; }
  #modal-profile .profile-activity-grid { grid-template-columns: minmax(0,1fr) !important; }
}

/* Compact player chips: one identity line, one icon-only metrics line. */
.player-rail { align-items: stretch !important; gap: 8px !important; }
.pchip {
  display: grid !important;
  grid-template-columns: 40px minmax(0,1fr) auto !important;
  grid-template-rows: 1fr !important;
  align-items: center !important;
  gap: 9px !important;
  flex: 1 1 185px !important;
  min-width: 0 !important;
  max-width: 350px !important;
  min-height: 65px !important;
  padding: 6px 11px 6px 7px !important;
  border-radius: 13px !important;
  box-sizing: border-box !important;
}
.pchip-av {
  width: 40px !important;
  height: 40px !important;
  align-self: center;
  flex-shrink: 0;
}
.pchip-body {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 5px !important;
  min-width: 0 !important;
  width: 100%;
}
.pchip-name {
  font-family: var(--ui-display);
  font-size: 18px !important;
  max-width: 100% !important;
  line-height: 1.04 !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  overflow: hidden !important;
}
.pchip-meta { display: flex !important; align-items: center !important; gap: 11px !important; flex-wrap: nowrap !important; min-width: 0; }
.pchip-score, .pchip-count {
  display: inline-flex !important;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px !important;
  padding: 0 !important;
  background: none !important;
  border: 0 !important;
  min-width: 0;
  height: auto;
}
.pchip-score strong, .pchip-count strong {
  font-family: var(--ui-display);
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
}
.pchip-score strong { color: #f4ca46; }
.pchip-count strong { color: #d5efe4; }
.pchip-point-glyph, .pchip-card-glyph {
  display: block;
  flex: 0 0 16px;
  height: 16px;
  width: 16px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}
.pchip-point-glyph { background-image: url('../assets/ui/points.png?v=40'); }
.pchip-card-glyph { background-image: url('../assets/ui/hand.png?v=40'); }
.pchip-missed {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  margin-inline-start: auto;
  opacity: .95;
}
.pchip-missed i, .pchip-timer-strikes i {
  display: inline-block;
  flex: 0 0 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(245,237,215,.25);
  border: 1px solid rgba(245,237,215,.12);
}
.pchip-missed i.spent, .pchip-timer-strikes i.spent {
  background: #e99b5a;
  border-color: #f7ba71;
}
.pchip-timer {
  position: relative !important;
  display: grid !important;
  grid-column: 3 !important;
  grid-row: 1 !important;
  place-items: center !important;
  flex: 0 0 47px !important;
  width: 47px !important;
  min-width: 47px !important;
  height: 47px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  border-radius: 50% !important;
  overflow: hidden !important;
}
.pchip-timer-bar {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: auto !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
  background: conic-gradient(#a5dc9f var(--turn-progress,100%), rgba(194,205,183,.16) 0) !important;
  border-radius: 50% !important;
  z-index: 0 !important;
}
.pchip-timer-bar::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: #231f1b;
  border-radius: 50%;
}
.pchip-timer-seconds {
  z-index: 2 !important;
  position: relative !important;
  top: -3px !important;
  font-family: var(--ui-display) !important;
  font-size: 18px !important;
  font-weight: 800;
  color: #f5e9c8 !important;
}
.pchip-timer-strikes {
  position: absolute !important;
  z-index: 3 !important;
  inset: auto 0 7px !important;
  display: flex !important;
  width: 100%;
  height: 6px;
  gap: 3px;
  padding: 0 !important;
  background: none !important;
  justify-content: center;
  align-items: center;
}
.pchip-timer.urgent .pchip-timer-bar { background: conic-gradient(#e49a50 var(--turn-progress,100%), rgba(194,205,183,.16) 0) !important; }
.pchip-timer.critical .pchip-timer-bar { background: conic-gradient(#e75d56 var(--turn-progress,100%), rgba(194,205,183,.16) 0) !important; }
@media (max-width: 750px) {
  .player-rail { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 5px !important; }
  .pchip { width: 100% !important; min-height: 52px !important; max-width: none !important; padding: 5px 7px !important; grid-template-columns: 30px minmax(0,1fr) auto !important; gap: 5px !important; border-width: 2px !important; }
  .pchip-av { width: 30px !important; height: 30px !important; }
  .pchip-name { font-size: 13px !important; }
  .pchip-score strong,.pchip-count strong { font-size: 12px !important; }
  .pchip-meta { gap: 7px !important; }
  .pchip-point-glyph,.pchip-card-glyph { width: 12px; height: 12px; flex-basis: 12px; }
  .pchip-timer { width: 35px !important; min-width: 35px !important; height: 35px !important; }
  .pchip-timer-seconds { font-size: 14px !important; top: -2px !important; }
  .pchip-timer-bar::after { inset: 3px; }
  .pchip-timer-strikes { bottom: 5px !important; }
  .pchip-timer-strikes i { flex-basis: 4px; height: 4px; }
}

/* Theme-specific raster sprites rather than darkening all imagery with filters. */
body.light .settings-tabs-v12 img,
body.light .title-menu-button:not(.title-menu-primary)>img,
body.light .title-menu-primary>img,
body.light .title-profile-open img,
body.light .progress-tabs-v12 img,
body.light .progress-back-v12 img,
body.light .progress-done-v12 img,
body.light .hud-icon-img,
body.light .icon-btn img,
body.light .settings-diagnostic-button img,
body.light .play-mode-card img,
body.light .title-utility-row img,
body.light .profile-account-head img { filter: none !important; opacity: 1 !important; }
body.light .title-menu-button small,
body.light #homeLevelBadge { color:#3f3423 !important; border-color: #b69a56 !important; background: rgba(255,250,231,.70) !important; }
body.light .pchip-point-glyph{ background-image: url('../assets/ui/light/points.png?v=40'); }
body.light .pchip-card-glyph{ background-image: url('../assets/ui/light/hand.png?v=40'); }
/* Grid-area names from the legacy direct-child profile grid must not escape
   into the newly wrapped profile header. Explicit placement prevents implicit
   tracks from sending the avatar to the far-right of the modal. */
#modal-profile .profile-heading-v34 { grid-template-areas: 'avatar title' !important; }
#modal-profile .profile-heading-v34 .profile-avatar { grid-area: avatar !important; }
#modal-profile .profile-heading-v34 .profile-title-v34 { grid-area: title !important; }
@media (max-width: 710px) {
}

/* Matched two-choice settings controls, both fully clickable. */
.settings-language-compact .language-options,
.settings-appearance-compact .mode-options {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  justify-content: stretch !important;
  gap: 9px !important;
  width: min(100%,420px) !important;
  max-width: 100% !important;
  margin-inline: auto !important;
}
.settings-appearance-compact .mode-options button,
.settings-language-compact .language-options button {
  min-height: 48px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  pointer-events: auto !important;
}
/* No pale gold-on-cream in light-mode profile/progression controls. */
body.light #homeLevelBadge,
body.light #homeLevelText,
body.light #homeXpText,
body.light .title-profile-level,
body.light .title-profile-copy label,
body.light .profile-username-hint,
body.light .range-val {
  color: #45351f !important;
}
#modal-profile .profile-activity-empty {
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
}

/* ===================== v35 polish pass ===================== */
/* 1) The round / phase copy must centre across the whole visible bar, not
   just the leftover gap between the edge controls. */
.statusbar{position:relative!important;justify-content:space-between!important;min-height:56px!important;}
.statusbar>.hud-menu,.statusbar>.status-side{position:relative!important;z-index:2!important;}
.status-center{
  position:absolute!important;inset:0!important;left:0!important;transform:none!important;
  width:100%!important;display:flex!important;flex-direction:column!important;
  align-items:center!important;justify-content:center!important;
  text-align:center!important;pointer-events:none!important;z-index:1!important;
  padding:0 152px 0 110px!important;box-sizing:border-box!important;
}
.status-round,.status-phase{width:100%!important;display:block!important;text-align:center!important;}
.status-round{font-size:14px!important;line-height:1.05!important;color:var(--gold-ink)!important;}
.status-phase{font-size:20px!important;line-height:1.08!important;font-weight:800!important;text-overflow:ellipsis!important;overflow:hidden!important;white-space:nowrap!important;}
@media (max-width: 980px){
  .status-center{padding:0 126px 0 96px!important;}
  .status-phase{font-size:18px!important;}
}
@media (max-width: 700px){
  .statusbar{min-height:52px!important;}
  .status-center{padding:0 128px 0 84px!important;}
  .status-round{font-size:12px!important;}
  .status-phase{font-size:15px!important;}
}
@media (max-width: 520px){
  .status-center{padding:0 112px 0 74px!important;}
}

/* 2) Rework the player rail chips so score / card count are explicit and
   the turn timer feels integrated rather than like an empty extra box. */
.pchip{position:relative!important;display:grid!important;grid-template-columns:36px minmax(0,1fr)!important;align-items:center!important;gap:8px!important;padding:8px 12px 8px 8px!important;min-height:60px!important;overflow:hidden!important;}
.pchip.has-clock{padding-right:48px!important;}
.pchip-av{width:36px!important;height:36px!important;border-radius:8px!important;}
.pchip-body{gap:6px!important;width:100%!important;}
.pchip-name{font-size:16px!important;line-height:1!important;color:var(--cream)!important;}
.pchip-meta{display:flex!important;align-items:center!important;gap:6px!important;flex-wrap:wrap!important;min-width:0!important;}
.pchip-score,.pchip-count{
  display:inline-flex!important;align-items:center!important;gap:5px!important;
  min-height:20px!important;padding:2px 7px!important;border-radius:7px!important;
  background:rgba(0,0,0,.23)!important;border:1px solid rgba(255,255,255,.09)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05)!important;
}
.pchip-score strong,.pchip-count strong{font-size:13px!important;line-height:1!important;font-weight:800!important;}
.pchip-score strong{color:#f4ca46!important;}
.pchip-count strong{color:#d5efe4!important;}
.pchip-point-glyph,.pchip-card-glyph{width:14px!important;height:14px!important;flex-basis:14px!important;}
.pchip.low-cards .pchip-count{background:rgba(178,88,28,.22)!important;border-color:rgba(240,181,74,.35)!important;}
.pchip-missed{margin-inline-start:auto!important;background:rgba(0,0,0,.20)!important;padding:2px 5px!important;border-radius:999px!important;border:1px solid rgba(255,255,255,.08)!important;gap:4px!important;}
.pchip-timer{
  position:absolute!important;right:8px!important;top:50%!important;transform:translateY(-50%)!important;
  width:32px!important;min-width:32px!important;height:32px!important;overflow:visible!important;
}
.pchip-timer-seconds{font-size:13px!important;top:-2px!important;}
.pchip-timer-strikes{inset:auto 0 -6px!important;height:5px!important;gap:2px!important;}
.pchip-timer-strikes i,.pchip-missed i{flex-basis:4px!important;width:4px!important;height:4px!important;}
@media (max-width: 750px){
  .pchip{grid-template-columns:30px minmax(0,1fr)!important;gap:6px!important;padding:6px 9px 6px 6px!important;min-height:52px!important;}
  .pchip.has-clock{padding-right:40px!important;}
  .pchip-av{width:30px!important;height:30px!important;}
  .pchip-name{font-size:12px!important;}
  .pchip-score strong,.pchip-count strong{font-size:11px!important;}
  .pchip-point-glyph,.pchip-card-glyph{width:12px!important;height:12px!important;flex-basis:12px!important;}
  .pchip-timer{width:28px!important;min-width:28px!important;height:28px!important;right:6px!important;}
  .pchip-timer-seconds{font-size:11px!important;}
}
body.light .pchip{background:rgba(255,255,255,.72)!important;border-color:rgba(107,87,54,.24)!important;box-shadow:0 3px 0 rgba(82,61,30,.12),inset 0 1px 0 rgba(255,255,255,.95)!important;}
body.light .pchip-name{color:#2c241d!important;}
body.light .pchip-score,body.light .pchip-count,body.light .pchip-missed{background:rgba(113,91,54,.08)!important;border-color:rgba(113,91,54,.18)!important;}
body.light .pchip-score strong{color:#815a04!important;}
body.light .pchip-count strong{color:#215049!important;}
body.light .pchip-timer-bar::after{background:#f7f1e4!important;}
body.light .pchip-timer-seconds{color:#4f412f!important;}

/* 3) Profile signed-in label and account panel clean-up. */
.profile-status{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  min-height:34px!important;padding:5px 12px 4px!important;border-radius:9px!important;
  border:2px solid rgba(240,196,25,.24)!important;background:rgba(0,0,0,.16)!important;
  box-shadow:0 3px 0 rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.05)!important;
  color:#cfe8d9!important;font-family:var(--ui-display)!important;font-size:15px!important;line-height:1!important;
}
.profile-account{border-color:rgba(240,196,25,.18)!important;background:linear-gradient(180deg,rgba(240,196,25,.05),rgba(0,0,0,.12))!important;}
.profile-account-head span{color:#d1c2a2!important;font-weight:700!important;}
.account-connected-row{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:2px!important;align-items:start!important;}
.account-connected-dot{display:none!important;}
.account-connected-row strong{font-family:var(--ui-display)!important;font-size:16px!important;color:var(--cream)!important;}
.account-connected-row small{font-size:13px!important;color:rgba(246,236,210,.78)!important;max-width:none!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;}
body.light .profile-status{background:rgba(115,139,120,.12)!important;border-color:rgba(115,139,120,.34)!important;color:#587a66!important;box-shadow:0 3px 0 rgba(92,70,37,.10), inset 0 1px 0 rgba(255,255,255,.92)!important;}
body.light .profile-account{background:rgba(255,255,255,.62)!important;border-color:rgba(108,84,46,.20)!important;}
body.light .profile-account-head strong,
body.light .account-connected-row strong,
body.light .profile-stat strong,
body.light .profile-game-title,
body.light .profile-activity-head strong,
body.light .profile-activity-label{color:#2f251b!important;}
body.light .profile-account-head span{color:#81600a!important;}
body.light .profile-account-state p,
body.light .profile-account-row small,
body.light #accountEmail,
body.light .profile-hint,
body.light .profile-stat span{color:rgba(47,37,27,.78)!important;opacity:1!important;}

/* 4) Social search row sizing and cohesion. */
.social-search-row{align-items:stretch!important;}
.social-search-row .text-input,
.social-search-row .btn{
  min-height:56px!important;height:56px!important;box-sizing:border-box!important;
  border-radius:14px!important;
}
.social-search-row .btn{min-width:160px!important;padding-inline:18px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;}
@media (max-width: 820px){
  .social-search-row .btn{min-width:0!important;width:100%!important;}
}

/* 5) One consistent selected-state language across Settings / Locker / Path. */
.settings-pane-v12 .mode-options button.active,
.settings-pane-v12 .language-options button.active,
.settings-pane-v12 [data-pack].active,
.settings-pane-v12 [data-texture].active,
.settings-tabs-v12 button.active,
.progress-tabs-v12 button.active,
.progress-locker-tabs-v12 button.active{
  background:linear-gradient(180deg,rgba(240,196,25,.18),rgba(240,196,25,.08))!important;
  border-color:rgba(240,196,25,.72)!important;
  color:#f0c419!important;
  box-shadow:0 0 0 2px rgba(240,196,25,.18), 0 3px 0 rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.10)!important;
}
body.light .settings-pane-v12 .mode-options button.active,
body.light .settings-pane-v12 .language-options button.active,
body.light .settings-pane-v12 [data-pack].active,
body.light .settings-pane-v12 [data-texture].active,
body.light .settings-tabs-v12 button.active,
body.light .progress-tabs-v12 button.active,
body.light .progress-locker-tabs-v12 button.active{
  background:linear-gradient(180deg,#fbefc5,#f4e4ae)!important;
  border-color:#d8aa1f!important;color:#5d4300!important;
  box-shadow:0 0 0 2px rgba(216,170,31,.18), 0 3px 0 rgba(116,89,39,.14), inset 0 1px 0 rgba(255,255,255,.95)!important;
}

/* 6) Light-mode icon treatment must come from raster assets only. */
body.light .settings-tabs-v12 img,
body.light .settings-tabs-v12 button.active img,
body.light .progress-tabs-v12 img,
body.light .progress-tabs-v12 button.active img,
body.light .progress-back-v12 img,
body.light .progress-done-v12 img,
body.light .progress-locker-tabs-v12 img,
body.light .title-profile-open img,
body.light .title-profile-edit img,
body.light .hud-icon-img,
body.light .icon-btn img,
body.light .profile-account-head img,
body.light .play-mode-card img{filter:none!important;opacity:1!important;}

/* 7) Extra profile light-mode contrast polish. */
body.light .profile-modal,
body.light .profile-stat,
body.light .profile-activity{background:rgba(255,255,255,.70)!important;border-color:rgba(97,74,39,.18)!important;}
body.light .profile-recent-match,
body.light .profile-social-card,
body.light .profile-recent-player{background:rgba(255,255,255,.78)!important;border-color:rgba(97,74,39,.12)!important;}
body.light .profile-recent-match b,
body.light .profile-recent-player>span:last-child,
body.light .profile-social-name{color:#2f251b!important;}
body.light .profile-recent-match small,
body.light .profile-social-meta,
body.light .profile-activity-empty{color:rgba(47,37,27,.72)!important;}

/* ===================== v36 targeted polish ===================== */
/* Tighter player cards with clearer score / hand indicators. */
.player-rail{
  justify-content:center!important;
  gap:8px!important;
}
.pchip{
  position:relative!important;
  display:grid!important;
  grid-template-columns:34px minmax(0,1fr)!important;
  align-items:center!important;
  gap:7px!important;
  flex:0 1 238px!important;
  max-width:238px!important;
  min-height:56px!important;
  padding:6px 10px 6px 6px!important;
  overflow:visible!important;
}
.pchip.has-clock{padding-right:44px!important;}
.pchip-av{width:34px!important;height:34px!important;border-radius:8px!important;}
.pchip-body{gap:5px!important;}
.pchip-name{font-size:15px!important;line-height:1!important;max-width:100%!important;}
.pchip-meta{display:flex!important;align-items:center!important;gap:8px!important;flex-wrap:nowrap!important;min-width:0!important;}
.pchip-score,.pchip-count{
  display:inline-flex!important;align-items:center!important;gap:5px!important;
  min-height:18px!important;padding:0!important;background:none!important;border:none!important;box-shadow:none!important;
}
.pchip-score strong,.pchip-count strong{font-size:15px!important;line-height:1!important;font-weight:800!important;letter-spacing:0!important;}
.pchip-score strong{color:#f3c63f!important;}
.pchip-count strong{color:#d8efe5!important;}
.pchip-point-glyph,.pchip-card-glyph{
  width:16px!important;height:16px!important;flex:0 0 16px!important;background-size:100% 100%!important;background-repeat:no-repeat!important;image-rendering:pixelated!important;
}
.pchip-missed{
  position:absolute!important;right:6px!important;top:-4px!important;margin:0!important;
  display:inline-flex!important;align-items:center!important;gap:4px!important;
  background:rgba(0,0,0,.28)!important;border:1px solid rgba(255,255,255,.10)!important;border-radius:999px!important;padding:2px 6px!important;
}
.pchip-missed i,.pchip-timer-strikes i{
  width:6px!important;height:6px!important;flex:0 0 6px!important;border-radius:50%!important;
  background:rgba(247,237,214,.24)!important;border:1px solid rgba(247,237,214,.18)!important;
}
.pchip-missed i.spent,.pchip-timer-strikes i.spent{background:#f0a760!important;border-color:#ffd08b!important;box-shadow:0 0 0 1px rgba(95,48,18,.18)!important;}
.pchip-timer{
  position:absolute!important;right:8px!important;top:3px!important;transform:none!important;
  width:30px!important;min-width:30px!important;height:30px!important;border-radius:50%!important;overflow:visible!important;
}
.pchip-timer-bar::after{inset:3px!important;}
.pchip-timer-seconds{font-size:13px!important;top:-3px!important;}
.pchip-timer-strikes{inset:auto 0 -7px!important;height:7px!important;gap:3px!important;}
@media (max-width: 750px){
  .player-rail{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;}
  .pchip{width:100%!important;max-width:none!important;min-height:52px!important;grid-template-columns:30px minmax(0,1fr)!important;gap:6px!important;padding:6px 8px 6px 5px!important;}
  .pchip.has-clock{padding-right:40px!important;}
  .pchip-av{width:30px!important;height:30px!important;}
  .pchip-name{font-size:12px!important;}
  .pchip-score strong,.pchip-count strong{font-size:13px!important;}
  .pchip-point-glyph,.pchip-card-glyph{width:14px!important;height:14px!important;flex-basis:14px!important;}
  .pchip-timer{width:28px!important;min-width:28px!important;height:28px!important;top:4px!important;right:6px!important;}
  .pchip-timer-seconds{font-size:11px!important;}
  .pchip-timer-strikes{bottom:-7px!important;}
  .pchip-missed{top:-5px!important;right:5px!important;padding:2px 5px!important;}
  .pchip-missed i,.pchip-timer-strikes i{width:5px!important;height:5px!important;flex-basis:5px!important;}
}
body.light .pchip-score strong{color:#8b6406!important;}
body.light .pchip-count strong{color:#2a5d55!important;}
body.light .pchip-missed{background:rgba(123,98,60,.09)!important;border-color:rgba(123,98,60,.16)!important;}
body.light .pchip-missed i,.light .pchip-timer-strikes i{background:rgba(90,74,49,.14)!important;border-color:rgba(90,74,49,.08)!important;}
body.light .pchip-missed i.spent,.light .pchip-timer-strikes i.spent{background:#dd9a44!important;border-color:#efc57b!important;}

/* Keep the account state honest for signed-in users. */
body.signed-in #profileAccountStatus::before{content:''!important;}
body.signed-in #profileAccountStatus{color:var(--gold-ink)!important;}
body.light #profileAccountStatus{color:#9a7308!important;}

/* Ensure Founder path / locker selected icons stay crisp in light mode. */
body.light .progress-tabs-v12 button img,
body.light .progress-locker-tabs-v12 button img,
body.light .progress-back-v12 img,
body.light .progress-done-v12 img{filter:none!important;opacity:1!important;mix-blend-mode:normal!important;}


/* v39 final overrides: simple readable glyphs and timer alignment */
.pchip-point-glyph,.pchip-card-glyph{width:18px!important;height:18px!important;flex:0 0 18px!important;background-size:100% 100%!important;image-rendering:pixelated!important;}
.pchip-score strong,.pchip-count strong{font-size:16px!important;}
.pchip-missed{display:inline-flex!important;align-items:center!important;gap:5px!important;padding:2px 6px!important;border-radius:999px!important;background:rgba(0,0,0,.32)!important;border:1px solid rgba(255,255,255,.12)!important;}
.pchip-missed i,.pchip-timer-strikes i{width:8px!important;height:8px!important;flex:0 0 8px!important;border-radius:50%!important;}
.pchip-timer{width:38px!important;min-width:38px!important;height:38px!important;right:8px!important;top:50%!important;transform:translateY(-50%)!important;}
.pchip-timer-seconds{position:absolute!important;left:50%!important;top:50%!important;transform:translate(-50%,-55%)!important;font-size:14px!important;line-height:1!important;}
.pchip-timer-strikes{inset:auto auto -8px 50%!important;transform:translateX(-50%)!important;height:auto!important;gap:5px!important;padding:2px 5px!important;background:rgba(24,21,17,.88)!important;border-radius:999px!important;}
@media (max-width: 750px){
  .pchip-score strong,.pchip-count strong{font-size:14px!important;}
  .pchip-point-glyph,.pchip-card-glyph{width:16px!important;height:16px!important;flex-basis:16px!important;}
  .pchip-timer{width:34px!important;min-width:34px!important;height:34px!important;}
  .pchip-timer-seconds{font-size:12px!important;}
  .pchip-missed i,.pchip-timer-strikes i{width:7px!important;height:7px!important;flex-basis:7px!important;}
}

/* v40.1: Greek profile labels are substantially longer than English.
   Keep the name action legible and allow the account information to use
   its own width instead of colliding with the account title. */
html[data-lang="el"] #modal-profile .profile-username-claim {
  font-size: 17px !important;
  line-height: 1.1 !important;
  letter-spacing: -0.015em !important;
  white-space: nowrap !important;
  min-width: 0 !important;
}
html[data-lang="el"] #modal-profile #profileAccount {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 9px !important;
  align-items: start !important;
}
html[data-lang="el"] #modal-profile .profile-account-head {
  width: 100% !important;
  min-width: 0 !important;
}
html[data-lang="el"] #modal-profile .profile-account-head > div,
html[data-lang="el"] #modal-profile .account-connected-row > div {
  min-width: 0 !important;
}
html[data-lang="el"] #modal-profile .profile-account-head strong {
  font-size: 19px !important;
  line-height: 1.15 !important;
  overflow-wrap: break-word;
}
html[data-lang="el"] #modal-profile #accountSignedState {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  gap: 8px 12px !important;
  align-items: center !important;
  width: 100% !important;
  min-width: 0 !important;
}
html[data-lang="el"] #modal-profile #accountSignedState .account-connected-row {
  grid-column: 1;
  grid-row: 1;
  min-width: 0 !important;
}
html[data-lang="el"] #modal-profile #accountSignedState .account-connected-row strong {
  line-height: 1.3 !important;
  overflow-wrap: break-word;
}
html[data-lang="el"] #modal-profile #btnSignOut {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  font-size: 14px !important;
  line-height: 1.2 !important;
  padding: 8px 12px !important;
  white-space: nowrap !important;
}
html[data-lang="el"] #modal-profile #accountSignedState p {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0 !important;
  overflow-wrap: break-word;
}
html[data-lang="el"] #modal-profile .profile-stat span,
html[data-lang="el"] #modal-profile .profile-activity-label,
html[data-lang="el"] #modal-profile .profile-activity-empty,
html[data-lang="el"] #modal-profile .profile-progress-link {
  overflow-wrap: break-word;
  hyphens: auto;
}
@media (max-width: 690px) {
  html[data-lang="el"] #modal-profile .profile-username-claim {
    font-size: 14px !important;
    letter-spacing: -0.025em !important;
    padding-inline: 5px !important;
  }
  html[data-lang="el"] #modal-profile #accountSignedState {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }
  html[data-lang="el"] #modal-profile #accountSignedState .account-connected-row {
    grid-column: 1;
    grid-row: 1;
  }
  html[data-lang="el"] #modal-profile #accountSignedState p {
    grid-column: 1;
    grid-row: 2;
  }
  html[data-lang="el"] #modal-profile #btnSignOut {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
  }
}

/* v41: allow the newly generated account icon and settings headers to read
   clearly at actual 1x zoom. Artwork lives exclusively in PNG assets. */
#modal-profile .profile-account-head img {
  width: 41px !important;
  height: 41px !important;
  flex: 0 0 41px !important;
  object-fit: contain;
  image-rendering: pixelated;
}
.settings-tabs-v12 button img {
  width: 37px !important;
  height: 37px !important;
  object-fit: contain;
  image-rendering: pixelated;
}
#playerRail .pchip-point-glyph,
#playerRail .pchip-card-glyph {
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  image-rendering: pixelated !important;
}
