/* arcoco daily: the day's letters reel as a game. The stage copies the reel's 9:16 frame (picture,
   true-story label, story lines, medal countdown, answer slots over jumbled tiles) and scales with its
   own width, so it matches the reel on any screen. Medal colours match the reel's. */

.daily-page { max-width: 760px; }

.daily-header { padding: clamp(12px, 3vw, 28px) 0 14px; text-align: center; }
.daily-header h1 { font-size: clamp(2rem, 6vw, 2.8rem); margin: 0 0 6px; }
.daily-intro { margin: 0; color: var(--muted); font-size: 1.02rem; }
.daily-intro span { display: block; font-size: 0.92rem; }

.daily {
  --medal-gold: #d9b45c;
  --medal-silver: #a9b3bc;
  --medal-bronze: #c48a5a;
  --tile-face-top: #ffffff;
  --tile-face: #f6f8f4;
  --tile-lip: #c6c1b4;
  --tile-ink: #20261f;
  --lit-top: #3fc8af;
  --lit-bottom: #1d9caf;
  --lit-lip: #0b8079;
  --slot-line: rgba(255, 255, 255, 0.8);
  --slot-filled: #2db4c8;
}

/* The reel's frame. It never grows taller than the screen below the menu, so the board and the clock
   always fit on a phone together. */
.daily-stage {
  position: relative;
  container-type: inline-size;
  width: min(100%, 460px, calc((100svh - 128px) * 9 / 16));
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 24px;
  background: #2b302e;
  color: #ffffff;
  box-shadow: var(--shadow-phone);
  /* The page already keeps 88px clear for the menu; this adds the rest of the phone menu's height. */
  scroll-margin: 20px 0 12px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.daily-picture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.daily-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.18) 34%, rgba(0, 0, 0, 0.12) 46%, rgba(0, 0, 0, 0.5) 72%, rgba(0, 0, 0, 0.72) 100%);
}

