@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

/* :root {
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --sky-700: #0369a1;
  --sky-600: #0284c7;
  --sky-500: #0ea5e9;
  --sky-400: #38bdf8;
  --sky-300: #7dd3fc;
  --yellow-600: #ca8a04;
  --yellow-500: #eab308;
  --yellow-400: #facc15;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --red-400: #f87171;
  --purple-400: #c084fc;
  --purple-300: #d8b4fe;
  --orange-400: #fb923c;
  --white: #ffffff;
  --white-nancyte: #faf4ef
} */

:root {
  /* Votre nouvelle charte */
  --color-primary: #103c54;
  --color-accent: #CC4F39;
  --color-accent2: #956afa;
  --color-background: #faf4ef;
  --color-white: #FFFFFF;
  --color-gray: #4B4B4B;
  --color-background2: #b2cee04d;

  /* --- Mappage des anciennes variables vers le thème clair --- */

  /* Fonds (Anciennement sombres, maintenant clairs) */
  --slate-900: var(--color-background); /* Fond de page principal */
  --slate-800: var(--color-white);      /* Fond du conteneur de l'app */
  --slate-700: var(--color-background2); /* Fond des cartes, options de quiz */
  --slate-600: #a1c0d4;                  /* Fond des boutons secondaires, bordures */

  /* Textes (Anciennement clairs, maintenant sombres) */
  --slate-400: var(--color-gray);     /* Texte secondaire (descriptions) */
  --slate-300: var(--color-gray);     /* Texte secondaire (sous-titres) */
  --slate-200: var(--color-primary);  /* Texte principal (ex: fin d'écran) */

  /* Accents (Anciennement bleus, maintenant votre accent) */
  --sky-700: #a73f2d; /* Accent foncé (hover quiz) */
  --sky-600: #ba4733; /* Accent moyen (hover bouton) */
  --sky-500: var(--color-accent); /* Bouton principal */
  --sky-400: var(--color-primary); /* Titres (h1, h2) - on utilise le primaire pour plus de lisibilité */
  --sky-300: #d66a57; /* Accent clair (textes de résultats) */

  /* Couleurs sémantiques (Jeu) - On les garde */
  --yellow-600: #ca8a04;
  --yellow-500: #eab308;
  --yellow-400: #facc15;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --red-400: #f87171;
  
  /* On peut mapper le violet */
  --purple-400: var(--color-accent2);
  --purple-300: #d8b4fe;
  
  --orange-400: #fb923c;

  /* --white est utilisé pour le texte sur les boutons, on le garde blanc */
  --white: var(--color-white); /* #FFFFFF */
  --white-nancyte: #faf4ef; /* C'est votre nouveau fond, c'est parfait */
}

/* Base Styles */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--slate-900);
  color: var(--white);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 384px; /* max-w-sm */
  height: 700px;
  max-height: 90vh;
  background-color: var(--slate-800);
  border-radius: 1rem; /* rounded-2xl */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
  border: 4px solid var(--slate-700);
}

.app-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Screen styles */
.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem; /* p-6 */
  box-sizing: border-box;
  /* background: linear-gradient(to bottom, var(--slate-800), var(--slate-900)); */
  background-color: var(--slate-800);
}

#end-screen, #nancyte-end-screen, #algo-end-screen {
  /* background: linear-gradient(to bottom, #1e3a8a, var(--slate-900)); */
  background-color: var(--slate-900);
}

h1 {
  font-size: 2.25rem; /* text-4xl */
  font-weight: 700;
  color: var(--sky-400);
  margin-bottom: 0.5rem;
  margin-top: 0;
}

h2 {
  font-size: 1.875rem; /* text-3xl */
  line-height: 2.25rem;
  font-weight: 700;
  color: var(--sky-400);
  margin-bottom: 1rem;
  margin-top: 0;
}

