/* Nonograms Premium Aesthetic & Layout */

:root {
    --bg-cream: #f9f6ef;
    --panel-bg: #ffffff;
    --accent-teal: #4c9689;
    --accent-teal-dark: #37756a;
    --text-primary: #3d4a45;
    --text-muted: #82938e;
    
    --grid-line: rgba(130, 147, 142, 0.4);
    
    --shadow-soft: 0 4px 12px rgba(61, 74, 69, 0.08);
    --shadow-btn: 0 2px 0 var(--accent-teal-dark);
    --shadow-btn-light: 0 2px 0 #d9d2c5;
    
    --heart-color: #e55c5c;
    --filled-cell-color: #2c3135; /* Dark grey/black for nonogram fill */
}

/* Base resets */
.game-app-root {
    background-color: var(--bg-cream);
    color: var(--text-primary);
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: -1rem;
    padding: 1rem;
    box-sizing: border-box;
    align-items: center;
}

.game-container.immersive {
    min-height: 100vh !important;
    min-height: 100dvh !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    background-image: url('../assets/images/botanical_motif.png') !important;
    background-size: cover !important;
    background-position: center !important;
    background-blend-mode: multiply !important;
    background-color: var(--bg-cream) !important;
}

#game-container.in-game {
    background-image: none !important;
}

.bg-botanical {
    background-image: url('../assets/images/botanical_motif.png');
    background-size: cover;
    background-position: center;
    background-blend-mode: multiply;
    background-color: var(--bg-cream);
}

.top-section-bg {
    border-radius: 24px;
    padding: 10px 15px;
    margin-bottom: 15px;
    width: 100%;
    border: 2px solid #F2E2C6;
    box-shadow: var(--shadow-soft);
}

.game-play-area {
    background-color: #FDF4E5;
    border-radius: 24px;
    padding: 15px;
    border: 2px solid #F2E2C6;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.game-content-wrapper {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Internal Menu */
.menu-card {
    background: var(--panel-bg);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    box-shadow: var(--shadow-soft);
}

.menu-title {
    font-weight: 800;
    color: var(--accent-teal-dark);
    font-size: 2rem;
    margin-bottom: 10px;
}

.menu-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 16px;
    border: none;
    margin-top: 15px;
    cursor: pointer;
    transition: transform 0.1s;
}

.menu-btn-primary { background: var(--accent-teal); color: white; box-shadow: var(--shadow-btn); }
.menu-btn-secondary { background: var(--panel-bg); color: var(--accent-teal-dark); border: 2px solid var(--accent-teal); box-shadow: 0 4px 0 var(--accent-teal); }
.menu-btn:active { transform: translateY(4px); box-shadow: none !important; }

