/* Ordjakt. shared/styles.css carries tokens, base and shared components. */

:root {
  --game: #C3D36F;
  --game-ink: #1a1817;
}

main.oj {
  max-width: 520px;
  margin: 0 auto;
  padding: 22px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- Progress ---------- */

.oj-progress { display: flex; flex-direction: column; gap: 8px; }
.oj-progress-text {
  font-size: 14px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.oj-progress-text strong { color: var(--ink); font-size: 18px; font-weight: 700; }
.oj-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.oj-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--game);
  transition: width 320ms var(--ease);
}

/* ---------- Current word ---------- */

.oj-word {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line);
  padding-bottom: 6px;
  overflow-wrap: anywhere;
}
.oj-word::after {
  content: "";
  width: 2px;
  height: 0.9em;
  margin-left: 4px;
  background: var(--ink);
  animation: oj-caret 1s steps(1) infinite;
}
.oj-word:empty::before {
  content: attr(data-placeholder);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-faint);
}
.oj-word:empty::after { display: none; }
@keyframes oj-caret { 50% { opacity: 0; } }

.oj-word.shake { animation: oj-shake 360ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.oj-word.good { color: var(--positive); }
@keyframes oj-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ---------- Letter tiles ---------- */

.oj-tiles {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.oj-tile {
  aspect-ratio: 1;
  min-width: 0;
  border: none;
  border-radius: 10px;
  background: var(--game);
  color: var(--game-ink);
  font-family: var(--font-num);
  font-size: clamp(22px, 6.4vw, 30px);
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
  transition: transform 70ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.oj-tile:hover { filter: brightness(1.04); }
.oj-tile:active, .oj-tile.press { transform: translateY(2px) scale(0.96); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.14); }
.oj-tiles.shuffling .oj-tile { animation: oj-flip 260ms ease; }
@keyframes oj-flip {
  0% { transform: scale(1); opacity: 1; }
  45% { transform: scale(0.6); opacity: 0.2; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Controls ---------- */

.oj-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.oj-controls .action-btn { padding: 12px 22px; font-size: 15px; justify-content: center; }
.oj-controls .oj-shuffle { padding: 12px 14px; }

/* ---------- Found words ---------- */

.oj-found-wrap {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.oj-found-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.oj-found-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.oj-link {
  border: none;
  background: none;
  padding: 4px 0;
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.oj-link:hover { color: var(--ink); }
.oj-empty { margin: 0; font-size: 14px; color: var(--ink-faint); }

.oj-found {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 3;
  column-gap: 16px;
}
.oj-found li {
  break-inside: avoid;
  padding: 5px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.oj-found li::first-letter { text-transform: uppercase; }
.oj-found li.all { font-weight: 700; }
.oj-found li.all::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--game);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent);
  vertical-align: middle;
}
.oj-found li.missed { color: var(--ink-faint); }
.oj-found li.fresh { animation: oj-in 500ms var(--ease); }
@keyframes oj-in {
  0% { background: color-mix(in srgb, var(--game) 55%, transparent); }
  100% { background: transparent; }
}

/* ---------- Finished / revealed ---------- */

body.is-over .oj-tiles,
body.is-over .oj-controls,
body.is-over .oj-word { opacity: 0.45; pointer-events: none; }
body.is-over .oj-word::after { display: none; }
body.is-over .oj-link { display: none; }

.oj-missing { text-align: center; align-items: center; }

.oj-credit { margin: 14px 0 0; font-size: 12px; color: var(--ink-faint); }

@media (max-width: 480px) {
  main.oj { padding: 16px 12px 32px; gap: 16px; }
  .oj-tiles { gap: 6px; }
  .oj-found { columns: 2; }
}
