/* =========================================================
   Onur Ozan Sünger — "LAB"
   Four unbeatable games. Same NETWORK system.
   You = azure · the AI = red adversary.
   ========================================================= */

.lab-main { position: relative; z-index: 3; padding-top: 7rem; min-height: 100vh; }
.lab-hero { max-width: var(--maxw); margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) var(--pad) 1rem; }
.lab-title { font-family: var(--f-disp); font-weight: 600; font-size: clamp(2.6rem, 8vw, 5rem); letter-spacing: -.04em; color: var(--ink); line-height: 1; margin-bottom: 1.1rem; }
.lab-title .amber { color: var(--accent); }
.lab-lede { max-width: 56ch; font-size: clamp(1.02rem, 1.5vw, 1.18rem); color: var(--text); }
.lab-lede b { color: var(--accent-2); font-weight: 500; }

.lab-wrap { max-width: 640px; margin: 0 auto; padding: 1.5rem var(--pad) 5rem; }

/* ---------- Featured: The Last Move ---------- */
.lm-feature { display: block; position: relative; border: 1px solid var(--line-2); border-radius: 18px; padding: clamp(1.5rem, 4vw, 2.4rem); margin-bottom: 2rem; overflow: hidden; background: linear-gradient(135deg, rgba(240,82,77,0.06), rgba(106,166,255,0.05) 70%, transparent); transition: border-color .35s var(--ease), transform .35s var(--ease); }
.lm-feature::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 140% at 100% 0%, rgba(240,82,77,0.16), transparent 55%); opacity: .8; pointer-events: none; }
.lm-feature:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.lm-feature-tag { position: relative; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); }
.lm-feature-title { position: relative; font-family: var(--f-disp); font-weight: 600; font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -.03em; color: var(--ink); line-height: 1; margin: .7rem 0 .8rem; }
.lm-feature-title span { color: var(--accent-2); }
.lm-feature-desc { position: relative; color: var(--text); max-width: 56ch; font-size: .98rem; line-height: 1.6; margin-bottom: 1.2rem; }
.lm-feature-cta { position: relative; font-family: var(--f-mono); font-size: .85rem; color: var(--accent-2); transition: letter-spacing .3s var(--ease); display: inline-block; }
.lm-feature:hover .lm-feature-cta { letter-spacing: .03em; }

/* ---------- Picker ---------- */
.picker { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; border-bottom: 1px solid var(--line); padding-bottom: 1.2rem; }
.pick { font-family: var(--f-mono); font-size: .82rem; color: var(--muted); background: none; border: 1px solid var(--line-2); border-radius: 100px; padding: .55rem 1.1rem; cursor: pointer; transition: color .25s var(--ease), border-color .25s, background .25s; }
.pick:hover { color: var(--ink); border-color: var(--muted); }
.pick.active { color: var(--accent); border-color: var(--accent); background: rgba(106,166,255,0.08); }

/* ---------- Panels ---------- */
.panel { display: none; animation: panelIn .45s var(--ease) both; }
.panel.active { display: block; }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.panel-title { font-family: var(--f-disp); font-weight: 600; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.02em; color: var(--ink); }
.panel-sub { font-family: var(--f-mono); font-size: .74rem; color: var(--accent); margin-top: .25rem; }
.game-intro { color: var(--text); font-size: .96rem; max-width: 56ch; margin-bottom: 1.6rem; line-height: 1.6; }

.game-status { font-family: var(--f-mono); font-size: .82rem; color: var(--text); display: inline-flex; align-items: center; gap: .5rem; text-align: right; white-space: nowrap; }
.game-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--glow); transition: background .3s, box-shadow .3s; flex: none; }
.game-status.thinking::before { background: var(--accent-2); box-shadow: 0 0 8px var(--glow-2); animation: livePulse 1s ease-in-out infinite; }
.game-status.over::before { background: var(--muted); box-shadow: none; }
.game-status.good::before { background: #5fd08a; box-shadow: 0 0 8px rgba(95,208,138,.6); }

/* ---------- Score ---------- */
.score { display: inline-flex; gap: 1px; background: var(--line); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; margin-bottom: 1.4rem; }
.sc { background: var(--bg-2); padding: .65rem 1.1rem; text-align: center; min-width: 72px; }
.sc-n { display: block; font-family: var(--f-disp); font-weight: 600; font-size: 1.45rem; line-height: 1; color: var(--ink); }
.sc.you .sc-n { color: var(--accent); }
.sc.ai .sc-n { color: var(--accent-2); }
.sc-l { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.nim-score { font-family: var(--f-mono); font-size: .82rem; color: var(--muted); }
.nim-score b { color: var(--ink); font-weight: 500; }

/* ---------- Controls ---------- */
.game-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1.3rem; margin-top: 1.6rem; }
.btn-ghost { font-family: var(--f-mono); font-size: .82rem; color: var(--ink); background: none; border: 1px solid var(--line-2); border-radius: 100px; padding: .55rem 1.15rem; cursor: pointer; transition: border-color .3s var(--ease), color .3s, background .3s; }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }
.toggle { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--f-mono); font-size: .8rem; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { appearance: none; -webkit-appearance: none; width: 34px; height: 18px; border-radius: 100px; background: var(--bg-2); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .3s, border-color .3s; }
.toggle input::after { content: ""; position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--ease), background .25s; }
.toggle input:checked { background: rgba(240,82,77,0.2); border-color: var(--accent-2); }
.toggle input:checked::after { transform: translateX(16px); background: var(--accent-2); }
.game-note { font-family: var(--f-mono); font-size: .74rem; color: var(--faint); margin-left: auto; }

.lab-back { display: inline-block; margin-top: 2.5rem; font-family: var(--f-mono); font-size: .85rem; color: var(--muted); transition: color .3s var(--ease); }
.lab-back:hover { color: var(--accent); }