.subtitle {
  font-size: 1.125rem; /* text-lg */
  line-height: 1.75rem;
  color: var(--slate-300);
  margin-bottom: 2rem;
}

.description {
  font-size: 0.875rem; /* text-sm for start, md for end */
  line-height: 1.25rem;
  color: var(--slate-400);
  margin-bottom: 2rem;
  max-width: 320px;
}

.font-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

#end-screen .description, #nancyte-end-screen .description, #algo-end-screen .description {
    font-size: 1rem; /* text-md */
    line-height: 1.5rem;
    color: var(--slate-200);
}

/* Buttons */
.btn {
  font-weight: 700;
  padding: 0.75rem 3rem;
  border-radius: 9999px;
  font-size: 1.25rem;
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  border: none;
  cursor: pointer;
  text-align: center;
}
.btn:hover {
  transform: scale(1.05);
}

.btn-primary {
  background-color: var(--sky-500);
  color: var(--white);
}
.btn-primary:hover {
  background-color: var(--sky-600);
}

.btn-secondary {
    background-color: var(--slate-600);
    color: var(--white);
}
.btn-secondary:hover {
    background-color: var(--slate-700);
}

.btn-yellow {
    background-color: var(--yellow-500);
    color: var(--slate-900);
}
.btn-yellow:hover {
    background-color: #f59e0b;
}

.btn-green {
    background-color: var(--green-500);
    color: var(--white);
    text-decoration: none;
    display: block;
}
.btn-green:hover {
    background-color: #16a34a;
}

/* Icons & Emojis */
.icon-container-md {
    font-size: 4rem;
    margin: 1rem 0;
}

.font-semibold { font-weight: 600; }

