/* Kickwise Daily Player board (assets/daily-player.js). Used full size on games/daily.html
   and compact (.kd--compact) as the cover of the home page. Needs assets/styles.css first. */

.kd {
  --kd-hit: var(--ok); --kd-hit-ink: #05170c;
  --kd-near: var(--warn); --kd-near-ink: #1f1500;
  --kd-gap: 6px; --kd-tile: 66px; --kd-big: 27px;
  display: flex; flex-direction: column; gap: 14px;
}
.kd--compact { --kd-gap: 4px; --kd-tile: 50px; --kd-big: 21px; gap: 10px; }
.kd:not(.kd--compact) { width: 100%; max-width: 640px; margin-inline: auto; }

/* ---------- Header (compact only) and practice bar ---------- */
.kd-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.kd-head b { font-family: var(--display); font-weight: 900; font-size: 24px; text-transform: uppercase; line-height: 1; }
.kd-head span { font-size: 13.5px; color: var(--muted); }
.kd-mode { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; padding: 10px 14px;
  border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent) 11%, var(--bg-2)); font-size: 14px; }
.kd-mode b { font-weight: 700; }
.kd-mode .linklike { min-height: 32px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; color: var(--text); }

/* ---------- Guess input with its suggestion list ---------- */
.kd-guess { display: flex; gap: 8px; }
.kd-combo { position: relative; flex: 1; min-width: 0; }
.kd-search { position: absolute; left: 16px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.kd-input {
  width: 100%; height: 52px; padding: 0 16px 0 44px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px; transition: border-color .15s;
}
.kd-input::placeholder { color: var(--muted); }
.kd-input:focus { outline: none; border-color: var(--accent); }
.kd-input:disabled { opacity: .5; }
.kd-go { height: 52px; padding: 0 22px; font-size: 16px; }
.kd--compact .kd-input, .kd--compact .kd-go { height: 46px; }
.kd-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  max-height: min(340px, 52vh); overflow-y: auto; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--line-strong); box-shadow: 0 22px 50px -16px rgba(0, 0, 0, .8);
}
.kd-list [role="option"] { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 9px;
  font-size: 15.5px; font-weight: 600; cursor: pointer; }
.kd-list [role="option"]:hover { background: var(--bg-2); }
.kd-list [role="option"][aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.kd-none { padding: 12px; font-size: 14px; color: var(--muted); }
.kd-msg { margin: -6px 0 0; min-height: 0; font-size: 14px; color: var(--warn); }
.kd-msg:empty { display: none; }

/* ---------- The board ---------- */
.kd-board { display: flex; flex-direction: column; gap: 6px; }
.kd-cols, .kd-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--kd-gap); }
.kd-cols span { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kd-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kd--compact .kd-rows { gap: 5px; }
.kd-row { display: flex; flex-direction: column; gap: 4px; }
.kd-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-height: 18px; padding: 0 2px; line-height: 1.2; }
.kd-name b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kd-name small { font-size: 12px; color: var(--muted); margin-left: auto; }
.kd--compact .kd-name { min-height: 16px; }
.kd--compact .kd-name b { font-size: 13px; }
.kd--compact .kd-empty .kd-name { display: none; }