/* Plaques and Bars */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: none; font-weight: bold; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.icon-btn-back { background: var(--accent-teal); color: white; box-shadow: var(--shadow-btn); }
.icon-btn-help { background: #FDF4E7; color: var(--accent-teal-dark); border: 2px solid #F2E2C6; box-shadow: 0 2px 0 #F2E2C6; }
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.plaque {
    background-image: url('../../shikaku/assets/images/plaque-bg.png'); /* Re-using existing asset */
    background-size: 100% 100%; background-repeat: no-repeat; background-color: transparent; color: white; padding: 8px 35px; font-weight: 700; font-size: 1.15rem; display: inline-flex; align-items: center; justify-content: center; min-width: 150px; text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.hearts-container { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0 auto 15px auto; background: white; padding: 6px 16px; border-radius: 20px; box-shadow: var(--shadow-soft); width: fit-content; }
.heart { transition: opacity 0.3s, filter 0.3s; line-height:1;}
.heart.lost { opacity: 0.25; filter: grayscale(100%); }

/* Nonogram Board wrapper */
.board-wrapper {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 0;
    border: 3px solid #675643;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-viewport {
    flex: 1;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: white;
    touch-action: none; /* No zooming/panning yet, simple static fit */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

/* Nonogram Specific Styles */
#link-a-pix-board {
    font-family: 'Nunito', sans-serif;
    user-select: none;
    touch-action: none;
}

.row-header, .col-header {
    color: var(--text-primary);
    font-weight: 800;
    line-height: 1.1;
}

.ng-cell {
    background-color: #fdfdfd;
    border: 1px solid var(--grid-line);
    border-bottom: 2px solid #ccc;
    border-right: 2px solid #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--text-primary);
    transition: background-color 0.1s, opacity 0.8s, border 0.1s;
    cursor: pointer;
}
.ng-cell:active {
    border-bottom: 1px solid var(--grid-line);
    border-right: 1px solid var(--grid-line);
    border-top: 2px solid #ccc;
    border-left: 2px solid #ccc;
}

.ng-cell.filled {
    background-color: var(--filled-cell-color);
    border-color: var(--filled-cell-color);
}

.ng-cell.crossed {
    background-color: white;
    /* X handled by innerText in JS */
}

.ng-cell.error {
    background-color: rgba(229, 92, 92, 0.4);
    border-color: var(--heart-color);
}

@keyframes errorFlash {
    0% { background-color: rgba(229, 92, 92, 0.8); }
    100% { background-color: var(--filled-cell-color); } /* usually forced to fill or cross, transition handles rest */
}

.ng-cell.error-flash {
    animation: errorFlash 0.4s ease-out !important;
    border-color: var(--heart-color) !important;
}

.ng-clue {
    transition: color 0.3s;
}

.ng-clue.completed-clue {
    color: #b0b0b0 !important;
}

/* Reveal Animation */
.completed #link-a-pix-board {
    background-color: transparent !important;
    border-color: transparent !important;
}

.completed #link-a-pix-board .ng-cell {
    background-color: transparent !important;
    border-color: transparent !important;
    color: transparent !important; /* hide X marks */
}
.completed #link-a-pix-board .row-header, 
.completed #link-a-pix-board .col-header {
    opacity: 0.2; /* Dim headers on complete */
    transition: opacity 0.8s;
}

