/* Global Styles */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Press Start 2P', cursive;
    background-color: #212529;
    color: #ffffff;
    min-height: 100vh;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.page.active {
    display: block;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Page */
.title-container {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 48px;
    color: #209cee;
    /* text-shadow: 4px 4px #000; */
    margin-bottom: 20px;
    line-height: 1.5;
    
}

.subtitle {
    font-size: 14px;
    margin-top: 10px;
}

.login-info {
    margin: 40px auto !important;
    max-width: 600px;
    /* align-items: center; */
}

.login-info .title {
    font-size: 16px;
    color: #209cee;
    /* text-shadow: none; */
}

.info-list {
    text-align: center;
}

.info-list p {
    margin: 15px 0;
    font-size: 12px;
    line-height: 2;
}

.sign-in-button {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 10;
}

.header h2 {
    margin: 0;
    font-size: 24px;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.nav-buttons button {
    font-size: 10px;
}

/* User Info - Now in Nav Buttons */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.user-info span {
    font-size: 10px;
    color: #fff;
    line-height: 1;
}

/* Dashboard Content */
.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Pet Display */
.pet-display {
    display: flex;
    justify-content: center;
    align-items: center;
}

.pet-canvas-container {
    background-color: rgba(0, 0, 0, 0.0);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 4px solid #92cc41;
}

#petCanvas {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Stats Panel */
.stats-panel {
    background-color: rgba(0, 0, 0, 0.3);
    border: 4px solid #209cee;
}

.stats-panel .title {
    color: #209cee;
    /* background-color: #209cee; */
}

.stat-row {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
    min-height: 24px;
}

.stat-row .stat-label {
    font-weight: bold;
    min-width: 100px;
    color: #fff;
    line-height: 1.2;
    display: inline-block;
}

.stat-row span {
    color: #fff;
    line-height: 1.2;
}

.stat-row #hungerBar {
    flex: 1;
}

.stat-row #hungerValue {
    min-width: 50px;
    color: #fff;
}

.button-row {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.button-row button {
    width: 100%;
}

/* Status Message */
#statusMessage {
    margin: 20px auto;
    max-width: 500px;
}

#statusMessage p,
#statusText {
    color: #000 !important;
}

/* Park Grid */
.park-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.pet-card {
    background-color: rgba(0, 0, 0, 0.3);
    border: 4px solid #f7d51d;
    padding: 15px;
    text-align: center;
}

.pet-card canvas {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    margin-bottom: 10px;
}

.pet-card .pet-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 10px 0;
}

.pet-card .pet-name {
    font-size: 14px;
    font-weight: bold;
    margin: 0;
}

.pet-card .pet-owner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.pet-card .owner-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.pet-card .owner-username {
    font-size: 8px;
    color: #92cc41;
}

.pet-card .pet-hunger {
    margin: 10px 0;
}

.pet-card button {
    width: 100%;
    font-size: 8px;
}

/* Graveyard Table */
.nes-table-responsive {
    margin-top: 30px;
    margin-bottom: 30px;
    overflow-x: auto;
    position: relative;
    z-index: 1;
}

.nes-table {
    width: 100%;
    font-size: 10px;
    background-color: rgba(0, 0, 0, 0.3);
}

.nes-table td, .nes-table th {
    padding: 10px;
}

/* Death Modal */
#deathModal {
    background-color: rgba(0, 0, 0, 0.9);
    border: 4px solid #e76e55;
}

#deathModal .title {
    font-size: 16px;
    color: #e76e55;
    /* text-shadow: none; */
}

#deathModal p {
    margin: 10px 0;
    font-size: 12px;
}

.dialog-menu {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Transparent container backgrounds */
.nes-container {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: #209cee;
}

.nes-container.is-dark {
    background-color: rgba(0, 0, 0, 0.5) !important;
    border-color: #6c757d;
}

/* Or match the stats panel specifically */
.stats-panel.nes-container.with-title > .title {
    background-color: #1A1E21 !important;
}

.nes-container.with-title > .title {
    background-color: #1A1E21 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 32px;
    }
    
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .park-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 24px;
    }
    
    .container {
        padding: 10px;
    }
    
    #petCanvas {
        width: 96px;
        height: 96px;
    }
    
    .park-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Animations */
@keyframes wobble {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.wobble {
    animation: wobble 2s ease-in-out infinite;
}

.bounce {
    animation: bounce 1s ease-in-out infinite;
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Rename Button */
.rename-pencil-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.rename-pencil-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.rename-pencil-btn:active {
    transform: scale(0.9);
}

/* Rename Modal */
#renameModal .nes-field {
    margin: 15px 0;
}

#renameModal .nes-field label {
    margin-bottom: 8px;
    display: block;
}

