/* Kakuro — parchment cells set in a dark clue lattice. */

[hidden] { display: none !important; }

.kk-frame {
  width: min(620px, 96vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(10px, 2.2vw, 18px);
}
.deal-line {
  margin: 0;
  text-align: center;
  font-family: var(--hand);
  font-style: italic;
  font-size: clamp(14px, 2.1vw, 16.5px);
  color: var(--ink-soft);
  min-height: 1.4em;
}
.deal-line b { color: var(--oxblood); font-weight: 600; }

/* ---- the grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  aspect-ratio: 1;
  width: 100%;
  gap: 1px;
  padding: 2px;
  background: rgba(31, 26, 18, .9);
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px rgba(200, 156, 58, .35), 0 3px 10px rgba(0, 0, 0, .3);
  overflow: hidden;
}
.cell {
  position: relative;
  display: grid;
  place-items: center;
  border: none;
  padding: 0;
  font-family: var(--display);
  font-size: clamp(15px, 3vw, 25px);
  border-radius: 2px;
}
.cell.white {
  background: linear-gradient(180deg, var(--cream), #efe3c2);
  color: var(--oxblood);
  cursor: pointer;
}
.cell.clue {
  background:
    linear-gradient(to top right, transparent calc(50% - 0.75px), rgba(241, 230, 200, .35) calc(50% - 0.75px), rgba(241, 230, 200, .35) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    linear-gradient(180deg, rgba(45, 38, 27, .98), rgba(31, 26, 18, .98));
  cursor: default;
}
.cell.clue.mute-cell { background: linear-gradient(180deg, rgba(45, 38, 27, .98), rgba(31, 26, 18, .98)); }
.clue-a, .clue-d {
  position: absolute;
  font-family: var(--caps);
  font-weight: 700;
  font-size: clamp(9px, 1.8vw, 13px);
  color: rgba(241, 230, 200, .92);
  line-height: 1;
  pointer-events: none;
}
.clue-a { top: 14%; right: 10%; }
.clue-d { bottom: 14%; left: 10%; }

.cell.given { color: var(--ink); font-weight: 600; }
.cell.sel { background: rgba(227, 183, 84, .45); }
.cell.kin { background: rgba(227, 183, 84, .22); }
.cell.bad { color: var(--oxblood-bright); background: rgba(158, 43, 37, .2); }
.cell.hint-flash { animation: kk-hint 1s ease 2; }
@keyframes kk-hint {
  0%, 100% { background: linear-gradient(180deg, var(--cream), #efe3c2); }
  50% { background: rgba(122, 176, 132, .55); }
}

.marks {
  position: absolute;
  inset: 8%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
}
.marks span {
  font-family: var(--display);
  font-size: clamp(7.5px, 1.5vw, 11px);
  color: rgba(94, 27, 32, .75);
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ---- the pad ---- */
.pad-row { display: flex; justify-content: center; }
.pad {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 6px;
  width: 100%;
}
.pad-key {
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  border: 1.5px solid rgba(122, 104, 80, .5);
  background: linear-gradient(180deg, var(--cream), #efe3c2);
  font-family: var(--display);
  font-size: clamp(15px, 2.6vw, 22px);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  transition: transform .1s var(--ease);
}
.pad-key:hover { transform: translateY(-2px); }
.pad-key[aria-pressed="true"] { background: var(--oxblood); color: var(--parchment); border-color: var(--oxblood); }

.frame-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.help-body { text-align: left; font-size: 15.5px; line-height: 1.55; color: var(--ink-soft); }
.help-body p { margin: 0 0 12px; }
.help-body b { color: var(--oxblood); }

.new-best {
  display: inline-block;
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11.5px;
  color: var(--parchment);
  background: var(--oxblood);
  border-radius: 5px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: 1px;
}

@media (max-width: 560px) {
  .pad { grid-template-columns: repeat(6, 1fr); }
  .pad-key { aspect-ratio: 5 / 4; }
}
