/* Shade Spotter (w039) */
.ss { display: grid; gap: 1rem; }
.ss > *, .ss section > * { min-width: 0; }
.ss .kit-status:empty { display: none; }
.ss-label { display: block; color: var(--muted); font-size: .85rem; font-weight: 700; line-height: 1.2; overflow-wrap: break-word; }

/* Start */
.ss-start { display: grid; gap: .6rem; }
.ss-start-actions { justify-content: center; }
.ss .ss-go { width: min(100%, 22rem); min-height: 56px; padding-inline: 2rem; font-size: 1.2rem; }
.ss-best { margin: 0; text-align: center; font-weight: 700; }

/* Play: header and lead are hidden so the clock and the whole grid fit on a phone screen. */
body.ss-playing .kit-top, body.ss-playing .kit-lead, body.ss-playing .kit-local, body.ss-playing #tool-title { display: none; }
body.ss-playing .kit-tool { padding: .5rem; }
.ss-play { display: grid; gap: .6rem; width: 100%; max-width: 600px; margin-inline: auto; }
.ss-hud { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .6rem; padding: .4rem .75rem; border: 2px solid var(--border); border-radius: .9rem; background: #0c1220; }
.ss-clock { position: relative; min-width: 0; }
.ss-clock-value { display: inline-flex; align-items: baseline; gap: .2rem; font-variant-numeric: tabular-nums; }
.ss-clock-value strong { font-size: 2.4rem; line-height: 1; font-weight: 900; }
.ss-clock-value small { color: var(--muted); font-size: 1rem; font-weight: 700; }
.ss-clock[data-hurry="true"] .ss-label { color: #ffd36e; }
.ss-clock[data-hurry="true"] strong { color: #ffd36e; animation: ss-pulse 1s ease-in-out infinite; }
.ss-hud:has(.ss-clock[data-hurry="true"]) { border-color: #ffd36e; }
.ss-stat { text-align: center; }
.ss-stat strong { display: block; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ss .ss-pause { min-height: 48px; }
.ss-penalty { position: absolute; z-index: 2; top: -.75rem; left: 0; right: 0; width: max-content; margin-inline: auto; padding: 0 .7rem; border: 2px solid #3a0d06; border-radius: .6rem; background: var(--danger); color: #3a0d06; font-size: 1.3rem; font-weight: 900; white-space: nowrap; opacity: 0; pointer-events: none; }
.ss-clock[data-hit="true"] strong { color: var(--danger); }
.ss-penalty.show { animation: ss-penalty 1s ease-out forwards; }

.ss-stage { position: relative; display: grid; justify-items: center; }
.ss-grid { --size: 2; display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); grid-template-rows: repeat(var(--size), minmax(0, 1fr)); gap: clamp(4px, 1vw, 7px); width: min(100%, 560px, max(300px, calc(100svh - 190px))); aspect-ratio: 1; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.ss .ss-tile { display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: clamp(.35rem, 1.5vw, .7rem); color: #fff; font-size: 1.6rem; font-weight: 900; text-shadow: 0 0 3px #000, 0 0 6px #000; cursor: pointer; }
/* Same look for every tile on hover; focus is a white ring with a dark halo so it shows on light and dark tiles. */
.ss .ss-tile:hover:not(:disabled) { border: 0; }
.ss .ss-tile:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px #000; position: relative; z-index: 1; }
.ss .ss-tile[data-wrong="true"] { outline: 3px dashed var(--danger); outline-offset: -3px; }
.ss-grid.shake { animation: ss-shake .35s ease-in-out; }
.ss-paused { display: grid; gap: .75rem; justify-items: center; width: min(100%, 560px); padding: 2rem 1rem; border: 2px dashed var(--border); border-radius: 1rem; text-align: center; }
.ss-paused p { margin: 0; font-weight: 700; }
.ss-paused .kit-note { font-weight: 500; }
.ss-paused-actions { justify-content: center; }
.ss-paused-actions button { min-height: 48px; }

/* Result */
.ss-result { display: grid; gap: .6rem; padding: 1.25rem; border: 2px solid var(--accent); border-radius: 1rem; background: #13231f; text-align: center; }
.ss-result h2 { margin: 0; font-size: clamp(1.4rem, 6vw, 2rem); }
.ss-final { margin: 0; }
.ss-final strong { display: block; font-size: clamp(3rem, 16vw, 4.5rem); line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; }
.ss-new { margin: 0; color: #ffd36e; font-size: 1.15rem; font-weight: 800; }
.ss-result-best { margin: 0; font-weight: 700; }
.ss-result-actions { justify-content: center; }
.ss-result-actions button { min-height: 52px; }

/* How to play */
.ss-how { border: 1px solid var(--border); border-radius: .85rem; background: #0c1220; }
.ss-how summary { display: flex; align-items: center; min-height: 48px; padding: .5rem 1rem; cursor: pointer; font-weight: 700; }
.ss-how-body { display: grid; gap: .6rem; padding: 0 1rem 1rem; }
.ss-how-body p { margin: 0; }
.ss-example-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .9rem; padding: .75rem; border-radius: .7rem; background: var(--card); }
.ss-example { display: grid; grid-template-columns: repeat(3, 30px); gap: 4px; }
.ss-example-tile { display: grid; place-items: center; width: 30px; height: 30px; border-radius: .3rem; color: #fff; font-weight: 900; text-shadow: 0 0 3px #000; }
@media (max-width: 380px) {
  .ss-example-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
}

.ss-records { display: grid; gap: .5rem; padding: 1rem; border: 1px solid var(--border); border-radius: .85rem; }
.ss-records h2 { margin: 0; }

@keyframes ss-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
@keyframes ss-penalty {
  0% { opacity: 0; transform: translateY(4px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes ss-pulse { 50% { opacity: .55; } }
@keyframes ss-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ss-grid.shake { animation: none; }
  .ss-clock[data-hurry="true"] strong { animation: none; }
  .ss-penalty.show { animation: ss-fade 1s linear forwards; }
}
