
* {
  box-sizing: border-box;
}

/* PALETTE DES THÈMES */

:root {
    --page-bg: #101018;
    --header-bg: #191925;
    --panel-bg: #20202c;
    --text-color: #ffffff;
    --secondary-text: #aaaaaa;
    --border-color: #454557;
    --input-bg: #20202c;
    --input-text: #ffffff;
}

body[data-theme="light"] {
    --page-bg: #f4f4f8;
    --header-bg: #ffffff;
    --panel-bg: #ffffff;
    --text-color: #242431;
    --secondary-text: #666675;
    --border-color: #d8d8e2;
    --input-bg: #ffffff;
    --input-text: #242431;
}

body {
  margin: 0;
  background: #101018;
  color: white;
  font-family: Arial, sans-serif;
  text-align: center;

  transition: background-color 0.3s ease, color 0.3s ease;
}

header,
.image-container,
input,
#hint-box,
.welcome-box,
.settings-box,
#theme-select,
#settings-button {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease;
}

header {
  padding: 25px 15px;
  background: #191925;
  border-bottom: 2px solid #ff0000;
}

header h1 {
  letter-spacing: 3px;
  color: #ff7171;
}

header p, footer {
  color: #aaa;
}

main {
  max-width: 650px;
  margin: 45px auto;
  padding: 20px;
}

.edition {
  color: #ff2626;
  font-weight: bold;
  letter-spacing: 2px;
}

h2 {
  margin-bottom: 25px;
}

.image-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #292938;
  border: 2px solid #454557;
  border-radius: 12px;
  overflow: hidden;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.instruction {
  color: #ccc;
  margin: 25px 0;
}

.attempts {
  margin-bottom: 15px;
  color: #ff0000;
  font-weight: bold;
}

form {
  display: flex;
  gap: 10px;
}

input {
  flex: 1;
  min-width: 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #555;
  background: #20202c;
  color: white;
  font-size: 15px;
}

button {
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  background: #ff0000;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  background: #ff6a6a;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#feedback {
  margin: 20px 0;
  font-weight: bold;
}

#hint-box {
  background: #20202c;
  border: 1px solid #ff1313;
  border-radius: 10px;
  padding: 15px;
  margin-top: 20px;
}

#hint-box h3 {
  color: #ffcece;
}

footer {
  padding: 20px;
}

@media (max-width: 500px) {
  form {
    flex-direction: column;
  }
}

.cypriguesslogo {
  width: 380px;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.image-container img {
  cursor: zoom-in;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
  z-index: 1000;
}

.modal[hidden] {
  display: none;
}

.modal img {
  max-width: 95%;
  max-height: 90vh;
  object-fit: contain;
}

#close-modal {
  position: absolute;
  top: 20px;
  right: 35px;
  font-size: 45px;
  cursor: pointer;
}

.search-container {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-container input {
  width: 100%;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: #20202c;
  border: 1px solid #ff4747;
  border-radius: 8px;
  z-index: 100;
  text-align: left;
}

.suggestion {
  padding: 12px;
  cursor: pointer;
}

.suggestion:hover {
  background: #6d4444;
}

/* POLICE DU SITE */

body,
button,
input,
textarea,
select {
    font-family: 'Nunito', sans-serif;
}


/* FENETRE DE BIENVENUE */

.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.welcome-overlay[hidden] {
    display: none;
}

.welcome-box {
    background: #20212b;
    color: white;
    width: 100%;
    max-width: 500px;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin: auto;
}

.welcome-box h2 {
    font-size: 26px;
    margin-top: 0;
    margin-bottom: 10px;
}

.welcome-intro {
    color: #c5c5d0;
    font-size: 15px;
    margin-bottom: 20px;
}

.welcome-image {
    width: 100%;
    max-height: 190px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
}

.welcome-rules {
    text-align: left;
}

.welcome-rules div {
    margin-bottom: 16px;
}

.welcome-rules strong {
    color: #ff5555;
    font-size: 16px;
}

.welcome-rules p {
    color: #d0d0d8;
    font-size: 14px;
    margin: 4px 0 0;
}

.welcome-ending {
    color: #ff5555;
    font-weight: 800;
    margin: 22px 0;
}

#welcome-button {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    background: #ff0000;
    color: #20212b;
    font-family: 'Nunito', sans-serif;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#welcome-button:hover {
    background: #ff0000;
    transform: scale(1.02);
}

/* ADAPTATION AUX PETITS ECRANS */

@media (max-width: 500px) {
    .welcome-box {
        padding: 22px;
    }

    .welcome-box h2 {
        font-size: 22px;
    }
}

/* MINIATURE DE LA VIDEO */
#video-thumbnail {
    display: block;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    margin: 15px auto 5px;
}

#video-thumbnail[hidden] {
    display: none;
}

/* =========================
   PARAMÈTRES
========================= */