.icon-group {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
}
.icon-label-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.icon-label-group span {
    font-size: 0.875rem;
    line-height: 1.25rem;
}
.icon-bg-purple, .icon-bg-red {
    border-radius: 9999px;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.icon-bg-purple {
    background-color: rgba(126, 34, 206, 0.5);
}
.icon-bg-red {
    background-color: rgba(220, 38, 38, 0.5);
}
.text-purple { color: var(--purple-400); }
.text-red { color: var(--sky-700); }

/* --- Main Menu --- */
.menu-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.menu-card {
    width: 100%;
    background-color: var(--slate-700);
    border: 2px solid var(--slate-600);
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    text-align: left;
    color: var(--color-primary);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.menu-card:not(.disabled):hover {
    transform: translateY(-5px);
    border-color: var(--sky-500);
}
.menu-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.menu-card-icon {
    font-size: 2.5rem;
    line-height: 1;
    flex-shrink: 0;
}
.menu-card-text {
    flex-grow: 1;
}
.menu-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}
.menu-card-description {
    font-size: 0.875rem;
    color: var(--slate-300);
    margin: 0;
}

/* Game Screen (Cookies) */
.game-screen-layout {
    padding: 0;
    justify-content: flex-start;
}
.game-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
}
.logo-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logo-title .logo-circle {
    width: 2rem; height: 2rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
}
.logo-circle.tripadvisor-bg { background-color: #22c55e; }
.logo-circle.google-bg { background-color: #4285F4; }
.logo-circle.nancyte-bg { background-color: #0ea5e9; }
.logo-circle.news-bg { background-color: #6b7280; }
.logo-title span {
    font-weight: 700;
    font-size: 1.125rem;
}
.score-badge {
    background-color: var(--sky-500);
    color: var(--white);
    font-weight: 700;
    font-size: 1.125rem;
    border-radius: 9999px;
    padding: 0.25rem 1rem;
}
.game-area {
    position: relative;
    flex: 1;
    width: 100%;
    overflow: hidden;
}
.progress-bar-container {
    width: 100%;
    background-color: var(--slate-700);
    height: 0.5rem;
}
.progress-bar {
    background-color: var(--yellow-400);
    height: 100%;
    transition: width 100ms linear;
}

.player {
    position: absolute;
    bottom: 0.5rem;
    transition: transform 75ms ease-out;
    transform: translateX(-50%);
    width: 80px;
}
.player svg {
    width: 100%;
    height: auto;
    color: var(--sky-400);
    filter: drop-shadow(0 4px 3px rgba(0,0,0,0.07)) drop-shadow(0 2px 2px rgba(0,0,0,0.06));
}

.game-cookie {
    position: absolute;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    user-select: none;
}

/* End Screen (Generic) */
.end-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--sky-300);
    margin-bottom: 1rem;
}
.results-box {
    background-color: var(--color-primary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 320px;
    margin: 1rem 0;
}
.results-subtitle {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--white);
    margin-top: 0;
}
.results-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}
.text-red-light { color: #f96565; }
.text-green-light { color: #4de484; }
.text-sky-light { color: var(--sky-300); }

.end-buttons-container {
    width: 100%;
    max-width: 320px;
}
.end-buttons-container .btn, .end-buttons-container a {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

/* Quiz Screen */
.quiz-layout {
    justify-content: space-between;
}
.quiz-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sky-400);
    margin-bottom: 0.5rem;
}
.quiz-progress {
    color: var(--slate-400);
}
.quiz-question-container {
    width: 100%;
    max-width: 320px;
}
.question-text {
    color: var(--slate-300);
    font-size: 1.125rem;
    margin-bottom: 2rem;
    margin-top: 1rem;
}
.quiz-options {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.quiz-options .btn {
    width: 100%;
    background-color: var(--slate-700);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.3s;
}
.quiz-options .btn:not(:disabled):hover {
    background-color: var(--sky-700);
}
.quiz-options .btn.correct {
    background-color: #16a34a;
    transform: scale(1.05);
}
.quiz-options .btn.incorrect {
    background-color: #dc2626;
}
.quiz-options .btn.disabled {
    opacity: 0.6;
    cursor: default;
}
.quiz-feedback-container {
    min-height: 9rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}
.explanation-box {
    font-size: 1rem;
    color: var(--slate-200);
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(51, 65, 85, 0.5);
    border-radius: 0.5rem;
}
#quiz-next-button {
    padding: 0.5rem 2rem;
}

/* --- Nancyte Game --- */
.nancyte-game-layout {
    padding: 0;
    justify-content: flex-start;
    /* background: linear-gradient(to bottom, var(--slate-800), var(--slate-900)); */
    background-color: var(--slate-800);
}
.nancyte-game-header {
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nancyte-progress-bar-container {
    flex-grow: 1;
    height: 1rem;
    background-color: var(--slate-700);
    border-radius: 9999px;
    overflow: hidden;
}
.nancyte-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--yellow-400), var(--orange-400));
    transition: width 0.5s ease-out;
}
.nancyte-time {
    font-weight: 700;
    color: var(--slate-200);
    width: 4rem;
    text-align: right;
}
.nancyte-scenario-container {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem 1.5rem;
    box-sizing: border-box;
}
.nancyte-scenario-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sky-300);
    margin-bottom: 2rem;
}
.nancyte-choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    width: 100%;
}
.nancyte-choice-card {
    background-color: var(--slate-700);
    border: 2px solid var(--slate-600);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    height: 120px;
}
.nancyte-choice-card:hover {
    transform: translateY(-5px);
    border-color: var(--green-400);
}
.nancyte-choice-card.selected {
    border-color: var(--green-500);
    transform: scale(1.05);
    background-color: #27523a;
}
.nancyte-choice-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}
.nancyte-choice-name {
    font-weight: 500;
    color: var(--slate-200);
}
.nancyte-feedback-toast {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 100px);
    background-color: var(--green-500);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 700;
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}
.nancyte-feedback-toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* Nancyte End Screen */
#nancyte-end-screen .description {
    margin-bottom: 1rem;
}
.nancyte-end-icon {
    font-size: 3rem;
    width: 5rem;
    height: 5rem;
    border-radius: 9999px;
    background-color: rgba(34, 197, 94, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* --- Algo Game --- */
.algo-game-layout {
    justify-content: space-between;
    padding: 1rem;
}
.algo-game-header {
    text-align: center;
}
.algo-game-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}
.algo-game-header p {
    color: var(--slate-400);
    margin: 0;
}
#algo-maze-container {
    position: relative;
    width: 90%;
    max-width: 320px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border: 2px solid var(--slate-600);
    background-color: var(--slate-900);
}
#algo-maze-grid {
    display: grid;
    width: 100%;
    height: 100%;
}
.maze-cell {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.maze-cell.wall {
    background-color: var(--slate-700);
}
.maze-cell.path {
    background-color: var(--slate-800);
}
#algo-player {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease-out;
    z-index: 10;
}
#algo-obstacle-popup {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.7);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}
.algo-obstacle-content {
    background-color: var(--slate-900);
    border: 2px solid var(--red-400);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    animation: fadeIn 0.3s;
}
.algo-obstacle-content h3 {
    font-size: 1.5rem;
    color: var(--red-400);
    margin: 0 0 0.5rem 0;
}
.algo-obstacle-content p {
    color: var(--slate-200);
    margin: 0;
}