/* Status Strip */
.status-strip { display: flex; justify-content: space-between; background: #FCF2E2; padding: 10px 20px; border-radius: 20px; margin-top: 15px; border: 2px solid #F2E2C6; box-shadow: 0 4px 0 #F2E2C6, var(--shadow-soft); font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }
.status-divider { width: 2px; background-color: #e5d5be; margin: 0 10px; }

/* Bottom Controls */
.bottom-controls { display: flex; justify-content: space-between; background: #FCF2E2; padding: 15px; border-radius: 24px; margin-top: 15px; border: 2px solid #F2E2C6; box-shadow: 0 4px 0 #F2E2C6, var(--shadow-soft); margin-bottom: 20px; }
.control-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; font-family: inherit; position: relative; }
.control-icon-wrapper { width: 50px; height: 50px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; transition: transform 0.1s; }
.control-btn:active .control-icon-wrapper { transform: translateY(2px); box-shadow: none !important; }
.btn-teal .control-icon-wrapper { background: var(--accent-teal); color: white; box-shadow: var(--shadow-btn); }
.btn-cream .control-icon-wrapper { background: var(--bg-cream); color: var(--accent-teal-dark); border: 2px solid var(--accent-teal); box-shadow: var(--shadow-btn-light); }
.btn-image .control-icon-wrapper { background: none !important; border: none !important; box-shadow: none !important; width: 50px; height: 50px; }
.control-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.badge { position: absolute; top: -5px; right: 0; background: var(--accent-teal-dark); color: white; border-radius: 50%; width: 20px; height: 20px; font-size: 0.65rem; display: flex; justify-content: center; align-items: center; font-weight: bold; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(61, 74, 69, 0.6); display: none; justify-content: center; align-items: center; z-index: 1000; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.2s, visibility 0.2s; }
.modal-overlay.active { display: flex !important; opacity: 1; visibility: visible; pointer-events: auto; }
.modal-content { background: var(--bg-cream); border-radius: 24px; padding: 30px; width: 90%; max-width: 350px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.2); transform: scale(0.9); transition: transform 0.2s; }
.modal-overlay.active .modal-content { transform: scale(1); }

/* Campaign Track (Re-used classes) */
.campaign-track-container { flex: 1; width: 100%; overflow-y: auto; overflow-x: hidden; position: relative; scrollbar-width: none; background-image: url('../assets/images/botanical_motif.png') !important; background-size: auto !important; background-repeat: repeat !important; background-position: center !important; background-blend-mode: multiply !important; background-color: var(--bg-cream) !important; }
.campaign-track-container::-webkit-scrollbar { display: none; }
.campaign-track-content { position: relative; padding: 40px 0 120px 0; display: flex; flex-direction: column; align-items: center; gap: 40px; }
.track-svg-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.track-node { width: 64px; height: 64px; border-radius: 16px; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; font-weight: 800; background: white; cursor: pointer; box-shadow: var(--shadow-soft); position: relative; transition: transform 0.2s; }
.track-node:active { transform: scale(0.95); }
.track-node.locked { background: var(--panel-bg); border: 3px solid #dcd5c6; color: var(--text-muted); cursor: default; }
.track-node.unlocked { border: 3px solid var(--accent-teal); color: var(--accent-teal-dark); }
.track-node.current { background: var(--accent-teal); color: white; box-shadow: 0 0 15px rgba(76, 150, 137, 0.5); }

.track-node-wrapper { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.track-node.locked .lock-icon { font-size: 1rem; margin-top: -5px; }
.track-node-stars { display: flex; gap: 2px; position: absolute; bottom: -10px; background: white; padding: 2px 8px; border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border: 1px solid var(--accent-teal); }
.track-node-stars .star { color: #ffd700; font-size: 0.8rem; text-shadow: 0 1px 1px rgba(0,0,0,0.2); }
.track-node-stars .star.empty { color: #e0e0e0; text-shadow: none; }
.track-node-label { position: absolute; white-space: nowrap; background: white; padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: bold; color: var(--accent-teal-dark); box-shadow: var(--shadow-soft); border: 1px solid #e0d8c8; pointer-events: none; }
.track-node-label::before { content: ''; position: absolute; top: 50%; transform: translateY(-50%); border: 5px solid transparent; }
.track-node-label.left { right: calc(100% + 15px); }
.track-node-label.left::before { left: 100%; border-left-color: white; }
.track-node-label.right { left: calc(100% + 15px); }
.track-node-label.right::before { right: 100%; border-right-color: white; }

.campaign-stats-bar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 400px; background: white; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); display: flex; padding: 15px; z-index: 10; }
.campaign-stat { flex: 1; display: flex; align-items: center; justify-content: center; gap: 15px; }
.campaign-stat:first-child { border-right: 2px solid var(--bg-cream); }
.campaign-stat-icon { font-size: 2rem; }
.campaign-stat-info { display: flex; flex-direction: column; align-items: flex-start; }
.campaign-stat-title { font-size: 0.75rem; color: var(--text-muted); font-weight: bold; }
.campaign-stat-value { font-size: 1.2rem; font-weight: 800; color: var(--accent-teal-dark); }

@media (min-width: 768px) {
    #game-container.in-track { background-size: auto !important; background-repeat: repeat !important; }
    #game-container.in-track .campaign-track-container { background-image: none !important; background-color: transparent !important; }
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day.empty {
    visibility: hidden;
    pointer-events: none;
}

.calendar-day.locked {
    background-color: var(--board-bg);
    color: var(--text-muted);
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.calendar-day.completed {
    background-color: var(--accent-teal);
    color: white;
    pointer-events: none;
    cursor: default;
    box-shadow: 0 0 8px rgba(74, 189, 172, 0.4);
}

.calendar-day.missed {
    background-color: var(--panel-bg);
    color: var(--text-primary);
    border: 2px solid var(--board-bg);
}

.calendar-day.missed:active {
    transform: scale(0.9);
    background-color: #e5e5e5;
}

.calendar-day.current {
    border: 3px solid var(--accent-teal-dark);
}
