:root {
    --primary: #2c3e50;
    --accent: #27ae60;
    --click-accent: #2980b9;
    --panel: rgba(255, 255, 255, 0.92);
    --slot-gold: #f1c40f;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(to bottom, #74ebd5 0%, #9ecee6 48%, #ffffff 48%, #eef2f3 100%);
    background-attachment: fixed;
    color: var(--primary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: background 1.2s ease-in-out;
}

/* Navigointipalkki */
.nav-bar {
    background-color: var(--primary);
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 100;
}

.nav-btn {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #bdc3c7;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.nav-btn:hover {
    color: white;
    background-color: rgba(255,255,255,0.1);
}

.nav-btn.active {
    color: white;
    background-color: var(--accent);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

/* Pelinäkymät */
.game-view {
    display: none;
    flex: 1;
    height: calc(100vh - 65px);
    overflow: hidden;
}

.game-view.active {
    display: flex;
}

/* ==========================================
   RISTINOLLA TYYLIT
   ========================================== */
.tic-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.settings-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: var(--panel);
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    align-items: center;
    justify-content: center;
}

.mode-selector {
    display: flex;
    gap: 5px;
    background-color: #e0e6ed;
    padding: 5px;
    border-radius: 30px;
}

.mode-selector input { display: none; }
.mode-selector label {
    padding: 8px 16px;
    font-weight: 600;
    color: #576574;
    border-radius: 25px;
    cursor: pointer;
    transition: 0.2s;
}

.mode-selector input:checked + label {
    background-color: var(--primary);
    color: white;
}

.size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.size-selector input {
    width: 65px;
    padding: 6px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
}

.action-btn {
    padding: 8px 16px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.action-btn:hover { background-color: #1a252f; }

#tic-status { font-size: 1.5rem; font-weight: 600; margin-bottom: 5px; color: #2c3e50; text-shadow: 1px 1px 2px rgba(255,255,255,0.8); }
#tic-rule { font-size: 1.1rem; color: #e74c3c; font-weight: bold; margin-bottom: 15px; text-shadow: 1px 1px 2px rgba(255,255,255,0.8); }

.board-wrapper {
    max-width: 90vw;
    max-height: 50vh;
    overflow: auto;
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    background-color: #34495e;
    padding: 10px;
}

.board { display: grid; grid-gap: 6px; background-color: #34495e; }

.cell {
    background-color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    user-select: none;
}
.cell:hover { background-color: #f8f9fa; }
.cell:active { transform: scale(0.95); }
.cell.x { color: #ff4757; }
.cell.o { color: #1e90ff; }

#reset-tic { margin-top: 20px; background-color: var(--accent); padding: 12px 35px; border-radius: 30px; font-size: 1.1rem; }
#reset-tic:hover { background-color: #219a52; }

/* ==========================================
   LAPINKOIRA CLICKER TYYLIT
   ========================================== */
.clicker-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.score-box {
    background: var(--panel);
    padding: 15px 35px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    text-align: center;
    margin-bottom: 25px;
    min-width: 320px;
    border: 1px solid rgba(255,255,255,0.5);
}

#clk-score { font-size: 3.2rem; font-weight: bold; margin: 0; color: #2c3e50; }
.clk-lps { font-size: 1rem; color: #7f8c8d; margin-top: 5px; font-weight: 600; }
.clk-dpc { font-size: 1rem; color: var(--click-accent); margin-top: 3px; font-weight: 600; }

.clk-biome { 
    font-size: 0.9rem; 
    color: #d35400; 
    margin-top: 8px; 
    font-weight: bold; 
    text-transform: uppercase; 
    letter-spacing: 1.5px;
    background: rgba(230, 126, 34, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}

/* Pelialueen asettelu */
.clicker-gameplay-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 70px;
    width: 100%;
    max-width: 1000px;
    margin-top: 10px;
}

/* Klikattava koira */
.dog-container {
    position: relative;
    cursor: pointer;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    padding: 45px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transition: transform 0.05s, background 0.2s;
    text-align: center;
    border: 3px solid rgba(255,255,255,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}
.dog-container:hover { background: rgba(255, 255, 255, 0.65); box-shadow: 0 25px 50px rgba(0,0,0,0.15); }
.dog-container:active { transform: scale(0.94); }

#bigDog {
    width: 200px;
    height: 200px;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    filter: drop-shadow(0 12px 20px rgba(0,0,0,0.2));
}

/* ==========================================
   SLOTS / PELIKONE TYYLIT
   ========================================== */
.slots-wrapper {
    background: linear-gradient(135deg, #34495e 0%, #1a252f 100%);
    border: 4px solid var(--slot-gold);
    border-radius: 20px;
    padding: 20px;
    width: 320px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    flex-shrink: 0;
}

.slots-header {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--slot-gold);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.slots-machine {
    background: #0f172a;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    border: 2px solid #475569;
    box-shadow: inset 0 5px 15px rgba(0,0,0,0.6);
}

.slot-reel {
    background: #ffffff;
    color: #000;
    font-size: 2.8rem;
    width: 75px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2), 0 4px 6px rgba(0,0,0,0.3);
    font-family: monospace;
    transition: transform 0.1s ease;
}

.slots-info {
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: bold;
    min-height: 22px;
    color: #cbd5e1;
    text-align: center;
}
.slots-info.win { color: #2ecc71; animation: fadeIn 0.2s ease; }
.slots-info.lose { color: #e74c3c; }

.slots-bet-container {
    margin-top: 15px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slots-bet-row {
    display: flex;
    gap: 6px;
    width: 100%;
}

.slot-input {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 2px solid #475569;
    background: #1e293b;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    outline: none;
}
.slot-input:focus { border-color: var(--slot-gold); }

.slot-minmax-btn {
    padding: 6px 10px;
    background: #475569;
    border: none;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.slot-minmax-btn:hover { background: #64748b; }

.slot-spin-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(to bottom, #f1c40f, #f39c12);
    border: none;
    border-radius: 8px;
    color: #1a252f;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(243, 156, 18, 0.4);
    transition: transform 0.1s, filter 0.2s;
    text-transform: uppercase;
}
.slot-spin-btn:hover { filter: brightness(1.1); }
.slot-spin-btn:active { transform: scale(0.97); }
.slot-spin-btn:disabled { background: #64748b; color: #94a3b8; cursor: not-allowed; box-shadow: none; }

/* Kauppasivu oikealla */
.clicker-right {
    width: 400px;
    background: var(--panel);
    box-shadow: -5px 0 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.store-header {
    padding: 20px;
    background: var(--primary);
    color: white;
    text-align: center;
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.store-items { flex: 1; overflow-y: auto; padding: 20px; }

.store-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.store-item:hover:not(.disabled) {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}
.store-item.click-type:hover:not(.disabled) { border-color: var(--click-accent); }
.store-item.disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(100%); }

.item-icon { font-size: 2.5rem; margin-right: 15px; }
.item-details { flex: 1; }
.item-name { font-weight: bold; font-size: 1.1rem; color: #2c3e50; }
.item-cost { font-size: 0.95rem; color: #e74c3c; font-weight: bold; margin-top: 2px; }
.item-effect { font-size: 0.85rem; font-weight: 600; margin-top: 2px; }
.item-effect.passive { color: #7f8c8d; }
.item-effect.click { color: var(--click-accent); }
.item-count { font-size: 2rem; font-weight: bold; color: #bdc3c7; padding-left: 15px; opacity: 0.7; }

.floating-text {
    position: absolute;
    font-size: 2.2rem;
    font-weight: bold;
    color: #2c3e50;
    pointer-events: none;
    top: 25%;
    animation: floatUpAndFade 0.8s ease-out forwards;
    z-index: 10;
    text-shadow: 2px 2px 5px rgba(255,255,255,1), -2px -2px 5px rgba(255,255,255,1);
}

.cheat-container {
    background: #34495e;
    padding: 12px 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    text-align: center;
    border: 2px dashed #e74c3c;
    animation: fadeIn 0.3s ease-out;
    z-index: 10;
}
.cheat-title { color: #e74c3c; font-weight: bold; margin-bottom: 8px; font-size: 0.9rem; }
.cheat-input-field { padding: 6px 12px; border: 2px solid #bdc3c7; border-radius: 8px; width: 160px; font-size: 1rem; text-align: center; margin-right: 8px; outline: none; }

@keyframes floatUpAndFade {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-120px) scale(1.4); opacity: 0; }
}

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

@media (max-width: 950px) {
    .clicker-gameplay-area { flex-direction: column; gap: 40px; }
    .game-view.active { flex-direction: column; overflow-y: auto; }
    .clicker-right { width: 100%; height: auto; flex: none; }
    .clicker-left { height: auto; padding-bottom: 30px; flex: none; }
}