/* Before Play the picture and the story are each just a question mark (Jack, 25 Oct). */
.daily-cover {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% 30%, #3d4643 0%, #2b302e 60%, #1f2321 100%);
}
.daily-cover > span {
  position: absolute;
  top: 17%;
  left: 0;
  right: 0;
  text-align: center;
  font: 600 34cqw/1 var(--display);
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}
.daily-cover.leaving { animation: daily-fade-out 0.45s ease forwards; }
/* How hard the day is, shown on the cover before Play: our estimate until real results take over. */
.daily-level {
  position: absolute;
  top: 41%;
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  padding: 1.2cqw 3.2cqw;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #20261f;
  font: 600 max(11px, 3.4cqw)/1.2 var(--body);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.daily-level-name { font-size: 0.78em; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.daily-level-dots { display: inline-flex; gap: 0.9cqw; margin: 0 0.6cqw; vertical-align: 0.05em; }
.daily-level-dots i { width: 1.9cqw; height: 1.9cqw; min-width: 7px; min-height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.daily-level[data-value="easy"] i:nth-child(-n+1),
.daily-level[data-value="medium"] i:nth-child(-n+2),
.daily-level[data-value="hard"] i { background: currentColor; }
/* The narrator can be switched off; the choice is remembered in this browser. */
.daily-sound {
  position: absolute;
  top: 3cqw;
  right: 3cqw;
  z-index: 2;
  width: max(36px, 9cqw);
  height: max(36px, 9cqw);
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: max(16px, 4.4cqw);
  line-height: 1;
  cursor: pointer;
}
.daily-sound:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }
.daily-picture.arrive { animation: daily-fade-in 0.6s ease; }
@keyframes daily-fade-out { to { opacity: 0; } }
@keyframes daily-fade-in { from { opacity: 0; } }

.daily-story-block { position: absolute; top: 4.5cqw; left: 5cqw; right: 5cqw; text-align: center; }
.daily-dateline {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 2.4cqw;
  padding: 0.9cqw 2.6cqw;
  border-radius: 12px;
  text-wrap: balance;
  background: rgba(255, 255, 255, 0.92);
  color: #20261f;
  font: 600 max(9px, 2.6cqw)/1.2 var(--body);
  letter-spacing: 0.08em;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.daily-dateline span:first-child { display: inline-block; width: 1.6cqw; height: 1.6cqw; margin-right: 1.6cqw; border-radius: 50%; background: var(--slot-filled); vertical-align: 0.15em; }
.daily-story {
  margin: 0;
  font: 500 6.1cqw/1.42 var(--display);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.5);
  text-wrap: balance;
}
.daily-story span { display: block; }
/* On Play each line pops up as the narrator says it, like the reel. */
.daily-story.telling span { opacity: 0; transform: translateY(0.5em) scale(0.96); transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
.daily-story.telling span.said { opacity: 1; transform: none; }

.daily-board {
  position: absolute;
  left: 0;
  right: 0;
  /* At least the lower 53% like the reel; on a short screen the start panel grows upwards instead of being cut off. */
  top: auto;
  min-height: 53%;
  bottom: 3cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3.4cqw;
}

/* The medal countdown: the reel's white dial whose ring turns gold, then silver, then bronze. */
.daily-ring { position: relative; width: 18cqw; height: 18cqw; flex: none; }
.daily-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3)); }
.daily-ring circle { fill: none; stroke-width: 6; }
.daily-ring .daily-ring-track { fill: #ffffff; stroke: var(--ring, var(--medal-gold)); stroke-opacity: 0.3; }
.daily-ring .daily-ring-fill { stroke: var(--ring, var(--medal-gold)); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke 0.35s ease; }
.daily-ring-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #20261f; }
.daily-ring-number { font: 600 6.4cqw/1 var(--display); font-variant-numeric: tabular-nums; }
.daily-ring-medal { font: 600 max(9px, 2.4cqw)/1.2 var(--body); letter-spacing: 0.04em; text-transform: uppercase; color: #5a6159; }
.daily-ring[data-medal="gold"] { --ring: var(--medal-gold); }
.daily-ring[data-medal="silver"] { --ring: var(--medal-silver); }
.daily-ring[data-medal="bronze"] { --ring: var(--medal-bronze); }
.daily-ring[data-medal="none"] { --ring: #8b918a; }
.daily-ring.pulse { animation: daily-pulse 0.45s ease; }
@keyframes daily-pulse { 50% { transform: scale(1.12); } }

/* Answer slots over the jumbled tray, as in the reel. */
.daily-slots {
  --n: 6;
  --slot: min(10cqw, calc((84cqw - (var(--n) - 1) * 1.2cqw) / var(--n)));
  display: grid;
  grid-template-columns: repeat(var(--n), var(--slot));
  gap: 1.2cqw;
}
.daily-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.9cqw;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: default;
}
.daily-slot-hold { height: 11cqw; display: flex; }
.daily-slot::after {
  content: "";
  height: 3px;
  margin: 0 2px;
  border-radius: 2px;
  background: var(--slot-line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease;
}
.daily-slot.filled::after { background: var(--slot-filled); }
.daily-slot.next::after { background: #ffffff; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 1px 6px rgba(45, 180, 200, 0.9); }
.daily-slot:not([disabled]) { cursor: pointer; }

.daily-tray {
  --cols: 4;
  width: 84cqw;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 2.2cqw;
}
.daily-cell {
  height: 11cqw;
  display: flex;
  border-radius: 10px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.daily-cell:empty { background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.daily-tray.leaving { opacity: 0; transition: opacity 0.35s ease; }

/* One letter tile, built like the app's answer tiles: a light face on a greige lip. */
.daily-tile {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 4px;
  border: 0;
  border-radius: 9px;
  background:
    linear-gradient(180deg, var(--tile-face-top) 0%, var(--tile-face) 100%) top / 100% calc(100% - 4px) no-repeat,
    var(--tile-lip);
  color: var(--tile-ink);
  font: 500 5.6cqw/1 var(--display);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  touch-action: none;
}
.daily-slots .daily-tile { font-size: min(5.6cqw, calc(var(--slot) * 0.66)); }
.daily-tile:active:not([disabled]) { transform: translateY(2px); }
.daily-tile[disabled] { cursor: default; }
.daily-tile.dragging { position: relative; z-index: 5; cursor: grabbing; box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35); }
.daily-slot { cursor: pointer; }
.daily-tile.lit {
  background:
    linear-gradient(180deg, var(--lit-top) 0%, var(--lit-bottom) 100%) top / 100% calc(100% - 4px) no-repeat,
    var(--lit-lip);
  color: #ffffff;
  transition: background 0.3s ease, color 0.3s ease;
}
.daily-tile:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }

.daily-slots.wrong { animation: daily-shake 0.42s ease; }
@keyframes daily-shake {
  20% { transform: translateX(-2.2cqw); }
  40% { transform: translateX(2cqw); }
  60% { transform: translateX(-1.4cqw); }
  80% { transform: translateX(0.8cqw); }
}

.daily-note {
  min-height: 1.3em;
  margin: 0;
  padding: 0 5cqw;
  text-align: center;
  font: 600 max(13px, 3.6cqw)/1.3 var(--body);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.daily-note:empty { visibility: hidden; }

.daily-start, .daily-tools {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.4cqw;
  padding: 0 5cqw;
  text-align: center;
}
.daily-start-hint { margin: 0; font: 400 max(13px, 3.6cqw)/1.35 var(--body); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
.daily-start .play-button { font-size: max(1rem, 4.8cqw); padding-inline: 7cqw; }
.daily-medal-rules {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.3em 0.9em;
  font: 600 max(11px, 3cqw)/1.2 var(--body);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.medal-item { display: inline-flex; align-items: center; gap: 0.35em; white-space: nowrap; }
.medal-dot { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; background: var(--medal-gold); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.8); }
.medal-dot.silver { background: var(--medal-silver); }
.medal-dot.bronze { background: var(--medal-bronze); }
.daily-tools { flex-direction: row; justify-content: center; gap: 4cqw; }
.daily-hint-rule { margin: 0; font: 400 max(11px, 3cqw)/1.3 var(--body); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }

.daily-link-button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: inherit;
  font: 600 max(14px, 3.6cqw)/1.2 var(--body);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.daily-stage .daily-link-button { color: #ffffff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }

/* The result: medal and share first, then the word's journal page, as on the reel's second page. */
.daily-result {
  width: min(100%, 460px);
  margin: 22px auto 0;
  text-align: center;
  outline: none;
  scroll-margin-top: 24px;
}
.daily-result.arrive { animation: daily-rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes daily-rise { from { opacity: 0; transform: translateY(14px); } }
.daily-score { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 16px; text-align: left; }
.daily-medal {
  --medal: var(--medal-gold);
  flex: none;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7) 0 14%, transparent 15%), var(--medal);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.35), inset 0 -4px 0 rgba(0, 0, 0, 0.12), 0 6px 14px -6px rgba(0, 0, 0, 0.45);
}
.daily-medal[data-medal="silver"] { --medal: var(--medal-silver); }
.daily-medal[data-medal="bronze"] { --medal: var(--medal-bronze); }
.daily-medal[data-medal="none"] { --medal: var(--hairline-strong); }
.daily-medal.stamp { animation: daily-stamp 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes daily-stamp { from { transform: scale(1.8) rotate(-12deg); opacity: 0; } }
.daily-score-title { margin: 0 0 2px; font: 600 1.45rem/1.2 var(--display); }
.daily-squares { margin: 0; font-size: 1.15rem; letter-spacing: 2px; }
.daily-squares small { letter-spacing: 0; font-size: 0.92rem; color: var(--muted); }
.daily-share { font-size: 1.12rem; }
.daily-shared { min-height: 1.4em; margin: 10px 0 0; color: var(--muted); font-size: 0.95rem; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; white-space: pre-line; }
.daily-shared:empty { min-height: 0; }

/* A ruled journal page: every line of text sits on a rule, 34px apart. */
.daily-journal {
  --rule: 34px;
  position: relative;
  margin: 22px 0 14px;
  padding: calc(var(--rule) + 6px) 22px calc(var(--rule) - 6px) 46px;
  border-radius: 22px;
  text-align: center;
  background:
    linear-gradient(90deg, transparent 33px, rgba(110, 160, 220, 0.45) 33px 35px, transparent 35px),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--rule) - 1px), rgba(110, 160, 220, 0.24) calc(var(--rule) - 1px) var(--rule)),
    var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
}
.daily-journal p { margin: 0; line-height: var(--rule); }
.daily-journal::before {
  content: "";
  position: absolute;
  left: 12px;
  top: calc(var(--rule) * 1.5 - 5px);
  bottom: var(--rule);
  width: 10px;
  background: radial-gradient(circle, var(--paper-deep) 0 4px, var(--hairline-strong) 4px 5px, transparent 5.5px) center top / 10px calc(var(--rule) * 2) repeat-y;
}
.daily-sticker { position: absolute; top: -26px; right: -8px; width: 78px; height: auto; transform: rotate(8deg); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18)); }
.daily-journal .daily-journal-label { text-align: left; font: 600 0.74rem/var(--rule) var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.daily-journal .daily-word { font: 600 clamp(2.4rem, 11vw, 3.1rem)/calc(var(--rule) * 2) var(--display); color: var(--accent-ink); }
.daily-word mark { padding: 0 0.12em; color: inherit; background: linear-gradient(180deg, transparent 52%, rgba(233, 178, 58, 0.42) 52%, rgba(233, 178, 58, 0.42) 86%, transparent 86%); }
.daily-pos span { display: inline-block; padding: 0 14px; border-radius: 999px; background: var(--teal-wash); color: var(--teal-ink); font: 600 0.92rem/28px var(--body); vertical-align: 2px; }
.daily-journal .daily-meaning { font-size: 1.12rem; }
.daily-journal .daily-why { color: var(--muted); font-size: 0.98rem; }
.daily-source { margin: 0 0 4px; color: var(--muted); font-size: 0.9rem; }
.daily-practice { margin: 8px 0 0; color: var(--muted); font-size: 0.95rem; }
.daily-practice:empty { display: none; }
.daily-newer { margin: 16px 0 0; text-align: center; font-weight: 600; }
.daily-noscript { text-align: center; }

.daily-how { margin-top: 8px; }
.daily-how h2 { margin-top: 40px; }

@media (prefers-reduced-motion: reduce) {
  .daily-ring.pulse, .daily-slots.wrong, .daily-result.arrive, .daily-medal.stamp, .daily-cover.leaving, .daily-picture.arrive { animation: none; }
  .daily-story.telling span { transform: none; transition: opacity 0.2s linear; }
  .daily-tray.leaving { transition: none; }
}

@media (prefers-color-scheme: dark) {
  .daily-journal {
    background:
      linear-gradient(90deg, transparent 33px, rgba(110, 170, 220, 0.4) 33px 35px, transparent 35px),
      repeating-linear-gradient(180deg, transparent 0 calc(var(--rule) - 1px), rgba(110, 170, 220, 0.16) calc(var(--rule) - 1px) var(--rule)),
      var(--surface);
  }
}

/* A very short phone (picture under 220px wide): drop the start hint so the panel fits. */
@container (max-width: 220px) {
  .daily-start-hint { display: none; }
}
