.score-container::after {
  content: "Score";
  display: block;
  font-size: 0.85rem;
  color: #eee4da;
  letter-spacing: 0.5px;
  margin-top: 2px;
  font-weight: 500;
}
.best-container::after {
  content: "Best";
  display: block;
  font-size: 0.85rem;
  color: #eee4da;
  letter-spacing: 0.5px;
  margin-top: 2px;
  font-weight: 500;
}
@import url(fonts/clear-sans.css);
html, body {
  color: #776e65;
  font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
}
/* --- 2048 Top Panel (titre, boutons, scores) --- */
.game-top-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 32px;
  margin-bottom: 24px;
}
.game-mode-title {
  font-size: 2.2rem;
  font-weight: bold;
  color: #7c6a58;
  margin-bottom: 18px;
  letter-spacing: 1px;
  text-align: center;
}
.game-controls-row {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
}

/* Boutons sous la grille */
.game-controls-below {
  justify-content: center;
  margin-top: 28px;
  margin-bottom: 0;
}
@media (max-width: 600px) {
  .game-controls-below {
    margin-top: 14px;
    gap: 8px;
  }
  .main-header {
    padding: 0 4px;
    height: 44px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .header-content {
    gap: 4px;
  }
  .header-logo {
    width: 24px;
    height: 24px;
    margin-right: 4px;
  }
  .header-title {
    font-size: 0.85rem;
    max-width: 48vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-actions {
    gap: 6px;
  }
  .auth-bubble, .user-bubble {
    font-size: 0.9rem;
    min-width: 32px;
    padding: 0 2px;
    max-width: 38vw;
  }
  .header-actions a[title="Notifications"] {
    font-size: 1rem;
    margin-left: 1px;
    margin-right: 1px;
  }
  .auth-text {
    display: none !important;
  }
  .auth-icon {
    font-size: 1.3rem;
    margin-right: 0 !important;
  }
  .auth-bubble {
    min-width: 0 !important;
    padding: 0 6px !important;
    justify-content: center;
  }
  .auth-arrow {
    margin-left: 0 !important;
    font-size: 1rem;
  }
  .auth-dropdown {
    min-width: 180px;
    padding: 12px 8px 10px 8px;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    min-width: 90vw !important;
    max-width: 400px !important;
    background: rgba(255,255,255,0.95) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border-radius: 18px !important;
    z-index: 9999 !important;
    padding: 24px 18px 18px 18px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: relative;
    transition: opacity 0.25s, visibility 0.25s;
  }
  .auth-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  body.auth-modal-open::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9998;
    background: rgba(30,30,30,0.25);
    backdrop-filter: blur(6px);
    pointer-events: auto;
  }
}
.restart-button, .open-gallery-button {
  background: #a3917b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.restart-button:hover, .open-gallery-button:hover {
  background: #8f7a66;
}
.scores-container {
  display: flex;
  gap: 18px;
  margin-bottom: 0;
  justify-content: center;
}
.score-container, .best-container {
  background: #bbada0;
  color: #fff;
  font-size: 1.3rem;
  font-weight: bold;
  border-radius: 8px;
  padding: 10px 28px;
  min-width: 80px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
@media (max-width: 600px) {
  .game-top-panel { margin-top: 12px; margin-bottom: 10px; }
  .game-mode-title { font-size: 1.2rem; margin-bottom: 10px; }
  .game-controls-row { gap: 8px; margin-bottom: 10px; }
  .scores-container { gap: 8px; }
  .score-container, .best-container { font-size: 1rem; padding: 7px 12px; min-width: 48px; }
}


p {
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.65; }

a {
  color: #776e65;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer; }

strong.important {
  text-transform: uppercase; }

hr {
  border: none;
  border-bottom: 1px solid #d8d4d0;
  margin-top: 20px;
  margin-bottom: 30px; }

.container {
  width: 500px;
  margin: 0 auto; }

@-webkit-keyframes fade-in {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }
@-moz-keyframes fade-in {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }
@keyframes fade-in {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }
.game-container {
  margin-top: 40px;
  position: relative;
  padding: 15px;
  cursor: default;
  -webkit-touch-callout: none;
  -ms-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -ms-touch-action: none;
  touch-action: none;
  background: #8f7a66;
  border-radius: 6px;
  width: 500px;
  height: 500px;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box; }
  .game-container .game-message {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(238, 228, 218, 0.5);
    z-index: 100;
    text-align: center;
    -webkit-animation: fade-in 800ms ease 1200ms;
    -moz-animation: fade-in 800ms ease 1200ms;
    animation: fade-in 800ms ease 1200ms;
    -webkit-animation-fill-mode: both;
    -moz-animation-fill-mode: both;
    animation-fill-mode: both; }
    .game-container .game-message p {
      font-size: 60px;
      font-weight: bold;
      height: 60px;
      line-height: 60px;
      margin-top: 222px; }
    .game-container .game-message .lower {
      display: block;
      margin-top: 59px; }
    .game-container .game-message a {
      display: inline-block;
      background: #8f7a66;
      border-radius: 3px;
      padding: 0 20px;
      text-decoration: none;
      color: #f9f6f2;
      height: 40px;
      line-height: 42px;
      margin-left: 9px; }
      .game-container .game-message a.keep-playing-button {
        display: none; }
        .game-container .game-message.game-won {
          background: url(OIP.webp) no-repeat center center fixed;
          background-size: 35%;
          background-position: center -5px;
          color: #f9f6f2;
        }
      .game-container .game-message.game-won a.keep-playing-button {
        display: inline-block; }
    .game-container .game-message.game-won, .game-container .game-message.game-over {
      background: url(crop_tuto.gif) center center fixed;
          background-size: 20%;
      display: block; }

.grid-container {
  position: absolute;
  z-index: 1; }

.grid-row {
  margin-bottom: 15px; }
  .grid-row:last-child {
    margin-bottom: 0; }
  .grid-row:after {
    content: "";
    display: block;
    clear: both; }

.grid-cell {
  width: 106.25px;
  height: 106.25px;
  margin-right: 15px;
  float: left;
  border-radius: 3px;
  background: #bbada0; }
  .grid-cell:last-child {
    margin-right: 0; }

.tile-container {
  position: absolute;
  z-index: 2; }

.tile, .tile .tile-inner {
  width: 107px;
  height: 107px;
  line-height: 107px; }
.tile.tile-position-1-1 {
  -webkit-transform: translate(0px, 0px);
  -moz-transform: translate(0px, 0px);
  transform: translate(0px, 0px); }
.tile.tile-position-1-2 {
  -webkit-transform: translate(0px, 121px);
  -moz-transform: translate(0px, 121px);
  transform: translate(0px, 121px); }
.tile.tile-position-1-3 {
  -webkit-transform: translate(0px, 242px);
  -moz-transform: translate(0px, 242px);
  transform: translate(0px, 242px); }
.tile.tile-position-1-4 {
  -webkit-transform: translate(0px, 363px);
  -moz-transform: translate(0px, 363px);
  transform: translate(0px, 363px); }
.tile.tile-position-2-1 {
  -webkit-transform: translate(121px, 0px);
  -moz-transform: translate(121px, 0px);
  transform: translate(121px, 0px); }
.tile.tile-position-2-2 {
  -webkit-transform: translate(121px, 121px);
  -moz-transform: translate(121px, 121px);
  transform: translate(121px, 121px); }
.tile.tile-position-2-3 {
  -webkit-transform: translate(121px, 242px);
  -moz-transform: translate(121px, 242px);
  transform: translate(121px, 242px); }
.tile.tile-position-2-4 {
  -webkit-transform: translate(121px, 363px);
  -moz-transform: translate(121px, 363px);
  transform: translate(121px, 363px); }
.tile.tile-position-3-1 {
  -webkit-transform: translate(242px, 0px);
  -moz-transform: translate(242px, 0px);
  transform: translate(242px, 0px); }
.tile.tile-position-3-2 {
  -webkit-transform: translate(242px, 121px);
  -moz-transform: translate(242px, 121px);
  transform: translate(242px, 121px); }
.tile.tile-position-3-3 {
  -webkit-transform: translate(242px, 242px);
  -moz-transform: translate(242px, 242px);
  transform: translate(242px, 242px); }
.tile.tile-position-3-4 {
  -webkit-transform: translate(242px, 363px);
  -moz-transform: translate(242px, 363px);
  transform: translate(242px, 363px); }
.tile.tile-position-4-1 {
  -webkit-transform: translate(363px, 0px);
  -moz-transform: translate(363px, 0px);
  transform: translate(363px, 0px); }
.tile.tile-position-4-2 {
  -webkit-transform: translate(363px, 121px);
  -moz-transform: translate(363px, 121px);
  transform: translate(363px, 121px); }
.tile.tile-position-4-3 {
  -webkit-transform: translate(363px, 242px);
  -moz-transform: translate(363px, 242px);
  transform: translate(363px, 242px); }
.tile.tile-position-4-4 {
  -webkit-transform: translate(363px, 363px);
  -moz-transform: translate(363px, 363px);
  transform: translate(363px, 363px); }

.tile {
  position: absolute;
  -webkit-transition: 100ms ease-in-out;
  -moz-transition: 100ms ease-in-out;
  transition: 100ms ease-in-out;
  -webkit-transition-property: -webkit-transform;
  -moz-transition-property: -moz-transform;
  transition-property: transform; }
.tile .tile-inner {
  border-radius: 3px;
  text-align: right;
  font-weight: bold;
  z-index: 10;
  font-size: 20px;
  text-shadow: 2px 2px 4px #000000;
  color: #f9f6f2;
  padding-top: 0px;
  padding-right: 5px;
  line-height: normal;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}
  .tile.tile-2 .tile-inner {
    background-image: url(OIP.webp);
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0); }
  .tile.tile-4 .tile-inner {
    background : url(OIP.webp) no-repeat center center fixed;
    background-size: cover;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0); }
  .tile.tile-8 .tile-inner {
    background: url(OIP.webp) no-repeat center center fixed;
  background-size: cover; }
  .tile.tile-16 .tile-inner {
    background: url(OIP.webp) no-repeat center center fixed;
  background-size: cover; }
  .tile.tile-32 .tile-inner {
    background: url(OIP.webp) no-repeat center center fixed;
    background-size: cover; }
  .tile.tile-64 .tile-inner {
    background: url(OIP.webp) no-repeat center center fixed;
    background-size: cover; }
    .tile.tile-128 .tile-inner {
      background: url(OIP.webp) no-repeat center center fixed;
      background-size: cover;
      box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.2381), inset 0 0 0 1px rgba(255, 255, 255, 0.14286);
      font-size: 30px;
      display: flex;
      justify-content: flex-start;
      align-items: flex-end;
      padding-left: 0px;
      padding-bottom: -5px;
  }
    @media screen and (max-width: 520px) {
      .tile.tile-128 .tile-inner {
        font-size: 25px; } }
        .tile.tile-256 .tile-inner {
          background: url(OIP.webp) no-repeat center center fixed;
          background-size: cover;
          box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.31746), inset 0 0 0 1px rgba(255, 255, 255, 0.19048);
          font-size: 25px;
          display: flex;
          justify-content: flex-start;
          align-items: end;
      }
    @media screen and (max-width: 520px) {
      .tile.tile-256 .tile-inner {
        font-size: 25px; } }
  .tile.tile-512 .tile-inner {
    background: url(OIP.webp) no-repeat center center fixed;
    background-size: cover;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.39683), inset 0 0 0 1px rgba(255, 255, 255, 0.2381);
    font-size: 45px; }
    @media screen and (max-width: 520px) {
      .tile.tile-512 .tile-inner {
        font-size: 25px; } }
  .tile.tile-1024 .tile-inner {
    background: url(OIP.webp) no-repeat center center fixed;
    background-size: cover;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.47619), inset 0 0 0 1px rgba(255, 255, 255, 0.28571);
    font-size: 35px; }
    @media screen and (max-width: 520px) {
      .tile.tile-1024 .tile-inner {
        font-size: 15px; } }
  .tile.tile-2048 .tile-inner {
    background: url(OIP.webp) no-repeat center center fixed;
    background-size: 100%;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.55556), inset 0 0 0 1px rgba(255, 255, 255, 0.33333);
    font-size: 35px; }
    @media screen and (max-width: 520px) {
      .tile.tile-2048 .tile-inner {
        font-size: 15px; } }

