/* Ranked */

/* iPhone notch / home-bar safe areas */
.dg-header {
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
.dg-main {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
html { -webkit-text-size-adjust: 100%; }
.rk-noselect, .rk-noselect * { -webkit-user-select: none; user-select: none; cursor: grabbing; }
.rk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rk-noscript { max-width: 520px; margin: 40px auto; padding: 16px; text-align: center; }

/* progress */
.rk-progress { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 10px; }
.rk-pills { display: flex; gap: 6px; }
.rk-pill {
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent;
}
.rk-pill.cur { border-color: var(--accent); color: var(--text); }
.rk-pill.won { background: color-mix(in srgb, var(--good) 28%, var(--surface-2)); color: var(--text); }
.rk-pill.lost { background: color-mix(in srgb, var(--bad) 22%, var(--surface-2)); color: var(--text); }
.rk-score { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rk-score b { color: var(--text); font-size: 18px; }

/* what to rank by */
.rk-cat {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
}
.rk-cat-emoji { font-size: 34px; line-height: 1; flex: none; }
.rk-cat-body { min-width: 0; }
.rk-cat-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent); }
.rk-cat-measure { margin: 1px 0 3px; font-size: 19px; line-height: 1.2; font-weight: 800; }
.rk-cat-measure:focus { outline: none; }
.rk-cat-dir { font-size: 13px; color: var(--muted); }
.rk-cat-dir b { color: var(--text); font-weight: 700; white-space: nowrap; }

/* tries strip: three slots, always the same height so nothing jumps */
.rk-tries { display: flex; justify-content: space-between; gap: 6px; margin: 10px 0 2px; }
.rk-try {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 4px; border-radius: 9px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; min-width: 0;
}
.rk-try.next { box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.rk-try.pending .rk-try-sq i { background: var(--border); }
.rk-try-sq { display: inline-flex; gap: 2px; }
.rk-try-sq i { width: 11px; height: 11px; border-radius: 3px; background: var(--border); opacity: .6; }
.rk-try.used .rk-try-sq i { opacity: 1; }
.rk-try-sq i.fb-g { background: var(--good); }
.rk-try-sq i.fb-y { background: var(--ok); }
.rk-try-sq i.fb-x { background: color-mix(in srgb, var(--muted) 55%, var(--surface-2)); }

/* end labels */
.rk-end { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; }
.rk-end::after { content: ''; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.rk-end-bottom { margin: 6px 0 0; }
.rk-end-pill {
  font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent); padding: 3px 10px; border-radius: 999px;
}

/* cards */
.rk-list {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; position: relative;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.rk-card {
  --fbc: transparent;
  position: relative; display: flex; align-items: center; gap: 8px; height: 68px; padding: 0 6px 0 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: pan-y; cursor: grab;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .15s, background .2s;
}
.rk-card.fb-g { --fbc: var(--good); }
.rk-card.fb-y { --fbc: var(--ok); }
.rk-card.fb-g, .rk-card.fb-y {
  background: color-mix(in srgb, var(--fbc) 16%, var(--surface)); border-color: color-mix(in srgb, var(--fbc) 65%, var(--border));
}
.rk-card.fb-x { background: var(--surface-2); }
.rk-card.locked { cursor: default; }
.rk-card.pressing { background: var(--surface-2); transform: scale(.985); }
.rk-card.dragging {
  z-index: 5; transition: box-shadow .15s; box-shadow: var(--shadow), 0 0 0 2px var(--accent); cursor: grabbing;
}
.rk-list.is-dragging .rk-card:not(.dragging) { transition: transform .16s cubic-bezier(.3,1.3,.6,1); }

/* the handle: a wide, obvious strip on the left edge */
.rk-grip {
  flex: none; align-self: stretch; width: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 13px 0 0 13px; background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-right: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  color: color-mix(in srgb, var(--accent) 75%, var(--text)); touch-action: none; cursor: grab;
}
.rk-grip-dots { font-size: 24px; line-height: 1; font-weight: 700; }
.rk-card:hover .rk-grip { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.rk-card.locked .rk-grip { background: none; border-right-color: transparent; cursor: default; }
.rk-card.locked .rk-grip-dots { font-size: 15px; }
.rk-emoji { position: relative; flex: none; font-size: 30px; line-height: 1; width: 36px; text-align: center; }
.rk-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rk-name {
  font-weight: 800; font-size: 16px; line-height: 1.15; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere;
}
.rk-desc { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-btns { flex: none; display: flex; gap: 4px; }
.rk-mv {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 18px; font-weight: 800; cursor: pointer; color: var(--text); touch-action: manipulation;
}
.rk-mv:disabled { opacity: .25; cursor: default; }
.rk-mv:not(:disabled):active { transform: scale(.94); }
.rk-mv:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* feedback chip: colour + symbol, so it reads without colour vision too */
.rk-chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 999px; font: 800 11px/1 system-ui, -apple-system, sans-serif; font-style: normal; color: #10131a;
  background: color-mix(in srgb, var(--muted) 60%, var(--surface-2));
}
.rk-chip.fb-g { background: var(--good); }
.rk-chip.fb-y { background: var(--ok); }
.rk-chip.fb-x { color: var(--text); }
.rk-emoji .rk-chip { position: absolute; right: -4px; bottom: -8px; box-shadow: 0 0 0 2px var(--surface); }

@keyframes rk-flip {
  0% { transform: rotateX(0); background: var(--surface); border-color: var(--border); }
  49% { transform: rotateX(90deg); background: var(--surface); border-color: var(--border); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}
@keyframes rk-chip-in { 0%, 50% { opacity: 0; transform: scale(.4); } 100% { opacity: 1; transform: scale(1); } }
.rk-card.flip { animation: rk-flip .44s ease both; animation-delay: var(--d, 0ms); }
.rk-card.flip .rk-chip { animation: rk-chip-in .44s ease both; animation-delay: var(--d, 0ms); }

.rk-submit { margin-top: 14px; }

/* reveal */
.rk-reveal { margin-top: 12px; }
.rk-verdict { text-align: center; padding: 10px; border-radius: 12px; font-size: 16px; }
.rk-verdict.won { background: color-mix(in srgb, var(--good) 20%, var(--surface)); }
.rk-verdict.lost { background: color-mix(in srgb, var(--bad) 16%, var(--surface)); }
.rk-rev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rk-rev-item {
  display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) auto auto; column-gap: 8px; row-gap: 4px; align-items: center;
  padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
}
.rk-rev-n {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.rk-rev-item .rk-emoji { font-size: 26px; width: 30px; }
.rk-rev-main { min-width: 0; display: flex; flex-direction: column; }
.rk-rev-main .rk-name { display: block; font-size: 15px; }
.rk-rev-main .rk-desc { white-space: normal; }
.rk-val {
  justify-self: end; min-width: 5.5em; text-align: right; font-weight: 800; font-size: 15px; color: var(--text);
  font-variant-numeric: tabular-nums; white-space: nowrap; padding: 3px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
}
.rk-fact { grid-column: 3 / -1; font-size: 13px; color: var(--muted); line-height: 1.35; }

/* finished */
.rk-final { text-align: center; padding: 18px 16px; }
.rk-final-kicker { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.rk-final-score { font-size: 48px; line-height: 1.05; font-weight: 900; margin: 2px 0; font-variant-numeric: tabular-nums; }
.rk-final-title { font-size: 18px; font-weight: 800; }
.rk-final .dg-share-preview {
  display: inline-block; text-align: left; margin: 12px auto 0; white-space: pre-wrap; max-width: 100%;
  font-size: 15px; line-height: 1.5;
}
.rk-share { font-size: 17px; padding: 14px 18px; }
.rk-final .rk-stats-btn { margin-top: 8px; padding: 10px 18px; font-size: 15px; }
.rk-final .dg-next { margin-top: 12px; }

.rk-more { margin-top: 18px; }
.rk-more h3, .rk-review-h {
  margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 800;
}
.rk-more-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rk-more-game {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; min-width: 0;
}
.rk-more-game:hover { border-color: var(--accent); }
.rk-more-icon { font-size: 24px; line-height: 1.1; }
.rk-more-game strong { font-size: 14px; }
.rk-more-tag { font-size: 11px; line-height: 1.25; color: var(--muted); }

.rk-review-h { margin: 26px 0 0; display: flex; flex-direction: column; gap: 2px; text-transform: none; letter-spacing: 0; }
.rk-review-k { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; }
.rk-review-m { font-size: 16px; color: var(--text); }

/* how-to modal */
.rk-how-lead { font-size: 16px; }
.rk-how-steps { padding-left: 20px; }
.rk-how-steps li { margin: 8px 0; }
.rk-how-grip { display: inline-block; padding: 0 5px; border-radius: 5px; background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); font-weight: 800; }
.rk-how-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-size: 14px; }
.rk-how-legend span { display: flex; align-items: center; gap: 8px; }

@media (max-width: 400px) {
  .rk-name { font-size: 15px; }
  .rk-cat-measure { font-size: 18px; }
  .rk-try-w { display: none; }
}
@media (max-width: 360px) {
  .rk-emoji { font-size: 26px; width: 30px; }
  .rk-mv { width: 40px; }
  .rk-grip { width: 34px; }
  .rk-name { font-size: 14px; }
  .rk-rev-item { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
  .rk-rev-item .rk-emoji { display: none; }
  .rk-fact { grid-column: 2 / -1; }
}

/* keep the archive banner off the screen edges on phones */
@media (max-width: 592px) { .dg-banner { margin-left: 16px; margin-right: 16px; } }