.kd-tile {
  position: relative; height: var(--kd-tile); padding: 4px 3px; border-radius: 11px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); line-height: 1;
}
.kd-tile b { display: inline-flex; align-items: center; gap: 1px; font-family: var(--display); font-weight: 900;
  font-size: var(--kd-big); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.kd-tile small { max-width: 100%; font-size: 11px; font-weight: 600; line-height: 1.1; opacity: .82; overflow-wrap: anywhere; }
.kd--compact .kd-tile small { font-size: 10px; }
.kd-dir { width: .7em; height: .7em; }
.kd-tile.is-hit { background: var(--kd-hit); border-color: var(--kd-hit); color: var(--kd-hit-ink); }
.kd-tile.is-near { background: var(--kd-near); border-color: var(--kd-near); color: var(--kd-near-ink); }
.kd-tile.is-miss { background: var(--surface-2); border-color: var(--line-strong); }
.kd-tile.is-hit small, .kd-tile.is-near small { opacity: .9; }
button.kd-tile { font: inherit; cursor: pointer; }
button.kd-tile::after { content: ""; position: absolute; right: 6px; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
button.kd-tile[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--kd-near); }
.kd-empty .kd-tile { background: transparent; border: 1.5px dashed var(--line); }
.kd-common { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 2px; padding: 8px; border-radius: 10px; background: var(--bg-2); }
.kd-common span { padding: 4px 10px; border-radius: 999px; background: var(--kd-near); color: var(--kd-near-ink); font-size: 13px; font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  .kd-new .kd-tile { animation: kd-flip .5s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i) * 280ms); backface-visibility: hidden; }
  .kd-row.is-win:not(.kd-new) .kd-tile { animation: kd-hop .45s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i) * 70ms); }
  .kd-end { animation: kd-rise .4s cubic-bezier(.16, 1, .3, 1); }
}
@keyframes kd-flip { 0% { transform: perspective(500px) rotateX(-92deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
@keyframes kd-hop { 40% { transform: translateY(-7px); } }
@keyframes kd-rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Result ---------- */
.kd-end { padding: 22px 18px 20px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line-strong);
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.kd-end-head { margin: 0; font-size: 16px; font-weight: 700; color: var(--muted); }
.kd-end.is-won .kd-end-head { color: var(--ok); }
.kd-answer { margin: 0; font-family: var(--display); font-weight: 900; text-transform: uppercase; line-height: .9;
  font-size: clamp(44px, 11vw, 64px); letter-spacing: .005em; overflow-wrap: anywhere; }
.kd-answer small { display: block; font-family: var(--body); text-transform: none; font-size: 15px; font-weight: 600; letter-spacing: 0;
  color: var(--muted); margin-bottom: 6px; line-height: 1.2; }
.kd-facts { margin: 0; font-size: 14.5px; color: var(--text); }
.kd-path { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 2px 0 6px; max-width: 520px; }
.kd-path span { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 600; }
.kd-path .loan { border-style: dashed; }
.kd-path small { font-size: 10.5px; font-weight: 700; color: var(--warn); }
.kd-end .result-actions .btn { height: 48px; padding: 0 22px; }
.kd-end .result-actions .btn-primary { min-width: 150px; }
.kd-next { margin: 4px 0 0; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); }
.kd-next .kw-ico { width: 17px; height: 17px; }
.kd-next b { color: var(--text); font-family: var(--display); font-size: 20px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.kd-note { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }
.kd--compact .kd-end { padding: 16px 14px; gap: 8px; }
.kd--compact .kd-answer { font-size: 40px; }
.kd--compact .kd-path { display: none; }

.kd-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 14px; font-weight: 600;
  color: var(--text); text-decoration: none; }
.kd-link .kw-ico { width: 16px; height: 16px; transition: transform .15s; }
.kd-link:hover { color: var(--accent); }
.kd-link:hover .kw-ico { transform: translateX(3px); }

@media (max-width: 400px) {
  .kd { --kd-tile: 60px; --kd-big: 24px; --kd-gap: 5px; }
  .kd--compact { --kd-tile: 48px; --kd-big: 20px; }
  .kd-go { padding: 0 16px; }
  .kd-tile small { font-size: 10.5px; }
}

/* The answer's portrait, when we have one */
.kd-end .kd-face { width: 76px; height: 76px; margin: 0 0 12px; box-shadow: 0 0 0 3px var(--bg-2), 0 0 0 5px var(--accent); }

/* The home page cover (compact board): only the guesses made so far and the next empty row, not six empty rows */
.kd--compact .kd-empty ~ .kd-empty { display: none; }
