/* ============================================================================
   Noughts & Crosses (noughtsandcrosses.js): a two-player board on DeeDee's lawn
   ============================================================================ */
#screen-noughts.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.nc-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-4);
    min-height: 100%;
}
/* Header at the top; the turn bubble and board share the space below it */
.nc-turn-row { margin-top: auto; }
.nc-board { margin-bottom: auto; }
.nc-scores { display: flex; align-items: center; gap: var(--sp-2); }
.nc-score-x { background: var(--nc-x-soft); border-color: var(--nc-x-line); color: var(--nc-x-ink); }
.nc-score-o { background: var(--nc-o-soft); border-color: var(--nc-o-line); color: var(--nc-o-ink); }
.nc-vs { color: var(--c-ink-soft); font-weight: 900; font-size: var(--fs-xs); }

/* DeeDee referees: her head next to the turn bubble */
.nc-turn-row { display: flex; align-items: center; gap: var(--sp-2); width: 100%; }
.nc-dog {
    width: 56px;
    height: auto;
    flex-shrink: 0;
    transform-origin: 50% 90%;
    filter: drop-shadow(0 3px 5px rgba(26, 43, 74, 0.18));
}
.nc-turn-banner {
    position: relative;
    flex: 1;
    min-height: 56px;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-md);
    background: var(--c-surface);
    border: 3px solid var(--turn-color, var(--c-line));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: var(--fs-lg);
    font-weight: 900;
    color: var(--turn-ink, var(--c-ink));
    box-shadow: var(--sh-card);
    transition: border-color 0.3s;
}
.nc-turn-banner::before {
    content: '';
    position: absolute;
    left: -11px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-right-color: var(--turn-color, var(--c-line));
    border-left: 0;
}
.nc-turn-emoji { font-size: 1.5rem; line-height: 1; }
@keyframes nc-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.nc-turn--pulse { animation: nc-pulse 0.5s ease; }

.nc-board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-3);
    width: 100%;
    max-width: min(380px, 52dvh);
    padding: var(--sp-3);
    background: var(--c-surface);
    border-radius: var(--r-lg);
    border: 3px solid var(--c-line);
    box-shadow: var(--sh-card), 0 6px 0 var(--c-line);
}
.nc-cell {
    aspect-ratio: 1;
    min-height: var(--tap);
    border-radius: var(--r-md);
    background: var(--c-surface-soft);
    border: 3px solid var(--c-line);
    box-shadow: inset 0 -4px 0 var(--c-line);
    font-size: clamp(2.2rem, 11vw, 3.2rem);
    line-height: 1;
    cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast), box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.nc-cell:not(.nc-cell--taken):hover { background: var(--blue-bg); border-color: var(--blue-line); transform: scale(1.03); }
.nc-cell:not(.nc-cell--taken):active { transform: scale(0.95); }
.nc-cell--taken { cursor: default; box-shadow: none; }
.nc-cell--x { background: var(--nc-x-soft); border-color: var(--nc-x-line); }
.nc-cell--o { background: var(--nc-o-soft); border-color: var(--nc-o-line); }
@keyframes nc-pop {
    0%   { transform: scale(0) rotate(-10deg); }
    60%  { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}
.nc-cell--pop { animation: nc-pop 0.35s cubic-bezier(.17, .67, .3, 1.3); }
@keyframes nc-win-glow {
    0%, 100% { box-shadow: 0 0 0 3px var(--win-color, var(--c-line)); transform: scale(1); }
    50%      { box-shadow: 0 0 0 6px var(--win-color, var(--c-line)), 0 0 18px var(--win-color, var(--c-line)); transform: scale(1.06); }
}
.nc-cell--winner { animation: nc-win-glow 0.8s ease-in-out infinite; }
@keyframes nc-strike-draw { from { stroke-dashoffset: 600; } to { stroke-dashoffset: 0; } }
.nc-strike-line { stroke-dasharray: 600; stroke-dashoffset: 600; animation: nc-strike-draw 0.4s ease-out forwards; }

.nc-particles { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 999; }
@keyframes nc-particle-fly {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}
.nc-particle { position: absolute; width: 8px; height: 8px; border-radius: 50%; animation: nc-particle-fly 0.6s ease-out forwards; }

/* ---- Result: the shared overlay card ---- */
@keyframes nc-result-in {
    from { transform: scale(0.7) translateY(30px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
.nc-result--show .nc-result-card { animation: nc-result-in 0.45s cubic-bezier(.17, .67, .3, 1.3) both; }
.nc-result-card { max-width: 360px; }
.overlay-card .nc-result-title { font-size: var(--fs-2xl); margin: var(--sp-1) 0; }
.nc-result-sub { font-size: 1.4rem; margin-bottom: var(--sp-4); letter-spacing: 6px; color: var(--c-ink-soft); font-weight: 800; }
.nc-result-scores { display: flex; gap: var(--sp-3); justify-content: center; margin-bottom: var(--sp-4); }
.nc-score-chip {
    min-width: 88px;
    background: var(--chip-bg, var(--c-surface-soft));
    border: 3px solid var(--chip-line, var(--c-line));
    border-radius: var(--r-md);
    padding: var(--sp-2) var(--sp-4);
    color: var(--chip-ink, var(--c-ink));
    font-size: var(--fs-sm);
    font-weight: 800;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nc-score-chip strong { font-size: 1.8rem; font-weight: 900; line-height: 1.1; }
.nc-score-chip--x { --chip-bg: var(--nc-x-soft); --chip-line: var(--nc-x-line); --chip-ink: var(--nc-x-ink); }
.nc-score-chip--o { --chip-bg: var(--nc-o-soft); --chip-line: var(--nc-o-line); --chip-ink: var(--nc-o-ink); }
