/**
 * Funquizo Games - Memory Engine Styling
 * Clean, modern, high-contrast, compact and responsive game console.
 */

:root {
    --mem-bg: #0f172a;
    --mem-surface: #1e293b;
    --mem-surface-hover: #334155;
    --mem-border: #334155;
    --mem-primary: #38bdf8;
    --mem-primary-glow: rgba(56, 189, 248, 0.25);
    --mem-success: #10b981;
    --mem-danger: #ef4444;
    --mem-text: #f8fafc;
    --mem-text-muted: #94a3b8;
    --mem-keypad-bg: #1e293b;
    --mem-keypad-key: #334155;
    --mem-keypad-active: #475569;
}

/* Override Funquizo base layout main.container */
main.container {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Breadcrumbs in game view */
.breadcrumb-container,
.gh-breadcrumbs {
    padding: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    font-size: 0.85rem;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gh-breadcrumbs a {
    color: #64748b !important;
    text-decoration: none;
    transition: color 0.15s;
}

.gh-breadcrumbs a:hover {
    color: #7c3aed !important;
}

.gh-breadcrumbs span.current,
.breadcrumb-item.active {
    color: #1e293b !important;
    font-weight: 700;
}

/* Outer Shell Container - matches 1280px */
.gh-game-container {
    width: min(1280px, calc(100% - 48px));
    margin-inline: auto;
    padding: 0.5rem 0 3.5rem;
}

@media (max-width: 760px) {
    .gh-game-container {
        width: calc(100% - 14px);
    }
}

/* Main Game Console Card - Compact and centered */
.mem-app {
    width: 100%;
    max-width: 440px;
    margin: 0 auto 3rem auto;
    padding: 1.25rem 1.25rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    background: var(--mem-bg);
    border: 1px solid var(--mem-border);
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    user-select: none;
    -webkit-user-select: none;
    color: var(--mem-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (max-width: 560px) {
    .mem-app {
        border-radius: 18px;
        padding: 1rem 0.85rem;
    }
}

/* Header & HUD */
.mem-hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.15rem;
    background: var(--mem-surface);
    border: 1px solid var(--mem-border);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mem-hud-level {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--mem-primary);
}

.mem-hud-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mem-btn-sound {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem 0.45rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f8fafc;
    transition: background 0.15s, transform 0.15s;
}

.mem-btn-sound:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

.mem-hud-badge {
    background: rgba(56, 189, 248, 0.15);
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.mem-hud-lives {
    display: flex;
    gap: 0.35rem;
    font-size: 1.25rem;
    letter-spacing: 2px;
}

.mem-heart {
    transition: transform 0.25s ease, filter 0.25s ease;
}

.mem-heart--lost {
    filter: grayscale(1) opacity(0.35);
    transform: scale(0.85);
}

/* Stage Container - Compact, no massive stretching */
.mem-stage-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0.5rem 0;
    min-height: 120px;
}

/* Start Card */
.mem-start-card {
    background: var(--mem-surface);
    border: 1px solid var(--mem-border);
    border-radius: 18px;
    padding: 2rem 1.25rem;
    text-align: center;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.mem-start-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    display: inline-block;
    animation: mem-pulse 2s infinite ease-in-out;
}

.mem-start-title {
    font-size: 1.6rem;
    font-weight: 900;
    margin: 0 0 0.5rem 0;
    color: var(--mem-text);
}

.mem-start-desc {
    color: var(--mem-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 1.5rem 0;
}

.mem-btn-start {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.15rem;
    padding: 0.9rem 1.75rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mem-btn-start:active {
    transform: scale(0.98);
}

/* Sequence Display (Memorization Phase) */
.mem-display-box {
    text-align: center;
    width: 100%;
}

.mem-prompt-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mem-text-muted);
    margin-bottom: 0.75rem;
}

.mem-sequence-view {
    font-size: clamp(2rem, 6.5vw, 3rem);
    font-weight: 900;
    letter-spacing: clamp(0.2rem, 1.2vw, 0.4rem);
    color: #ffffff;
    padding: 0.9rem 0.75rem;
    background: rgba(30, 41, 59, 0.75);
    border: 2px solid var(--mem-primary);
    border-radius: 16px;
    box-shadow: 0 0 25px var(--mem-primary-glow);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Countdown Bar */
.mem-timer-bar-wrap {
    width: 100%;
    height: 7px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    margin-top: 1rem;
    overflow: hidden;
}

.mem-timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    border-radius: 999px;
    width: 100%;
    transition: width linear;
}

/* Input Display (Recall Phase) */
.mem-input-slots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    min-height: 48px;
}

.mem-slot {
    width: 38px;
    height: 46px;
    border: 2px solid var(--mem-border);
    background: var(--mem-surface);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.55rem;
    font-weight: 900;
    color: #ffffff;
    transition: all 0.15s ease;
}

.mem-slot--filled {
    border-color: var(--mem-primary);
    background: rgba(56, 189, 248, 0.1);
}

.mem-slot--active {
    border-color: #38bdf8;
    box-shadow: 0 0 10px var(--mem-primary-glow);
    animation: mem-pulse 1.2s infinite;
}

/* Feedback Cards */
.mem-feedback-card {
    background: var(--mem-surface);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    width: 100%;
    animation: mem-slide-up 0.25s ease-out;
}

.mem-feedback-card--correct {
    border: 2px solid var(--mem-success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.mem-feedback-card--wrong {
    border: 2px solid var(--mem-danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

.mem-feedback-title {
    font-size: 1.35rem;
    font-weight: 900;
    margin: 0 0 0.35rem 0;
}

.mem-feedback-detail {
    font-size: 0.95rem;
    color: var(--mem-text-muted);
    margin: 0.35rem 0;
}

.mem-seq-correct-highlight {
    font-weight: 900;
    color: #38bdf8;
    font-size: 1.4rem;
    letter-spacing: 0.15em;
    margin: 0.4rem 0;
    display: block;
}

/* On-Screen Touch Keypad - Compact & Balanced */
.mem-keypad {
    width: 100%;
    max-width: 360px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 0 auto;
}

.mem-key {
    background: var(--mem-keypad-key);
    color: #ffffff;
    border: 1px solid var(--mem-border);
    border-radius: 12px;
    font-size: 1.45rem;
    font-weight: 700;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.1s ease, transform 0.1s ease;
}

.mem-key:hover {
    background: var(--mem-surface-hover);
}

.mem-key:active {
    background: var(--mem-keypad-active);
    transform: scale(0.96);
}

.mem-key--backspace {
    font-size: 1.25rem;
    color: #fda4af;
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.3);
}

.mem-key--submit {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: #10b981;
    letter-spacing: 0.05em;
}

.mem-key--submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--mem-keypad-key);
    border-color: var(--mem-border);
}

/* Animations */
@keyframes mem-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes mem-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.mem-shake {
    animation: mem-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes mem-shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}
