/* Alice's Numbers : mêmes bases qu'Emma's Words, couleurs de l'icône d'Alice */
:root {
  --main: #3f8f78;
  --yellow: #f7eaa2;
  --red: #ea6660;
  --grey: #b5c2bb;
  --light: #eef6f0;
  --line: #d3e6dc;
}

*, *::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(--main);
  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(--main);
  padding: 8px 0;
}
.link.danger {
  color: var(--red);
  margin-top: 24px;
}
.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(--main);
}

/* 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(--main);
  border: 0;
  border-bottom: 1.5px solid var(--line);
  padding: 6px 0;
  outline: none;
}
.title-field::placeholder, .words-field::placeholder, .answer::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;
}

/* 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 {
  width: 100%;
  font: inherit;
  font-size: 28px;
  color: var(--main);
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
}
.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(--main);
  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;
}

/* Exercice : calculs réussis 5 fois, à part */
.row.won-first {
  margin-top: 40px;
  border-top: 1px solid var(--line);
}

/* Formulaire */
.form-error {
  color: var(--red);
  font-size: 16px;
}
.field-label {
  margin: 18px 0 6px;
  font-size: 16px;
  color: var(--grey);
}
.operations {
  display: flex;
  gap: 12px;
}
.operation {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--main);
  font-size: 26px;
  color: var(--main);
  background: #fff;
}
.operation.on {
  background: var(--main);
  color: #fff;
}
.operations.error .operation {
  border-color: var(--red);
}
.interval {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}
.number {
  width: 90px;
  font: inherit;
  font-size: 22px;
  color: var(--main);
  padding: 6px 8px;
  border: 1px solid var(--main);
  border-radius: 5px;
  outline: none;
}
.number:focus {
  border-width: 2px;
}
.number.error {
  border-color: var(--red);
}
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  font-size: 16px;
}
.option input {
  width: 22px;
  height: 22px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--main);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--main);
  margin-bottom: 20px;
  font-size: 16px;
}
.table th, .table td {
  text-align: right;
  padding: 3px 6px;
  font-weight: 400;
}
.table tr:first-child th {
  border-bottom: 1px solid var(--main);
}
.table tr th:first-child {
  border-right: 1px solid var(--main);
}
.table tr:nth-child(odd) {
  background: var(--light);
}

/* Quiz */
.calculation {
  font-size: 28px;
  min-height: 56px;
  padding: 8px 12px;
}
.calculation .error {
  color: var(--red);
}
.keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px 0 6px;
}
.key {
  height: 52px;
  border-radius: 26px;
  background: #fff;
  color: var(--main);
  font-size: 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.key:active {
  background: var(--light);
}
.key.enter {
  background: var(--yellow);
}
.key[data-key="Backspace"] {
  grid-column: 1 / span 2;
}
.key[data-key="Enter"] {
  grid-column: 4 / span 2;
}
