/* The Daily Mini — Manu Arcade No. XXXIII.
   Game-specific styling only; chrome + tokens come from _shared/palette.css.
   The grid is a DOM grid of parchment cells (ink letters in Garamond, gold
   corner numbers). A small Canvas2D overlay carries the gilded solve flourish. */

.play {
  display: flex;
  gap: clamp(14px, 3vw, 30px);
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}

/* ---- the framed grid ---------------------------------------------------- */

.board-frame { flex: 0 0 auto; }

.grid-wrap {
  position: relative;
  /* sized in JS to keep cells square; falls back to a sensible square */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 0;
  background: var(--ink-rule);
  border: 2px solid var(--ink-rule);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(58, 46, 34, .28);
}

.cell {
  position: relative;
  background: var(--cream);
  display: grid;
  place-items: center;
  outline: 1px solid rgba(122, 104, 80, .55);
  outline-offset: -0.5px;
  cursor: pointer;
  overflow: hidden;
  transition: background .14s var(--ease);
}
.cell.block {
  background: var(--ink);
  cursor: default;
}
.cell.in-word { background: var(--parchment-deep); }
.cell.active {
  background: var(--gold-bright);
  box-shadow: inset 0 0 0 2px var(--gold-deep);
}

.cell .num {
  position: absolute;
  top: 2px; left: 3px;
  font-family: var(--caps);
  color: var(--gold-deep);
  line-height: 1;
  pointer-events: none;
}

.cell .letter {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  transform: translateY(.04em);
}
.cell.active .letter { color: var(--oxblood-deep); }
.cell.wrong .letter { color: var(--oxblood-bright); }
.cell.wrong { background: rgba(122, 34, 40, .16); }
.cell.revealed .letter { color: var(--gold-deep); }

/* a little pop when a letter is typed in */
.cell.just-typed .letter { animation: pop .22s var(--ease); }
@keyframes pop {
  0% { transform: translateY(.04em) scale(.4); opacity: .2; }
  60% { transform: translateY(.04em) scale(1.18); }
  100% { transform: translateY(.04em) scale(1); }
}

.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 4px;
}

/* ---- the active-clue banner -------------------------------------------- */

.clue-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(640px, 96vw);
  margin: 0;
  padding: 12px 16px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(0,0,0,.03)), var(--parchment-warm);
  box-shadow: inset 0 0 0 1px rgba(200,156,58,.5), 0 4px 12px rgba(58,46,34,.16);
  min-height: 52px;
  cursor: pointer;
}
.clue-tag {
  flex: 0 0 auto;
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 12px;
  color: var(--parchment);
  background: var(--oxblood);
  padding: 5px 9px;
  border-radius: 5px;
  white-space: nowrap;
}
.clue-text {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(17px, 2.6vw, 22px);
  color: var(--ink);
  line-height: 1.2;
}

/* ---- the clue lists ----------------------------------------------------- */

.clue-lists {
  display: flex;
  gap: clamp(14px, 3vw, 28px);
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 460px;
}
.clue-col { flex: 1 1 0; min-width: 0; }
.clue-head {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 13px;
  color: var(--oxblood);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(122,104,80,.3);
}
.clue-ol {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.clue-li {
  display: flex;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.25;
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.clue-li:hover { background: rgba(122,104,80,.1); }
.clue-li.active {
  background: var(--oxblood);
  color: var(--parchment);
}
.clue-li.active .clue-li-num { color: var(--gold-bright); }
.clue-li.done .clue-li-text { color: var(--ink-light); text-decoration: line-through; text-decoration-color: rgba(122,104,80,.5); }
.clue-li-num {
  flex: 0 0 auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold-deep);
  min-width: 1.4em;
  text-align: right;
}

/* ---- on-screen keyboard (touch) ---------------------------------------- */

.keyboard {
  display: none;
  width: min(640px, 99vw);
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}
.keyboard.show { display: flex; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1 1 0;
  min-width: 0;
  height: 46px;
  border: 1px solid rgba(122,104,80,.4);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--cream), var(--parchment-deep));
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 2px 0 rgba(122,104,80,.45);
  transition: transform .06s var(--ease), filter .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.key:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(122,104,80,.45); filter: brightness(.96); }
.key.wide { flex: 1.6 1 0; font-family: var(--caps); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }

/* ---- responsive --------------------------------------------------------- */

@media (max-width: 720px) {
  .play { flex-direction: column; align-items: center; }
  .clue-lists { max-width: 96vw; width: 96vw; }
}
@media (max-width: 480px) {
  /* On phones, hide the long clue lists: the banner + tap-to-cycle is enough,
     and the on-screen keyboard appears. Lists return at >480px. */
  .clue-lists { display: none; }
}

/* show the touch keyboard when there is no fine pointer (touch devices) */
@media (hover: none) and (pointer: coarse) {
  .keyboard.enabled { display: flex; }
}