#settings-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #353644;
    color: white;
    font-size: 22px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#settings-button:hover {
    transform: rotate(45deg);
    background: #48495c;
}

.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.settings-overlay[hidden] {
    display: none;
}

.settings-box {
    background: #20212b;
    color: white;
    width: 100%;
    max-width: 430px;
    padding: 25px;
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.settings-header h2 {
    margin: 0;
    font-size: 23px;
}

#close-settings {
    border: none;
    background: transparent;
    color: white;
    font-size: 22px;
    cursor: pointer;
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 18px 0;
    border-top: 1px solid #41424f;
}

.settings-option strong {
    font-size: 16px;
}

.settings-option p {
    color: #b8b8c5;
    font-size: 13px;
    margin: 5px 0 0;
}

#theme-select,
#reset-stats-button {
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
}

#theme-select {
    background: #353644;
    color: white;
    cursor: pointer;
}

#reset-stats-button {
    background: #402020;
    color: #b8b8c5;
    cursor: not-allowed;
}

@media (max-width: 500px) {
    #settings-button {
        top: 12px;
        right: 12px;
    }

    .settings-box {
        padding: 20px;
    }
}

/* =========================
   THÈME CLAIR
========================= */

body[data-theme="light"] {
    background: var(--page-bg);
    color: var(--text-color);
}

body[data-theme="light"] header {
    background: var(--header-bg);
}

body[data-theme="light"] header p,
body[data-theme="light"] footer {
    color: var(--secondary-text);
}

body[data-theme="light"] .image-container {
    background: #e9e9ef;
    border-color: var(--border-color);
}

body[data-theme="light"] input {
    background: var(--input-bg);
    color: var(--input-text);
    border-color: var(--border-color);
}

body[data-theme="light"] .instruction {
    color: #555;
}

body[data-theme="light"] .suggestions {
    background: var(--panel-bg);
    color: var(--text-color);
}

body[data-theme="light"] .suggestion:hover {
    background: #f4dede;
}

body[data-theme="light"] #hint-box {
    background: var(--panel-bg);
    border-color: #ff1313;
}

body[data-theme="light"] #hint-box h3 {
    color: #9c2020;
}

body[data-theme="light"] .welcome-box,
body[data-theme="light"] .settings-box {
    background: var(--panel-bg);
    color: var(--text-color);
}

body[data-theme="light"] .welcome-intro,
body[data-theme="light"] .welcome-rules p,
body[data-theme="light"] .settings-option p {
    color: var(--secondary-text);
}

body[data-theme="light"] .settings-option {
    border-color: var(--border-color);
}

body[data-theme="light"] #close-settings {
    color: var(--text-color);
}

body[data-theme="light"] #theme-select {
    background: #eeeef3;
    color: var(--text-color);
}

body[data-theme="light"] #reset-stats-button,
body[data-theme="light"] #settings-button {
    background: #e5e5eb;
    color: #333;
}

/* =========================
   THÈME CLAIR
========================= */

body[data-theme="light"] {
    background: var(--page-bg);
    color: var(--text-color);
}

body[data-theme="light"] header {
    background: var(--header-bg);
}

body[data-theme="light"] header p,
body[data-theme="light"] footer {
    color: var(--secondary-text);
}

body[data-theme="light"] .image-container {
    background: #e9e9ef;
    border-color: var(--border-color);
}

body[data-theme="light"] .instruction {
    color: #555;
}

body[data-theme="light"] input {
    background: var(--input-bg);
    color: var(--input-text);
    border-color: var(--border-color);
}

body[data-theme="light"] .suggestions {
    background: var(--panel-bg);
    color: var(--text-color);
}

body[data-theme="light"] .suggestion:hover {
    background: #f4dede;
}

body[data-theme="light"] #hint-box {
    background: var(--panel-bg);
    border-color: #ff1313;
}

body[data-theme="light"] #hint-box h3 {
    color: #9c2020;
}

body[data-theme="light"] .welcome-box,
body[data-theme="light"] .settings-box {
    background: var(--panel-bg);
    color: var(--text-color);
}

body[data-theme="light"] .welcome-intro,
body[data-theme="light"] .welcome-rules p,
body[data-theme="light"] .settings-option p {
    color: var(--secondary-text);
}

body[data-theme="light"] .settings-option {
    border-color: var(--border-color);
}

body[data-theme="light"] #close-settings {
    color: var(--text-color);
}

body[data-theme="light"] #theme-select {
    background: #eeeef3;
    color: var(--text-color);
}

body[data-theme="light"] #reset-stats-button {
    background: #e5e5eb;
    color: #333;
}

body[data-theme="light"] #settings-button {
    background: #eeeef3;
    color: #333;
}

#reset-stats-button {
    cursor: pointer;
}

#reset-stats-button:hover {
    filter: brightness(1.1);
}