@-webkit-keyframes appear {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@-moz-keyframes appear {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@keyframes appear {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
.tile-new .tile-inner {
  -webkit-animation: appear 200ms ease 100ms;
  -moz-animation: appear 200ms ease 100ms;
  animation: appear 200ms ease 100ms;
  -webkit-animation-fill-mode: backwards;
  -moz-animation-fill-mode: backwards;
  animation-fill-mode: backwards; }

@-webkit-keyframes pop {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  50% {
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    transform: scale(1.2); }

  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@-moz-keyframes pop {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  50% {
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    transform: scale(1.2); }

  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@keyframes pop {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  50% {
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    transform: scale(1.2); }

  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
.tile-merged .tile-inner {
  z-index: 20;
  -webkit-animation: pop 200ms ease 100ms;
  -moz-animation: pop 200ms ease 100ms;
  animation: pop 200ms ease 100ms;
  -webkit-animation-fill-mode: backwards;
  -moz-animation-fill-mode: backwards;
  animation-fill-mode: backwards; }

.above-game:after {
  content: "";
  display: block;
  clear: both; }

.game-intro {
  float: left;
  line-height: 42px;
  margin-bottom: 0; }

.restart-button {
  display: inline-block;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0 20px;
  text-decoration: none;
  color: #f9f6f2;
  height: 40px;
  line-height: 42px;
  display: block;
  text-align: center;
  float: right;
  margin-right: 5px; }

.undo-button {
  margin-right: 5px; }

.disabled {
  background: #bbada0; }

.game-explanation {
  margin-top: 50px; }

@media screen and (max-width: 520px) {
  html, body {
    font-size: 15px; }

  body {
    margin: 20px 0;
    padding: 0 20px; }

  h1.title {
    font-size: 27px;
    margin-top: 15px; }

  .container {
    width: 280px;
    margin: 0 auto; }

  .score-container, .best-container {
    margin-top: 0;
    padding: 15px 10px;
    min-width: 40px; }

  .heading {
    margin-bottom: 10px; }

  .game-intro {
    width: 55%;
    display: block;
    box-sizing: border-box;
    line-height: 1.65; }

  .restart-button {
    width: 42%;
    padding: 0;
    display: block;
    box-sizing: border-box;
    margin-top: 2px; }

  .game-container {
    margin-top: 17px;
    position: relative;
    padding: 10px;
    cursor: default;
    -webkit-touch-callout: none;
    -ms-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -ms-touch-action: none;
    touch-action: none;
    background: #8f7a66;
    border-radius: 6px;
    width: 280px;
    height: 280px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box; }
    .game-container .game-message {
      display: none;
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background: rgba(238, 228, 218, 0.5);
      z-index: 100;
      text-align: center;
      -webkit-animation: fade-in 800ms ease 1200ms;
      -moz-animation: fade-in 800ms ease 1200ms;
      animation: fade-in 800ms ease 1200ms;
      -webkit-animation-fill-mode: both;
      -moz-animation-fill-mode: both;
      animation-fill-mode: both; }
      .game-container .game-message p {
        font-size: 60px;
        font-weight: bold;
        height: 60px;
        line-height: 60px;
        margin-top: 222px; }
      .game-container .game-message .lower {
        display: block;
        margin-top: 59px; }
      .game-container .game-message a {
        display: inline-block;
        background: #8f7a66;
        border-radius: 3px;
        padding: 0 20px;
        text-decoration: none;
        color: #f9f6f2;
        height: 40px;
        line-height: 42px;
        margin-left: 9px; }
        .game-container .game-message a.keep-playing-button {
          display: none; }
      .game-container .game-message.game-won {
        background: rgba(237, 194, 46, 0.5);
        color: #f9f6f2; }
        .game-container .game-message.game-won a.keep-playing-button {
          display: inline-block; }
      .game-container .game-message.game-won, .game-container .game-message.game-over {
        display: block; }

  .grid-container {
    position: absolute;
    z-index: 1; }

  .grid-row {
    margin-bottom: 10px; }
    .grid-row:last-child {
      margin-bottom: 0; }
    .grid-row:after {
      content: "";
      display: block;
      clear: both; }

  .grid-cell {
    width: 57.5px;
    height: 57.5px;
    margin-right: 10px;
    float: left;
    border-radius: 3px;
    background: #bbada0; }
    .grid-cell:last-child {
      margin-right: 0; }

  .tile-container {
    position: absolute;
    z-index: 2; }

  .tile, .tile .tile-inner {
    width: 58px;
    height: 58px;
    line-height: 58px; }
  .tile.tile-position-1-1 {
    -webkit-transform: translate(0px, 0px);
    -moz-transform: translate(0px, 0px);
    transform: translate(0px, 0px); }
  .tile.tile-position-1-2 {
    -webkit-transform: translate(0px, 67px);
    -moz-transform: translate(0px, 67px);
    transform: translate(0px, 67px); }
  .tile.tile-position-1-3 {
    -webkit-transform: translate(0px, 135px);
    -moz-transform: translate(0px, 135px);
    transform: translate(0px, 135px); }
  .tile.tile-position-1-4 {
    -webkit-transform: translate(0px, 202px);
    -moz-transform: translate(0px, 202px);
    transform: translate(0px, 202px); }
  .tile.tile-position-2-1 {
    -webkit-transform: translate(67px, 0px);
    -moz-transform: translate(67px, 0px);
    transform: translate(67px, 0px); }
  .tile.tile-position-2-2 {
    -webkit-transform: translate(67px, 67px);
    -moz-transform: translate(67px, 67px);
    transform: translate(67px, 67px); }
  .tile.tile-position-2-3 {
    -webkit-transform: translate(67px, 135px);
    -moz-transform: translate(67px, 135px);
    transform: translate(67px, 135px); }
  .tile.tile-position-2-4 {
    -webkit-transform: translate(67px, 202px);
    -moz-transform: translate(67px, 202px);
    transform: translate(67px, 202px); }
  .tile.tile-position-3-1 {
    -webkit-transform: translate(135px, 0px);
    -moz-transform: translate(135px, 0px);
    transform: translate(135px, 0px); }
  .tile.tile-position-3-2 {
    -webkit-transform: translate(135px, 67px);
    -moz-transform: translate(135px, 67px);
    transform: translate(135px, 67px); }
  .tile.tile-position-3-3 {
    -webkit-transform: translate(135px, 135px);
    -moz-transform: translate(135px, 135px);
    transform: translate(135px, 135px); }
  .tile.tile-position-3-4 {
    -webkit-transform: translate(135px, 202px);
    -moz-transform: translate(135px, 202px);
    transform: translate(135px, 202px); }
  .tile.tile-position-4-1 {
    -webkit-transform: translate(202px, 0px);
    -moz-transform: translate(202px, 0px);
    transform: translate(202px, 0px); }
  .tile.tile-position-4-2 {
    -webkit-transform: translate(202px, 67px);
    -moz-transform: translate(202px, 67px);
    transform: translate(202px, 67px); }
  .tile.tile-position-4-3 {
    -webkit-transform: translate(202px, 135px);
    -moz-transform: translate(202px, 135px);
    transform: translate(202px, 135px); }
  .tile.tile-position-4-4 {
    -webkit-transform: translate(202px, 202px);
    -moz-transform: translate(202px, 202px);
    transform: translate(202px, 202px); }

  .tile .tile-inner {
    font-size: 35px; }

  .game-message p {
    font-size: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    margin-top: 90px !important; }
  .game-message .lower {
    margin-top: 30px !important; } }

/* Gallerie */
.open-gallery-button {
  display: inline-block;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0 20px;
  text-decoration: none;
  color: #f9f6f2;
  height: 40px;
  line-height: 42px;
  display: block;
  text-align: center;
  float: right;
  margin-right: 5px; }

  .open-gallery-button  {
    width: 42%;
    padding: 0;
    display: block;
    box-sizing: border-box;
    margin-top: 2px; }

    .gallery-modal {
      display: none;
      position: fixed; 
      z-index: 200;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.8);
    }
    
    .gallery-content {
      position: relative;
      margin: auto;
      top: 40%;
      transform: translateY(-50%);
      text-align: center;
      max-width: 100%;
      background: rgba(19, 113, 175, 0.9);
      padding: 20px;
      border-radius: 10px;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    }
    
    .gallery-content img {
      max-width: 100%;
      height: auto;
      border: 5px solid #8f7a66;
      border-radius: 8px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }

    .gallery-content img.shrink {
      max-width: 60%;
      height: auto;
    }
    
    .close-gallery {
      position: absolute;
      top: 10px;
      right: 20px;
      font-size: 30px;
      color: white;
      cursor: pointer;
    }
    
    .image-counter {
      margin-top: 10px;
      font-size: 18px;
      color: #f9f6f2;
      text-align: center;
    }

    .gallery-navigation button {
      margin: 10px;
      padding: 10px 20px;
      font-size: 16px;
      cursor: pointer;
      background: #8f7a66;
      color: #f9f6f2;
      border: none;
      border-radius: 5px;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
      transition: background 0.3s ease;
    }

    .gallery-navigation button:hover {
      background: #a67c5b;
    }

    /* Styles pour l'authentification Firebase - Interface moderne */
    .auth-bubble {
      position: relative;
      display: flex;
      align-items: center;
      background: #232527;
      border-radius: 18px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.08);
      padding: 0 18px;
      height: 40px;
      margin: 0;
      min-width: 180px;
      z-index: 1200;
    }

    .auth-toggle {
      display: flex;
      align-items: center;
      cursor: pointer;
      gap: 8px;
      color: #fff;
      font-size: 1rem;
      font-weight: 500;
      user-select: none;
      padding: 0 4px;
      height: 40px;
      background: none;
      border-radius: 0;
      box-shadow: none;
      max-width: none;
      margin: 0;
      transition: none;
      justify-content: flex-end;
    }

    .auth-toggle:hover {
      text-decoration: underline;
    }

    .auth-icon {
      font-size: 1.2rem;
      margin-right: 2px;
    }

    .auth-text {
      font-size: 1rem;
      font-weight: 500;
      color: #fff;
      margin-right: 4px;
    }

    .auth-arrow {
      font-size: 0.9rem;
      margin-left: 2px;
      color: #fff;
      transition: transform 0.2s;
    }

    .auth-toggle.active .auth-arrow {
      transform: rotate(180deg);
    }

    .auth-dropdown {
      position: absolute;
      top: 110%;
      right: 0;
      left: auto;
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.18);
      padding: 18px 20px 16px 20px;
      min-width: 260px;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-10px);
      transition: all 0.25s cubic-bezier(.4,0,.2,1);
      z-index: 1300;
      margin-top: 0;
    }

    .auth-dropdown.show {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
      pointer-events: auto;
    }

    .auth-dropdown::before {
      content: '';
      position: absolute;
      top: -8px;
      right: 24px;
      left: auto;
      transform: none;
      width: 0;
      height: 0;
      border-left: 8px solid transparent;
@media (max-width: 600px) {
  .auth-bubble {
    min-width: 120px;
    padding: 0 8px;
    font-size: 0.95rem;
  }
  .auth-dropdown {
    min-width: 180px;
    padding: 12px 8px 10px 8px;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    min-width: 90vw !important;
    max-width: 400px !important;
    background: rgba(255,255,255,0.95) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border-radius: 18px !important;
    z-index: 9999 !important;
    padding: 24px 18px 18px 18px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: relative;
    transition: opacity 0.25s, visibility 0.25s;
  }
  .auth-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .auth-text { display: none; }

  /* Croix de fermeture pour le menu d'inscription sur mobile/tablette */
  .auth-dropdown .auth-close {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 2rem;
    color: #888;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10001;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
  }
  .auth-dropdown .auth-close:hover {
    color: #d44;
  }
}
      border-right: 8px solid transparent;
      border-bottom: 8px solid white;
    }

    .auth-container {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .auth-container input {
      padding: 12px 16px;
      border: 2px solid #e6e6e6;
      border-radius: 8px;
      font-size: 14px;
      transition: border-color 0.3s ease;
      outline: none;
    }

    .auth-container input:focus {
      border-color: #8f7a66;
    }

    .auth-buttons {
      display: flex;
      gap: 10px;
    }

    .auth-container button {
      flex: 1;
      background: linear-gradient(135deg, #8f7a66, #a67c5b);
      color: white;
      border: none;
      border-radius: 8px;
      padding: 12px 16px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 500;
      transition: all 0.3s ease;
    }

    .auth-container button:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(143, 122, 102, 0.3);
    }

    .user-bubble {
      position: relative;
      display: flex;
      align-items: center;
      background: #232527;
      border-radius: 18px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.08);
      padding: 0 18px;
      height: 40px;
      margin: 0;
      min-width: 180px;
      z-index: 1200;
      color: #fff;
      max-width: none;
      text-align: left;
    }

    .user-info {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
    }

    .user-icon {
      font-size: 18px;
    }

    .user-actions {
      display: flex;
      gap: 10px;
      justify-content: center;
    }

    .user-section button {
      background: rgba(255, 255, 255, 0.2);
      color: white;
      border: 1px solid rgba(255, 255, 255, 0.3);
      border-radius: 20px;
      padding: 8px 16px;
      cursor: pointer;
      font-size: 13px;
      transition: all 0.3s ease;
    }

    .user-section button:hover {
      background: rgba(255, 255, 255, 0.3);
      transform: translateY(-1px);
    }

    .game-controls {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-top: 20px;
      flex-wrap: wrap;
    }

    #auth-message {
      font-size: 12px;
      color: #f65e3b;
      text-align: center;
      margin-top: 8px;
    }

    /* Responsive pour mobile */
    @media (max-width: 520px) {
      .auth-dropdown {
        min-width: 280px;
        padding: 15px;
      }
      
      .auth-toggle {
        max-width: 250px;
        padding: 10px 16px;
      }
      
      .user-bubble {
        max-width: 280px;
        padding: 12px 16px;
      }
      
      .game-controls {
        margin-top: 15px;
      }
      
      .user-actions {
        flex-direction: column;
        gap: 8px;
      }
    }

  /* Modal pour le classement - Style moderne */
  .modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
  }

  .modal-content {
    background: linear-gradient(135deg, #faf8ef, #f0ebe2);
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
  }

  .modal-content h2 {
    text-align: center;
    color: #776e65;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: bold;
  }

  .close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #999;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
  }

  .close:hover {
    color: #555;
    background: rgba(255,255,255,0.8);
    transform: scale(1.1);
  }

  .leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 8px 0;
    background: rgba(255,255,255,0.6);
    border-radius: 12px;
    border-left: 4px solid #8f7a66;
    transition: all 0.3s ease;
  }

  .leaderboard-entry:hover {
    transform: translateX(5px);
    background: rgba(255,255,255,0.8);
    box-shadow: 0 4px 12px rgba(143, 122, 102, 0.2);
  }

  .leaderboard-entry:nth-child(1) { border-left-color: #ffd700; }
  .leaderboard-entry:nth-child(2) { border-left-color: #c0c0c0; }
  .leaderboard-entry:nth-child(3) { border-left-color: #cd7f32; }

  .leaderboard-rank {
    font-weight: bold;
    color: #8f7a66;
    font-size: 16px;
    min-width: 30px;
  }

  .leaderboard-email {
    flex: 1;
    margin: 0 15px;
    color: #776e65;
    font-size: 14px;
  }

  .leaderboard-score {
    font-weight: bold;
    color: #8f7a66;
    font-size: 16px;
  }

  /* Responsive modal */
  @media (max-width: 520px) {
    .modal-content {
      margin: 10% auto;
      padding: 20px;
      width: 95%;
    }
    
    .leaderboard-entry {
      padding: 12px 15px;
      flex-direction: column;
      text-align: center;
      gap: 5px;
    }
    
    .leaderboard-email {
      margin: 0;
    }
  }

/* Modal de base */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin: 0;
  color: #8f7a66;
  font-size: 24px;
}

.modal-body {
  padding: 25px;
}

.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.3s ease;
}

.close:hover,
.close:focus {
  color: #8f7a66;
  text-decoration: none;
}

/* Styles pour les avatars */
.avatar-section {
  margin: 15px 0;
  padding: 15px;
  background: #f8f8f8;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
}

.avatar-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #8f7a66;
  margin-bottom: 10px;
}

.avatar-upload-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.avatar-preview {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #e0e0e0;
  position: relative;
  background: white;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: #8f7a66;
  font-size: 24px;
}

.avatar-upload-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.avatar-btn {
  background: #8f7a66;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.avatar-btn:hover {
  background: #a67c5b;
  transform: translateY(-1px);
}

.avatar-btn.secondary {
  background: #dc3545;
}

.avatar-btn.secondary:hover {
  background: #c82333;
}

/* Styles pour le profil utilisateur dans le header */
.user-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.user-avatar-container {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.user-avatar-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex-grow: 1;
}

.user-pseudo {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.user-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.user-dropdown-toggle {
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
  color: white;
  font-size: 16px;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Menu déroulant utilisateur */
.user-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 8px 0;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 2000;
  min-width: 180px;
  border: 1px solid #e0e0e0;
}

.user-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: #333;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.user-menu-item:hover {
  background: #f5f5f5;
}

.user-menu-item.danger {
  color: #dc3545;
}

.user-menu-item.danger:hover {
  background: #fff5f5;
}

.menu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.menu-divider {
  border: none;
  height: 1px;
  background: #e0e0e0;
  margin: 4px 0;
}

/* Modal de profil */
.profile-modal .modal-content {
  max-width: 500px;
  width: 90%;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: #f8f8f8;
  border-radius: 10px;
}

.profile-avatar-container {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #e0e0e0;
  background: white;
}

.profile-avatar-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: #8f7a66;
  font-size: 48px;
}

.profile-avatar-actions {
  display: flex;
  gap: 10px;
}

.profile-info-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-field label {
  font-size: 14px;
  font-weight: 500;
  color: #8f7a66;
}

.profile-field input {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  outline: none;
}

.profile-field input:focus {
  border-color: #8f7a66;
}

.profile-field input[readonly] {
  background: #f5f5f5;
  color: #666;
  cursor: not-allowed;
}

.profile-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary {
  background: #8f7a66;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: #a67c5b;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f8f8f8;
  color: #666;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: #e8e8e8;
  transform: translateY(-1px);
}

/* Leaderboard avatar styles: small circular bubble like .user-avatar */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.leaderboard-rank {
  width: 40px;
  text-align: center;
  flex-shrink: 0;
  font-weight: 600;
}

.leaderboard-avatar-wrap {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.leaderboard-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.06);
}

.leaderboard-avatar.placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #bfbfbf, #9f9f9f);
  color: #fff;
  font-size: 13px;
  border: 2px solid rgba(255,255,255,0.06);
}

.leaderboard-player {
  flex: 1 1 auto;
  font-weight: 600;
}

.leaderboard-score {
  flex-shrink: 0;
  margin-left: 8px;
  font-weight: 700;
}

@media (max-width: 600px) {
  .leaderboard-avatar-wrap { width: 32px; height: 32px; }
  .leaderboard-avatar, .leaderboard-avatar.placeholder { width: 28px; height: 28px; border-width: 1px; }
  .leaderboard-rank { width: 32px; }
  .leaderboard-score { font-size: 0.95rem; }
}