/* ---------- Tic-Tac-Toe ---------- */
.board-wrap { position: relative; max-width: 380px; }
.board { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; aspect-ratio: 1; }
.cell { position: relative; background: var(--bg); border: none; cursor: pointer; display: grid; place-items: center; padding: 12%; transition: background .25s var(--ease); }
.cell:hover:enabled { background: var(--bg-2); }
.cell:disabled { cursor: default; }
.cell:focus-visible { outline: 1px solid var(--accent); outline-offset: -3px; }
.cell .ghost { opacity: 0; transition: opacity .2s; }
.cell:hover:enabled .ghost { opacity: .14; }
.mark { width: 100%; height: 100%; overflow: visible; }
.mark line, .mark circle { fill: none; stroke: currentColor; stroke-width: 9; stroke-linecap: round; }
.mark.c-you { color: var(--accent); }
.mark.c-ai { color: var(--accent-2); }
.mark.cross line { stroke-dasharray: 86; stroke-dashoffset: 86; animation: draw .26s var(--ease) forwards; }
.mark.cross line:nth-child(2) { animation-delay: .15s; }
.mark.ring circle { stroke-dasharray: 189; stroke-dashoffset: 189; animation: draw .4s var(--ease) forwards; }
.mark.ghost line, .mark.ghost circle { animation: none !important; stroke-dashoffset: 0; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.winline { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.winline line { stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw .5s var(--ease) .1s forwards; filter: drop-shadow(0 0 4px currentColor); }
.cell.win { background: rgba(160,185,220,0.05); }

/* ---------- Nim ---------- */
.nim-rows { display: flex; flex-direction: column; gap: 1.1rem; padding: 1.4rem 0; }
.nim-row { display: flex; gap: .55rem; min-height: 56px; align-items: flex-end; flex-wrap: wrap; }
.stick { position: relative; width: 10px; height: 50px; border: none; padding: 0; cursor: pointer; border-radius: 5px; background: linear-gradient(180deg, #9cc0ef, var(--accent)); transition: transform .18s var(--ease), filter .18s, box-shadow .18s; }
.stick::before { content: ""; position: absolute; top: -5px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 6px var(--glow-2); transition: box-shadow .18s; }
.stick.taking { transform: translateY(-8px); box-shadow: 0 6px 14px -4px var(--glow-2); filter: saturate(1.4) brightness(1.12); }
.stick.taking::before { box-shadow: 0 0 12px var(--accent-2); }
.nim-rows.locked .stick { pointer-events: none; }
.stick.gone { animation: stickGone .3s var(--ease) forwards; }
@keyframes stickGone { to { transform: translateY(-16px) scale(.7); opacity: 0; } }

/* ---------- Rock Paper Scissors ---------- */
.rps-arena { display: flex; align-items: center; justify-content: center; gap: clamp(1.5rem, 6vw, 3.5rem); padding: 1.6rem 0 .6rem; }
.rps-slot { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.rps-mark { width: clamp(80px, 22vw, 110px); height: clamp(80px, 22vw, 110px); border: 1px solid var(--line-2); border-radius: 20px; display: grid; place-items: center; background: var(--bg-2); color: var(--accent); font-family: var(--f-disp); font-size: 2.4rem; }
.rps-mark.ai { color: var(--accent-2); }
.rps-mark svg { width: 56%; height: 56%; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.rps-mark.pop { animation: pop .35s var(--ease); }
@keyframes pop { 0% { transform: scale(.6); opacity: .3; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.rps-cap { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rps-vs { font-family: var(--f-mono); font-size: .8rem; color: var(--faint); }
.rps-result { text-align: center; font-family: var(--f-mono); font-size: .9rem; min-height: 1.4em; margin-bottom: 1rem; color: var(--text); }
.rps-result.win { color: #5fd08a; }
.rps-result.lose { color: var(--accent-2); }
.rps-buttons { display: flex; justify-content: center; gap: .8rem; flex-wrap: wrap; }
.rps-btn { display: flex; flex-direction: column; align-items: center; gap: .5rem; width: 96px; padding: 1rem .6rem; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; cursor: pointer; color: var(--text); transition: border-color .25s var(--ease), color .25s, transform .2s var(--ease); }
.rps-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }
.rps-btn svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.rps-btn span { font-family: var(--f-mono); font-size: .74rem; }

/* ---------- Chomp ---------- */
.chomp-grid { display: grid; gap: 4px; padding: 1.2rem 0; max-width: 420px; }
.chomp-cell { position: relative; aspect-ratio: 1; border: none; border-radius: 6px; background: linear-gradient(150deg, #2a2118, #3a2c1d); cursor: pointer; transition: background .2s var(--ease), transform .2s var(--ease), opacity .25s; }
.chomp-cell:hover:enabled { transform: translateY(-2px); }
.chomp-cell.poison { background: linear-gradient(150deg, #6e1f1c, #8a2723); }
.chomp-cell.poison::after { content: "☠"; position: absolute; inset: 0; display: grid; place-items: center; color: #ffd9d6; font-size: 1.1rem; }
.chomp-cell.hl { background: linear-gradient(150deg, #3f6fc4, var(--accent)); }
.chomp-cell.hl.danger { background: linear-gradient(150deg, #8a2723, var(--accent-2)); }
.chomp-cell.eaten { background: transparent; pointer-events: none; opacity: 0; transform: scale(.6); }
.chomp-grid.locked .chomp-cell { pointer-events: none; }

@media (max-width: 720px) {
  .game-note { margin-left: 0; }
  .panel-head { flex-direction: column; }
  .game-status { text-align: left; }
  .rps-btn { width: 84px; }
}
