/* Emma's Words : couleurs de l'app d'origine */
:root {
  --teal: #85a2a8;
  --red: #ea6660;
  --grey: #bebdbd;
  --light: #f2f2f3;
  --line: #d5dde0;
}

*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  height: 100%;
}
/* Pas de zoom au double toucher */
html {
  touch-action: manipulation;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--teal);
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}
body.view-home {
  background: var(--light);
}
/* Centré sur grand écran, à la demande de Jack */
#app {
  max-width: 700px;
  min-height: 100%;
  margin: 0 auto;
}
body.view-quiz {
  background-size: cover;
  background-position: center;
}
button:focus:not(:focus-visible) {
  outline: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* Barre du haut */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 12px;
  background: var(--light);
}
.bar-left, .bar-right {
  display: flex;
  align-items: center;
}
.bar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}
.link {
  font-size: 17px;
  color: var(--teal);
  padding: 8px 0;
}
.link.danger {
  color: var(--red);
  margin-top: 24px;
}
/* Pied du mode édition : supprimer à gauche, le point secret à droite */
.edit-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.link.secret {
  padding: 8px 12px;
}
/* La photo d'Emma, plein écran sur fond gris */
.emma-photo {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #d0d0d0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emma-photo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.link.light {
  color: #fff;
}
.icon-button {
  display: inline-flex;
  padding: 6px;
}
.icon-button img {
  width: 24px;
  height: 24px;
}
.icon-button.small img {
  width: 20px;
  height: 20px;
}
.icon-button.large img {
  width: 44px;
  height: 44px;
}
.icon-button.huge img {
  width: 56px;
  height: 56px;
}

.content {
  padding: 10px 12px 30px;
}
.hint {
  color: var(--grey);
  font-size: 16px;
}

/* Accueil */
.card {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
  padding: 14px 36px 14px 14px;
  background: #fff;
  border-radius: 5px;
  position: relative;
}
.card::after, .chevron::after {
  content: "›";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  color: var(--grey);
}
.card-title {
  display: block;
  font-size: 24px;
  overflow-wrap: anywhere;
}
.scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.score {
  font-size: 14px;
  color: var(--grey);
}
.stars {
  display: block;
  font-size: 18px;
  color: var(--teal);
}

/* Exercice */
.title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0 20px;
}
.exercise-title {
  flex: 1;
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.title-field {
  width: 100%;
  margin-top: 10px;
  font: inherit;
  font-size: 24px;
  color: var(--teal);
  border: 0;
  border-bottom: 1.5px solid var(--line);
  padding: 6px 0;
  outline: none;
}
.title-field::placeholder, .words-field::placeholder {
  color: var(--grey);
}
.add-row {
  display: flex;
  justify-content: flex-end;
  border-bottom: 1.5px solid var(--line);
}
.add-words {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}
.add-words img {
  width: 18px;
  height: 18px;
}
.words-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row {
  display: block;
  width: 100%;
  text-align: left;
  position: relative;
  padding: 12px 36px 12px 5px;
  border-bottom: 1px solid var(--line);
}
.words-text {
  display: block;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.last-plays {
  display: flex;
  gap: 18px;
  margin-top: 6px;
}
.circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--grey);
}
.circle.filled {
  background: var(--grey);
}
.circle.latest {
  margin-right: 30px;
}

/* Mots */
.words-field {
  width: 100%;
  margin-top: 10px;
  font: inherit;
  font-size: 24px;
  color: var(--teal);
  border: 0;
  border-bottom: 1.5px solid var(--line);
  padding: 6px 0;
  outline: none;
  resize: none;
}
.record-row {
  display: flex;
  gap: 20px;
  padding: 20px 0;
}

/* Quiz */
.quiz {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 10px 12px;
}
.answer-box {
  background: #fff;
  border-radius: 5px;
  padding: 6px 10px;
}
.answer {
  min-height: 2.6em;
  font-size: 28px;
  line-height: 1.3;
  color: var(--teal);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.answer .placeholder {
  color: var(--grey);
}
.caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin: 0 1px -0.2em;
  background: var(--teal);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}
.answer.error {
  color: var(--red);
}
.solution {
  font-size: 28px;
  color: #b3c4c9;
  text-align: right;
  overflow-wrap: anywhere;
}
.quiz-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}
.quiz-buttons .link {
  font-size: 18px;
}
.face {
  flex: 1;
  min-height: 0;
}
.face img {
  height: 100%;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

/* Feuille d'actions */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
/* Sur grand écran : une petite fenêtre au centre plutôt qu'une feuille en bas */
@media (min-width: 701px) {
  .sheet-overlay {
    align-items: center;
  }
  .sheet {
    max-width: 380px;
  }
}
.sheet {
  width: 100%;
  max-width: 700px;
  padding: 10px;
}
.sheet-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  font-size: 18px;
  color: var(--teal);
  text-decoration: none;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.sheet-item:first-child {
  border-radius: 5px 5px 0 0;
}
.sheet-item:nth-last-child(2) {
  border-radius: 0 0 5px 5px;
  border-bottom: 0;
}
.sheet-item.danger {
  color: var(--red);
}
.sheet-item.cancel {
  margin-top: 8px;
  border-radius: 5px;
  font-weight: 600;
}
.sheet-item:first-child:nth-last-child(2) {
  border-radius: 5px;
}

/* Clavier du quiz */
.keyboard {
  position: relative;
  padding: 8px 0 4px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.key-row {
  display: flex;
  gap: 5px;
  margin-bottom: 7px;
}
.key-row:nth-child(2) {
  padding: 0 5%;
}
.key {
  flex: 1;
  height: 46px;
  min-width: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--teal);
  font-size: 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.key.has-accents {
  position: relative;
}
.key.has-accents::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--grey);
}
.key.down {
  background: var(--light);
}
.key.wide {
  flex: 2;
}
.key.space {
  flex: 5;
}
.key.enter {
  background: var(--red);
  color: #fff;
}
.accents {
  position: absolute;
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.accent {
  width: 44px;
  height: 50px;
  border-radius: 6px;
  font-size: 24px;
  color: var(--teal);
}
.accent.over, .accent:active {
  background: var(--teal);
  color: #fff;
}
