/* The newer mini-games (public/js/games.js) and the secrets toast (public/js/eggs.js).
   Phone-first, like game.css; it uses that file's colours and fonts.
   Every class here starts with its game: ck- password cracker, tn- radio dial, pp- pairs, ee- secrets. */

/* ------------------------------------------------------------------ crack: pick the password */
.ck-term {
  position: relative; width: 100%; max-width: 440px; padding: 10px; border-radius: 8px; overflow: hidden;
  background: #020805; border: 1px solid #1f6b43; color: var(--green); font-family: var(--mono);
  box-shadow: inset 0 0 34px rgba(61, 255, 143, .08), 0 0 18px rgba(61, 255, 143, .08);
}
.ck-term::after { /* scanlines */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .22) 2px 3px);
}
.ck-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px dashed #1f6b43; font: 11px var(--pixel); letter-spacing: .04em; }
.ck-tries { display: flex; gap: 4px; flex: none; }
.ck-tries i { width: 11px; height: 14px; border: 1px solid #1f6b43; }
.ck-tries i.on { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px rgba(61, 255, 143, .6); }
.ck-tries.low i.on { background: var(--red); border-color: var(--red); box-shadow: 0 0 8px rgba(255, 77, 94, .7); animation: ckBlink .8s steps(2) infinite; }
.ck-words { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ck-word {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 6px; min-height: 48px; padding: 4px 8px;
  text-align: left; color: var(--green); background: #04110a; border: 1px solid #14442b; border-radius: 4px;
}
.ck-word .ck-addr { grid-column: 1 / -1; font-size: 10px; line-height: 1.2; color: #2f8f5c; letter-spacing: .06em; }
.ck-word .ck-text { font-size: 17px; line-height: 1.25; letter-spacing: .14em; white-space: nowrap; }
.ck-word .ck-like { font: 12px var(--pixel); color: var(--yellow); }
.ck-word .key { display: none; font: 10px var(--pixel); color: #2f8f5c; border: 1px solid #14442b; border-radius: 3px; padding: 0 4px; }
.ck-word:hover:not(:disabled) { border-color: var(--green); }
.ck-word.sel { background: var(--green); border-color: var(--green); color: #021; box-shadow: 0 0 14px rgba(61, 255, 143, .5); }
.ck-word.sel .ck-addr, .ck-word.sel .key { color: #063; border-color: #063; }
.ck-word.tried { color: #2f6b4b; background: transparent; border-style: dashed; }
.ck-word.tried .ck-text { text-decoration: line-through; }
.ck-log { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #1f6b43; font-size: 13.5px; display: grid; gap: 3px; }
.ck-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ck-line.dim { color: #2f8f5c; }
.ck-line.new { animation: ckIn .5s steps(6); }
.ck-letters { letter-spacing: .14em; white-space: nowrap; }
.ck-letters .lit { color: #021; background: var(--yellow); box-shadow: 0 0 8px rgba(255, 210, 63, .6); }
.ck-pips { display: inline-flex; gap: 3px; }
.ck-pips i { width: 7px; height: 11px; border: 1px solid #1f6b43; }
.ck-pips i.on { background: var(--yellow); border-color: var(--yellow); }
.ck-count { font-size: 12px; color: var(--yellow); }
.ck-cursor { letter-spacing: .14em; min-height: 1.4em; }
.ck-cursor b { font-weight: 400; animation: ckBlink 1s steps(2) infinite; }
@keyframes ckBlink { 50% { opacity: 0; } }
@keyframes ckIn { from { opacity: 0; transform: translateX(-8px); } }

/* ------------------------------------------------------------------ tune: find the signal */
.tn-radio {
  width: 100%; max-width: 440px; padding: 12px; border-radius: 10px; display: grid; gap: 10px;
  background: linear-gradient(#15151f, #0c0c14); border: 1px solid var(--line); box-shadow: inset 0 1px 0 #2c2c44;
}
.tn-freq { text-align: center; font-size: 30px; line-height: 1.1; color: var(--orange); text-shadow: 0 0 14px rgba(255, 138, 61, .55); }
.tn-freq small { font-size: 13px; color: var(--dim); text-shadow: none; }
.tn-band {
  position: relative; height: 58px; border-radius: 6px; border: 2px solid var(--line); overflow: hidden; cursor: ew-resize; touch-action: none;
  background:
    repeating-linear-gradient(to right, rgba(154, 153, 181, .35) 0 1px, transparent 1px 10%),
    repeating-linear-gradient(to right, rgba(154, 153, 181, .16) 0 1px, transparent 1px 2%),
    #06060a;
}
.tn-tick { position: absolute; bottom: 0; width: 5px; margin-left: -2.5px; border-radius: 2px 2px 0 0; background: var(--c, #54536b); box-shadow: 0 0 8px var(--c, transparent); height: 14%; }
.tn-tick.s1 { --c: #5b6cff; height: 28%; } .tn-tick.s2 { --c: var(--cyan); height: 44%; } .tn-tick.s3 { --c: var(--yellow); height: 60%; }
.tn-tick.s4 { --c: var(--orange); height: 78%; } .tn-tick.s5 { --c: var(--pink); height: 96%; }
.tn-tick.last { animation: tnRise .45s ease-out; }
.tn-needle { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 10px #fff, 0 0 4px var(--orange); pointer-events: none; }
.tn-needle::before { content: ''; position: absolute; top: 0; left: -5px; border: 6.5px solid transparent; border-top-color: var(--orange); }
.tn-row { display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; align-items: center; }
.tn-nudge { height: 48px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-size: 18px; }
.tn-nudge:active { background: var(--orange); color: #000; }
.tn-slider { width: 100%; height: 48px; margin: 0; accent-color: var(--orange); background: transparent; }
.tn-meter { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.tn-bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 30px; flex: none; }
.tn-bars i { width: 8px; border-radius: 2px; background: #23233a; }
.tn-bars i:nth-child(1) { height: 30%; } .tn-bars i:nth-child(2) { height: 45%; } .tn-bars i:nth-child(3) { height: 62%; }
.tn-bars i:nth-child(4) { height: 80%; } .tn-bars i:nth-child(5) { height: 100%; }
.tn-bars i.on { background: var(--green); box-shadow: 0 0 8px rgba(61, 255, 143, .6); }
.tn-bars.s1 i.on, .tn-bars.s2 i.on { background: var(--cyan); box-shadow: 0 0 8px rgba(0, 255, 249, .5); }
.tn-bars.s5 i.on { background: var(--pink); box-shadow: 0 0 10px rgba(255, 46, 136, .7); }
.tn-meter.fresh .tn-bars i.on { animation: tnRise .4s ease-out backwards; }
.tn-meter.fresh .tn-bars i:nth-child(2) { animation-delay: .06s; } .tn-meter.fresh .tn-bars i:nth-child(3) { animation-delay: .12s; }
.tn-meter.fresh .tn-bars i:nth-child(4) { animation-delay: .18s; } .tn-meter.fresh .tn-bars i:nth-child(5) { animation-delay: .24s; }
.tn-said { font-size: 13.5px; line-height: 1.35; }
.tn-said b { font: 12px var(--pixel); white-space: nowrap; }
.tn-said b.good { color: var(--green); } .tn-said b.bad { color: var(--red); }
.tn-hear { font-size: 13px; line-height: 1.5; color: var(--cyan); background: #06060a; border: 1px dashed var(--line); border-radius: 6px; padding: 6px 8px; word-break: break-word; letter-spacing: .04em; }
@keyframes tnRise { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }

/* ------------------------------------------------------------------ pairs: match them all */
.pp-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 8px; width: min(100%, 340px); perspective: 700px; }
.pp-card {
  aspect-ratio: 1; padding: 0; border-radius: 10px; font-size: clamp(22px, 8vw, 32px); line-height: 1;
  border: 2px solid var(--line); color: transparent;
  background: repeating-linear-gradient(135deg, #1b1b2b 0 8px, #15152a 8px 16px);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.pp-card span { display: block; }
.pp-card:hover:not(:disabled) { border-color: var(--cyan); }
.pp-card:active:not(:disabled) { transform: scale(.94); }
.pp-card.cur { outline: 2px solid var(--yellow); outline-offset: 2px; }
.pp-card.open { background: #06262a; border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 16px rgba(0, 255, 249, .4); animation: ppFlip .28s ease-out; }
.pp-card.done { background: #0e3a22; border-color: #1f6b43; color: var(--green); }
.pp-card.done.new { animation: ppMatch .6s ease-out; }
.pp-card.wrong { background: #3a0e16; border-color: var(--red); color: var(--red); animation: ppWrong .4s ease-out; }
@keyframes ppFlip { from { transform: rotateY(90deg); } }
@keyframes ppMatch { 0% { transform: scale(1); box-shadow: 0 0 0 var(--green); } 40% { transform: scale(1.1); box-shadow: 0 0 26px var(--green); border-color: var(--green); } 100% { transform: scale(1); } }
@keyframes ppWrong { 0% { transform: rotateY(90deg); } 40% { transform: rotateY(0) translateX(-4px); } 60% { transform: translateX(4px); } 80% { transform: translateX(-2px); } }

/* ------------------------------------------------------------------ secrets */
.toast.ee-toast {
  width: 100%; color: var(--text); border-color: var(--pink); background: #170a14f0;
  box-shadow: 0 0 22px rgba(255, 46, 136, .45), inset 0 0 18px rgba(0, 255, 249, .08);
  animation: toastIn .25s ease-out, eeShine 1.6s ease-in-out 2, toastOut .35s ease-in forwards; animation-delay: 0s, .2s, var(--life, 2.6s);
}
.toast.ee-toast b { display: block; font-size: 12px; letter-spacing: .06em; color: var(--pink); }
.toast.ee-toast b i { font-style: normal; color: var(--cyan); }
.toast.ee-toast small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--dim); }
@keyframes eeShine { 50% { border-color: var(--cyan); box-shadow: 0 0 26px rgba(0, 255, 249, .5), inset 0 0 18px rgba(255, 46, 136, .12); } }
.ee-knock { animation: eeKnock .18s ease-out !important; }
@keyframes eeKnock { 30% { transform: translate(3px, -2px) rotate(1.2deg); filter: brightness(1.6); } 70% { transform: translate(-2px, 1px) rotate(-.8deg); } }

@media (min-width: 900px) {
  .ck-word .key { display: inline-block; }
  .ck-word .ck-text { font-size: 18px; }
}
@media (max-width: 359px) {
  .ck-word .ck-text { font-size: 15px; letter-spacing: .08em; }
}