#renameModal .nes-input {
    width: 100%;
    font-size: 12px;
}

#renameModal .dialog-menu {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ============================================================================
   v0.0.7 - Sick State & Games Styling
   ============================================================================ */

/* Sick Pet Visuals */
.sick-pet {
    filter: grayscale(100%) brightness(0.7);
    position: relative;
}

.sick-pet::after {
    content: '☁️';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* Sick Banner */
#sickBanner {
    text-align: center;
    animation: pulse-error 2s ease-in-out infinite;
}

@keyframes pulse-error {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Happiness Bar Styling */
#happinessBar {
    flex: 1;
}

#happinessValue {
    min-width: 50px;
    color: #fff;
}

/* Games Page Layout */
.game-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.game-selection-grid .game-card {
    padding: 40px 20px !important;
    text-align: center;
    font-size: 14px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background-color: rgba(0, 0, 0, 0.3) !important;
    transition: transform 0.2s, background-color 0.2s;
    cursor: pointer;
}

.game-selection-grid .game-card:hover {
    transform: translateY(-5px);
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.game-selection-grid .game-card:active {
    transform: translateY(-2px);
}

.game-selection-grid .game-card p {
    margin: 5px 0;
}

/* Game Container */
.game-container {
    max-width: 700px;
    margin: 30px auto;
    padding: 30px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 4px solid #209cee;
    border-radius: 8px;
}

.game-container .title {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
    color: #209cee;
}

/* High-Low Game Styling */
.die-display {
    font-size: 96px;
    margin: 40px 0;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    text-align: center;
}

.die {
    display: inline-block;
    animation: roll 0.5s ease-out;
}

@keyframes roll {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.streak-display {
    background-color: rgba(146, 204, 65, 0.2);
    border: 2px solid #92cc41;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    text-align: center;
}

.streak-display p {
    margin: 5px 0;
    font-size: 12px;
}

.game-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.game-buttons button {
    min-width: 150px;
    font-size: 12px;
}

.game-result {
    margin: 25px 0;
    padding: 20px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-result.win {
    background-color: rgba(146, 204, 65, 0.3);
    border: 2px solid #92cc41;
    color: #92cc41;
}

.game-result.lose {
    background-color: rgba(231, 110, 85, 0.3);
    border: 2px solid #e76e55;
    color: #e76e55;
}

.game-result.recovered {
    background-color: rgba(32, 156, 238, 0.3);
    border: 2px solid #209cee;
    color: #209cee;
}

.game-message {
    margin: 20px 0;
    font-size: 12px;
    min-height: 40px;
    text-align: center;
    color: #209cee;
}

/* Reflex Game Styling */
.reflex-container {
    padding: 20px 0;
}

.reflex-track {
    position: relative;
    width: 100%;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 4px solid #209cee;
    margin: 40px 0;
    overflow: hidden;
}

.reflex-target-zone {
    position: absolute;
    left: 45%;
    width: 10%;
    height: 100%;
    background-color: rgba(146, 204, 65, 0.3);
    border-left: 3px solid #92cc41;
    border-right: 3px solid #92cc41;
}

.reflex-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 10px;
    height: 100%;
    background-color: #209cee;
    box-shadow: 0 0 10px #209cee;
    transition: left 0.05s linear;
}

.reflex-instructions {
    text-align: center;
    margin: 20px 0;
    font-size: 12px;
}

.reflex-tap-btn {
    width: 100%;
    padding: 40px !important;
    font-size: 20px !important;
    margin: 30px 0;
}

.reflex-tap-btn:active {
    transform: scale(0.98);
}

/* Recovery Message Styling */
.recovery-message {
    background-color: rgba(32, 156, 238, 0.3);
    border: 2px solid #209cee;
    color: #209cee;
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    animation: fadeIn 0.5s ease-in;
}

.game-stats {
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid #209cee;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    text-align: center;
}

.game-stats p {
    margin: 8px 0;
    font-size: 12px;
}

.game-back-btn {
    margin-top: 30px;
    width: 100%;
}

/* Games Page Layout */
.game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.game-card-large {
    background-color: rgba(0, 0, 0, 0.4) !important;
    border: 3px solid #209cee;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-card-large:hover {
    border-color: #92cc41;
    background-color: rgba(0, 0, 0, 0.6) !important;
    transform: scale(1.05);
}

.game-card-large h3 {
    margin: 15px 0 10px 0;
    color: #fff;
    font-size: 18px;
}

.game-card-large p {
    margin: 5px 0;
    color: #ccc;
    font-size: 11px;
}

.game-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}