/* Algo Controls */
.algo-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
}
.algo-controls > div {
    display: flex;
    gap: 0.25rem;
}
.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 9999px;
    border: 2px solid var(--slate-600);
    background-color: var(--slate-700);
    color: var(--color-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.control-btn:hover {
    background-color: var(--slate-600);
}
.control-btn:active {
    background-color: var(--sky-700);
}


/* Algo End Screen */
.algo-end-icon {
    font-size: 3rem;
    width: 5rem;
    height: 5rem;
    border-radius: 9999px;
    background-color: rgba(34, 197, 94, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Animations */
.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.logo {
    text-decoration: none;
    flex-shrink: 0;
    padding-left: 1rem;
}

.logo-img {
    height: 80px;
    width: auto;
    vertical-align: middle;
    margin: 1rem;
}

.logo-img2 {
    height: 50px;
    width: auto;
    vertical-align: middle;
    margin: 0rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive Design --- */

/* Tablet Styles */
@media (min-width: 768px) {
    .app-container {
        max-width: 576px;
        height: 800px;
    }

    h1 { font-size: 2.5rem; }
    h2 { font-size: 2.1rem; }
    .subtitle { font-size: 1.25rem; }
    .description { font-size: 1rem; max-width: 450px; }
    #end-screen .description, #nancyte-end-screen .description, #algo-end-screen .description { font-size: 1.125rem; }

    .btn { font-size: 1.375rem; padding: 0.85rem 3.5rem; }
    .menu-card { padding: 1.25rem 1.75rem; }
    .menu-card-title { font-size: 1.25rem; }
    .menu-card-description { font-size: 1rem; }
    .menu-card-icon { font-size: 3rem; }
    .icon-container-md { font-size: 5rem; }

    /* Nancyte Game */
    .nancyte-scenario-title { font-size: 1.75rem; }
    .nancyte-choices-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .nancyte-choice-card { height: 140px; }
    .nancyte-choice-icon { font-size: 3.5rem; }

    /* Algo Game */
    #algo-maze-container { max-width: 400px; }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .app-container {
        max-width: 640px;
        height: 850px;
    }

    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    .subtitle { font-size: 1.375rem; }
    .description { max-width: 500px; }
    .btn { font-size: 1.5rem; padding: 1rem 4rem; }
    .question-text { font-size: 1.25rem; }
    .results-subtitle { font-size: 1.375rem; }
    .results-row { font-size: 1.25rem; }
    .algo-game-header h2 { font-size: 1.75rem; }
    #algo-maze-container { max-width: 450px; }
}
