/* ==========================================================================
   Neon Ice: Portrait Curling — custom styles
   Tailwind (CDN) handles layout utilities; this file owns the arcade-cabinet
   look, the canvas shell and the bi-directional curl slider.
   ========================================================================== */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at 50% 20%, #0f172a 0%, #020617 100%);
    color: #f8fafc;
    overscroll-behavior: none;
}

/* --------------------------------------------------------------------------
   Portrait cabinet shell — centered on desktop, full viewport on mobile
   -------------------------------------------------------------------------- */
#game-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    margin: 0 auto;
    background: #0b1120;
    box-shadow: 0 0 60px rgba(56, 189, 248, 0.15), 0 0 0 1px rgba(148, 163, 184, 0.15);
    position: relative;
    overflow: hidden;
}

/* Canvas container fills the available vertical space */
#canvas-wrap {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    overflow: hidden;
    background: #e2f1f8;
    touch-action: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

canvas:active {
    cursor: grabbing;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-game {
    position: relative;
    transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.14);
    touch-action: manipulation;
}

.btn-game:active:not(:disabled) {
    transform: translateY(2px) scale(0.97);
}

.btn-game:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-sweep-active {
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.8), inset 0 0 12px rgba(255, 255, 255, 0.45);
    transform: scale(0.98);
}

/* Stone pip indicators */
.stone-pip {
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    transition: all 0.25s ease;
}

.stone-pip.used {
    opacity: 0.2;
    transform: scale(0.75);
}

/* Subtle pulse for the active turn */
@keyframes turnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
}

.turn-active {
    animation: turnPulse 1.8s infinite;
}

/* Toast banner */
@keyframes toastIn {
    0% { opacity: 0; transform: translate(-50%, -14px) scale(0.92); }
    100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.toast-anim {
    animation: toastIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* --------------------------------------------------------------------------
   Footer / safe areas
   -------------------------------------------------------------------------- */
#game-footer {
    padding-bottom: calc(0.625rem + env(safe-area-inset-bottom, 0px));
}

/* --------------------------------------------------------------------------
   Bi-directional curl slider
   -------------------------------------------------------------------------- */
.curl-control {
    user-select: none;
}

.curl-readout {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    transition: color 0.15s ease;
}

.curl-readout.is-straight { color: #94a3b8; }
.curl-readout.is-left { color: #c4b5fd; }
.curl-readout.is-right { color: #7dd3fc; }

.curl-slider {
    position: relative;
    padding: 13px 18px;
    border-radius: 12px;
    cursor: pointer;
    touch-action: none;
    transition: opacity 0.2s ease;
}

.curl-slider.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.curl-slider:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.7);
    outline-offset: 2px;
}

.curl-track {
    position: relative;
    height: 10px;
    border-radius: 9999px;
    background: linear-gradient(
        90deg,
        rgba(167, 139, 250, 0.22) 0%,
        rgba(148, 163, 184, 0.16) 50%,
        rgba(56, 189, 248, 0.22) 100%
    );
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.curl-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 9999px;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
}

.curl-fill-left {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.55);
}

.curl-fill-right {
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
}

.curl-center-mark {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 16px;
    transform: translate(-50%, -50%);
    background: rgba(226, 232, 240, 0.5);
    border-radius: 2px;
    pointer-events: none;
}

.curl-thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    border-radius: 9999px;
    background: radial-gradient(circle at 35% 30%, #f8fafc, #cbd5e1 60%, #94a3b8);
    border: 2px solid rgba(15, 23, 42, 0.65);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(56, 189, 248, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: box-shadow 0.15s ease;
}

.curl-slider.is-dragging .curl-thumb {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6), 0 0 0 5px rgba(56, 189, 248, 0.3);
}

.curl-thumb-icon {
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    color: #0f172a;
}

.curl-scale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
    margin-top: 1px;
}

.curl-preset {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #94a3b8;
    background: transparent;
    border: 0;
    padding: 5px 7px;
    border-radius: 6px;
    cursor: pointer;
    touch-action: manipulation;
    transition: color 0.15s ease, background 0.15s ease;
}

.curl-preset:hover {
    color: #e2e8f0;
}

.curl-preset:active {
    background: rgba(56, 189, 248, 0.15);
    color: #e0f2fe;
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
    .turn-active,
    .toast-anim {
        animation: none;
    }
}
