/* ==========================================================================
   Emoji Telephone — styles. Theme tokens and shared components come from
   shared/style.css.

   What the player answers sits in a card at the top, as large as it can be:
   emoji at sticker size, words as a quote. The reveal is one chain at a time,
   down the page like a conversation.
   ========================================================================== */

.et { display: grid; gap: 1rem; max-width: 30rem; margin-inline: auto; padding-block: .75rem 2rem; }
.et-title { font-size: clamp(1.6rem, 7vw, 2.2rem); text-align: center; }
.et-subtitle { font-size: 1.2rem; }
.et-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.et-top > :last-child:not(:first-child) { margin-inline-start: auto; }
.et-note { font-size: 1.05rem; font-weight: 700; text-align: center; }
.et-center-btn { justify-self: center; }

/* ---------- Menu ---------- */

.et-menu { display: grid; gap: .5rem; }
.et-demo { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .35rem; font-size: 1.8rem; }
.et-demo__arrow { font-size: 1.1rem; font-weight: 900; color: var(--muted); }
html[dir="rtl"] .et-demo__arrow { transform: scaleX(-1); }
.et-tagline { font-size: 1.1rem; font-weight: 700; text-align: center; }
.et-settings { display: grid; gap: .4rem; }

.choices { display: grid; gap: .5rem; }
.choices--row { grid-auto-flow: column; grid-auto-columns: 1fr; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: .4rem .7rem; font-weight: 800; text-align: center; background: var(--surface); border: 3px solid var(--line); border-radius: 14px 16px 13px 17px; }
.choice input:checked + span { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.howto { max-width: 30rem; margin: 1.5rem auto 0; padding: .25rem 1rem; }
.howto summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.howto ol { display: grid; gap: .5rem; padding: 0 0 1rem; padding-inline-start: 1.4rem; list-style: decimal; }

.host--small .host__teta { width: 76px; }
.host--small .bubble { padding: .65rem .9rem; font-weight: 700; }

/* ---------- What came before ---------- */

.et-prev { display: grid; place-items: center; min-height: 6.5rem; padding: 1rem; text-align: center; background: var(--sun); color: var(--ink); }
.et-emoji { font-size: clamp(2.4rem, 12vw, 3.4rem); line-height: 1.2; letter-spacing: .06em; word-break: break-all; text-align: center; }
.et-words { font-size: 1.25rem; font-weight: 800; line-height: 1.35; }
.et-words.is-empty { font-weight: 700; color: var(--muted); }
.et-prev .et-words { font-size: clamp(1.3rem, 6vw, 1.7rem); }
.et-prev .et-words.is-empty { color: inherit; opacity: .7; }

/* ---------- Writing ---------- */

.et-text { min-height: 0; font: inherit; font-size: 1.15rem; font-weight: 700; line-height: 1.4; resize: none; }

/* ---------- Emoji ---------- */

.et-field { display: grid; gap: .4rem; }
.et-emoji-input { min-height: 4.2rem; font-family: inherit; font-size: 2.1rem; text-align: center; letter-spacing: .06em; }
.et-field__tools { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; }
.et-count { margin-inline-end: auto; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.et-warn { min-height: 1.4em; font-weight: 800; text-align: center; color: var(--tomato); opacity: 0; transition: opacity .2s; }
.et-warn.is-on { opacity: 1; }

.et-keys {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: .2rem;
  max-height: 15.5rem;
  overflow-y: auto;
  padding: .4rem;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: 16px 18px 15px 19px;
  overscroll-behavior: contain;
}
.et-key { display: grid; place-items: center; aspect-ratio: 1; min-width: 0; min-height: 40px; padding: 0; font-size: 1.6rem; line-height: 1; background: none; border: 0; border-radius: 10px; cursor: pointer; touch-action: manipulation; }
.et-key:active { background: var(--surface-2); transform: scale(.9); }
.et-key:focus-visible { outline: 3px solid var(--focus); }

/* ---------- Waiting ---------- */

.et-wait { display: grid; justify-items: center; gap: .3rem; padding-block: 1.5rem .5rem; }
.et-wait__icon { font-size: 4rem; animation: et-bob 1.6s ease-in-out infinite; }
@keyframes et-bob { 50% { transform: translateY(-8px); } }

/* ---------- A chain ---------- */

.et-chain { display: grid; gap: .6rem; }
.et-step {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .7rem;
  padding: .7rem .8rem;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: 16px 18px 15px 19px;
}
.et-step--emoji { background: var(--surface-2); }
.et-step.is-you { border-style: dashed; }
.et-step.is-best { background: var(--sun); color: var(--ink); }
.et-step.is-new { animation: et-in .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes et-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.et-step__face { font-size: 1.8rem; }
.et-step__body { display: grid; gap: .15rem; min-width: 0; }
.et-step__who { font-weight: 700; color: var(--muted); }
.et-step.is-best .et-step__who { color: inherit; opacity: .8; }
.et-step .et-emoji { font-size: 2rem; text-align: start; }
.et-step .et-words { font-size: 1.1rem; }

.et-laugh {
  min-width: 3.2rem;
  min-height: 44px;
  padding: .2rem .6rem;
  font-size: 1.15rem;
  font-weight: 900;
  white-space: nowrap;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}
button.et-laugh:active { transform: scale(.92); }
.et-laugh.is-on { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.et-laugh.is-shown { display: inline-grid; place-items: center; border-style: dashed; cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .et-step.is-new, .et-wait__icon { animation: none; }
}

/* ---------- The end ---------- */

.et-board { display: grid; gap: .45rem; }
.et-board__row { display: grid; grid-template-columns: 1.6rem auto 1fr auto; align-items: center; gap: .6rem; padding: .55rem .8rem; background: var(--surface); border: 3px solid var(--line); border-radius: 14px 16px 13px 17px; }
.et-board__row:first-child { background: var(--sun); color: var(--ink); }
.et-board__row.is-you { border-style: dashed; }
.et-board__place { font-size: 1.2rem; text-align: center; }
.et-board__face { font-size: 1.6rem; }
.et-board__name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.et-board__score { font-size: 1.15rem; white-space: nowrap; }

.et-best { display: grid; gap: .7rem; padding: 1rem; }
.et-all { padding: .25rem 1rem; }
.et-all summary { display: flex; align-items: center; gap: .4rem; min-height: var(--tap); font-weight: 800; cursor: pointer; }
.et-all[open] { display: grid; gap: .7rem; padding-bottom: 1rem; }
