/* ============================================
   HORSE BASTARD - Gameboy Color Style
   ============================================ */

/* === CSS RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === GAMEBOY COLOR PALETTE === */
:root {
    /* Main colors - warmer, richer GBC style */
    --bg-dark: #2c3e2c;
    --bg-main: #3d5c3d;
    --bg-light: #5a7d5a;

    /* Accent colors */
    --text-light: #c4d9a0;
    --text-bright: #e8f4c8;
    --text-dim: #8aa87a;

    /* Horse colors */
    --horse-body: #d4a056;
    --horse-dark: #8b6914;
    --horse-light: #f0c878;
    --horse-mane: #5c3d1e;

    /* UI colors */
    --btn-bg: #6b8f4a;
    --btn-hover: #8ab45a;
    --btn-border: #3d5c3d;
    --bar-bg: #2c3e2c;
    --bar-fill: #8ab45a;
    --bar-warning: #d4a056;
    --bar-critical: #c45c4a;

    /* Sky colors */
    --sky-top: #87ceeb;
    --sky-bottom: #b0e0e6;
    --hills-far: #5a7d5a;
    --hills-near: #4a6d4a;
    --ground: #6b5d3a;
    --grass: #5a7d5a;

    --game-max-width: 420px;
}

/* === TYPOGRAPHY === */
html {
    font-size: 16px;
}

body {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    line-height: 1.5;
    background: #1a2a1a;
    color: var(--text-light);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-font-smoothing: none;
}

/* === ANIMATED PAGE BACKGROUND === */
.page-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(180deg,
        #1a3a5c 0%,
        #2d5a7b 30%,
        #4a7a9a 60%,
        #6a9ab8 100%
    );
}

.bg-clouds {
    position: absolute;
    top: 10%;
    left: 0;
    width: 200%;
    height: 30%;
    background-image:
        radial-gradient(ellipse 80px 40px at 10% 50%, rgba(255,255,255,0.15) 0%, transparent 70%),
        radial-gradient(ellipse 120px 50px at 30% 30%, rgba(255,255,255,0.1) 0%, transparent 70%),
        radial-gradient(ellipse 100px 45px at 50% 60%, rgba(255,255,255,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 90px 40px at 70% 40%, rgba(255,255,255,0.08) 0%, transparent 70%),
        radial-gradient(ellipse 110px 50px at 90% 50%, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: clouds-drift 60s linear infinite;
}

@keyframes clouds-drift {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.bg-hills-far {
    position: absolute;
    bottom: 30%;
    left: 0;
    width: 100%;
    height: 25%;
    background: #2a4a3a;
    clip-path: polygon(
        0 100%, 0 60%, 8% 40%, 20% 55%, 35% 30%, 50% 50%, 65% 25%, 80% 45%, 92% 35%, 100% 55%, 100% 100%
    );
}

.bg-hills-near {
    position: absolute;
    bottom: 20%;
    left: 0;
    width: 100%;
    height: 25%;
    background: #3a5a4a;
    clip-path: polygon(
        0 100%, 0 70%, 15% 45%, 30% 60%, 45% 35%, 60% 55%, 75% 40%, 90% 60%, 100% 50%, 100% 100%
    );
}

.bg-grass {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25%;
    background: linear-gradient(180deg, #4a6a4a 0%, #3a5a3a 50%, #2a4a2a 100%);
}

.bg-fence {
    position: absolute;
    bottom: 18%;
    left: 0;
    width: 100%;
    height: 30px;
    background-image:
        repeating-linear-gradient(90deg, #3a2a1a 0px, #3a2a1a 8px, transparent 8px, transparent 60px);
}

.bg-fence::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #4a3a2a;
}

.bg-fence::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #4a3a2a;
}

/* === GLOBAL TICKER BAR === */
.global-ticker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(20, 30, 20, 0.95);
    border-bottom: 2px solid #4a6a4a;
    padding: 8px 0;
    z-index: 1000;
    overflow: hidden;
}

.ticker-scroll {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 0 16px;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-name {
    font-size: 8px;
    color: #d4a056;
    font-weight: bold;
}

.ticker-price {
    font-size: 8px;
    color: #e8f4c8;
}

.ticker-change {
    font-size: 7px;
    padding: 2px 6px;
    border-radius: 2px;
}

.ticker-change.positive {
    color: #80ff80;
    background: rgba(0, 255, 0, 0.15);
}

.ticker-change.negative {
    color: #ff6060;
    background: rgba(255, 0, 0, 0.15);
}

.ticker-label {
    font-size: 6px;
    color: #8aa87a;
}

.ticker-ca {
    font-size: 6px;
    color: #c4d9a0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticker-copy-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 5px;
    padding: 3px 6px;
    background: #4a6a4a;
    color: #e8f4c8;
    border: 1px solid #6a8a6a;
    cursor: pointer;
    transition: all 0.2s;
}

.ticker-copy-btn:hover {
    background: #6a8a6a;
}

.ticker-copy-btn.copied {
    background: #80ff80;
    color: #1a2a1a;
}

.ticker-separator {
    color: #4a6a4a;
    font-size: 8px;
}

.ticker-link {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #8ab0d0;
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid #4a6a8a;
    transition: all 0.2s;
}

.ticker-link:hover {
    background: #4a6a8a;
    color: #e8f4c8;
}

/* === CRT OVERLAY === */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.05),
        rgba(0, 0, 0, 0.05) 1px,
        transparent 1px,
        transparent 3px
    );
}

/* === GAME CONTAINER === */
.crt-screen {
    position: relative;
    width: 100%;
    max-width: var(--game-max-width);
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    max-height: 750px;
    margin-top: 40px;
    background-color: var(--bg-dark);
    overflow: hidden;
    border: 6px solid #3a5a3a;
    border-radius: 8px;
    box-shadow:
        inset 0 0 30px rgba(0,0,0,0.3),
        0 0 30px rgba(0,0,0,0.6),
        0 0 60px rgba(74, 106, 74, 0.2);
}

/* === SCREENS === */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: var(--bg-dark);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

.screen-frame {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* === TITLE SCREEN === */
#title-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-main) 100%);
}

.title-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Chart Preview */
.chart-preview {
    width: 280px;
    background: rgba(20, 30, 20, 0.9);
    border: 3px solid #4a6a4a;
    border-radius: 4px;
    padding: 10px;
    margin: 8px 0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #3a5a3a;
}

.chart-title {
    font-size: 8px;
    color: #d4a056;
}

.chart-price {
    font-size: 8px;
    color: #80ff80;
}

.chart-graph {
    position: relative;
    height: 60px;
    background: #1a2a1a;
    border: 1px solid #2a3a2a;
    padding: 4px;
    margin-bottom: 8px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 100%;
    gap: 2px;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, #4a8a4a 0%, #3a6a3a 100%);
    border-radius: 1px 1px 0 0;
    min-width: 8px;
    animation: bar-grow 1s ease-out forwards;
    transform-origin: bottom;
}

.chart-bar.highlight {
    background: linear-gradient(180deg, #80ff80 0%, #4a8a4a 100%);
    box-shadow: 0 0 8px rgba(128, 255, 128, 0.4);
}

@keyframes bar-grow {
    0% { transform: scaleY(0); }
    100% { transform: scaleY(1); }
}

.chart-bar:nth-child(1) { animation-delay: 0s; }
.chart-bar:nth-child(2) { animation-delay: 0.05s; }
.chart-bar:nth-child(3) { animation-delay: 0.1s; }
.chart-bar:nth-child(4) { animation-delay: 0.15s; }
.chart-bar:nth-child(5) { animation-delay: 0.2s; }
.chart-bar:nth-child(6) { animation-delay: 0.25s; }
.chart-bar:nth-child(7) { animation-delay: 0.3s; }
.chart-bar:nth-child(8) { animation-delay: 0.35s; }
.chart-bar:nth-child(9) { animation-delay: 0.4s; }
.chart-bar:nth-child(10) { animation-delay: 0.45s; }

.chart-line {
    position: absolute;
    bottom: 30%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(128, 255, 128, 0.3);
}

.chart-expand-btn {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #8ab0d0;
    text-decoration: none;
    text-align: center;
    padding: 6px;
    background: #2a3a3a;
    border: 1px solid #4a6a6a;
    transition: all 0.2s;
}

.chart-expand-btn:hover {
    background: #4a6a6a;
    color: #e8f4c8;
}

/* Title screen pixel horse */
.title-pixel-horse {
    width: 80px;
    height: 80px;
    margin-bottom: 8px;
    image-rendering: pixelated;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%233d5c3d' width='32' height='32'/%3E%3Crect fill='%235c3d1e' x='22' y='2' width='2' height='4'/%3E%3Crect fill='%23d4a056' x='20' y='4' width='4' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='6' width='8' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='8' width='8' height='2'/%3E%3Crect fill='%23f0c878' x='24' y='8' width='2' height='2'/%3E%3Crect fill='%232c3e2c' x='22' y='8' width='2' height='2'/%3E%3Crect fill='%23d4a056' x='16' y='10' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='14' y='12' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='10' y='14' width='14' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='16' width='16' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%23f0c878' x='10' y='16' width='4' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='20' width='16' height='2'/%3E%3Crect fill='%238b6914' x='8' y='22' width='4' height='4'/%3E%3Crect fill='%238b6914' x='18' y='22' width='4' height='4'/%3E%3Crect fill='%235c3d1e' x='6' y='18' width='2' height='4'/%3E%3C/svg%3E");
    background-size: 100% 100%;
}

.title-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.title-horse {
    font-size: 22px;
    color: var(--text-bright);
    letter-spacing: 3px;
    text-shadow: 3px 3px 0 var(--bg-dark);
}

.title-bastard {
    font-size: 16px;
    color: var(--horse-body);
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 var(--bg-dark);
}

.subtitle {
    font-size: 7px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.copyright {
    font-size: 6px;
    color: var(--text-dim);
    margin-top: 20px;
}

/* Pulse animation */
.pulse {
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === PIXEL BUTTONS === */
.pixel-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 12px 20px;
    background: var(--btn-bg);
    color: var(--text-bright);
    border: 3px solid var(--btn-border);
    border-top-color: var(--btn-hover);
    border-left-color: var(--btn-hover);
    cursor: pointer;
    text-transform: uppercase;
    transition: none;
}

.pixel-btn:hover {
    background: var(--btn-hover);
}

.pixel-btn:active {
    background: var(--bg-main);
    border-top-color: var(--btn-border);
    border-left-color: var(--btn-border);
    border-bottom-color: var(--btn-hover);
    border-right-color: var(--btn-hover);
}

.pixel-btn:disabled {
    background: var(--bg-main);
    color: var(--text-dim);
    cursor: not-allowed;
}

.pixel-btn.secondary {
    background: var(--bg-main);
    color: var(--text-light);
}

/* === DIFFICULTY SCREEN === */
.screen-title {
    font-size: 11px;
    color: var(--text-bright);
    margin-bottom: 28px;
    text-align: center;
    text-shadow: 2px 2px 0 var(--bg-dark);
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 220px;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px;
    width: 100%;
}

.diff-name {
    font-size: 11px;
}

.diff-desc {
    font-size: 7px;
    color: var(--text-dim);
}

/* === NAMING SCREEN === */
.naming-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.input-container {
    width: 100%;
    max-width: 220px;
}

.pixel-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    color: var(--text-bright);
    border: 3px solid var(--bg-light);
    text-align: center;
    text-transform: uppercase;
}

.pixel-input::placeholder {
    color: var(--text-dim);
}

.pixel-input:focus {
    outline: none;
    border-color: var(--btn-hover);
}

/* === LOADING SCREEN === */
.loading-horse {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    image-rendering: pixelated;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%233d5c3d' width='32' height='32'/%3E%3Crect fill='%235c3d1e' x='22' y='2' width='2' height='4'/%3E%3Crect fill='%23d4a056' x='20' y='4' width='4' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='6' width='8' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='8' width='8' height='2'/%3E%3Crect fill='%232c3e2c' x='22' y='8' width='2' height='2'/%3E%3Crect fill='%23d4a056' x='16' y='10' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='14' y='12' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='10' y='14' width='14' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='16' width='16' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='20' width='16' height='2'/%3E%3Crect fill='%238b6914' x='8' y='22' width='4' height='4'/%3E%3Crect fill='%238b6914' x='18' y='22' width='4' height='4'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    animation: loading-bounce 0.6s ease-in-out infinite;
}

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

.loading-text {
    font-size: 9px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.loading-bar {
    width: 180px;
    height: 14px;
    background: var(--bar-bg);
    border: 2px solid var(--bg-light);
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: var(--bar-fill);
    transition: width 0.2s steps(10);
}

/* === MAIN GAME SCREEN === */
#game-screen {
    padding: 0;
    gap: 0;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-main);
    border-bottom: 3px solid var(--bg-dark);
}

.header-title {
    font-size: 7px;
    color: var(--text-bright);
}

.header-time {
    font-size: 7px;
    color: var(--text-light);
}

/* === FARM SCENE === */
.farm-scene {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.farm-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Sky gradient */
.sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 55%;
    background: linear-gradient(180deg, #6eb5d9 0%, #a8d8ea 60%, #c9e8f0 100%);
}

/* Distant hills */
.hills {
    position: absolute;
    top: 35%;
    left: 0;
    width: 100%;
    height: 35%;
    background: var(--hills-far);
    clip-path: polygon(
        0 100%,
        0 70%,
        10% 50%,
        25% 65%,
        40% 40%,
        55% 60%,
        70% 35%,
        85% 55%,
        100% 45%,
        100% 100%
    );
}

/* Fence */
.fence {
    position: absolute;
    bottom: 32%;
    left: 0;
    width: 100%;
    height: 24px;
    z-index: 5;
}

.fence::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #5c4030;
}

.fence::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #5c4030;
}

/* Fence posts */
.fence {
    background-image: repeating-linear-gradient(
        90deg,
        #4a3020 0px,
        #4a3020 6px,
        transparent 6px,
        transparent 50px
    );
}

/* Ground / grass */
.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35%;
    background: linear-gradient(180deg, #7a9a5a 0%, #5a7a4a 50%, #4a6a3a 100%);
}

/* Grass texture */
.ground::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 8px,
        rgba(0,0,0,0.1) 8px,
        rgba(0,0,0,0.1) 10px
    );
}

/* Horse container - free roaming */
.horse-container {
    position: absolute;
    bottom: 28%;
    left: 50%;
    z-index: 10;
    transition: left 2s ease-in-out, bottom 1s ease-in-out;
}

/* Horse facing directions */
.horse-container.facing-left .pixel-horse {
    transform: scaleX(-1);
}

.horse-container.facing-right .pixel-horse {
    transform: scaleX(1);
}

.horse-shadow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 12px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
}

/* Barn decoration */
.barn-decor {
    position: absolute;
    bottom: 25%;
    right: 8%;
    width: 50px;
    height: 60px;
    z-index: 3;
}

/* Barn body */
.barn-decor::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: #8b4513;
    border: 2px solid #5c3010;
}

/* Barn roof */
.barn-decor::after {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    width: calc(100% + 10px);
    height: 40%;
    background: #4a3020;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

/* === PIXEL HORSE SPRITE === */
.pixel-horse {
    width: 72px;
    height: 72px;
    image-rendering: pixelated;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* Idle horse */
.pixel-horse.idle {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%235c3d1e' x='22' y='2' width='2' height='4'/%3E%3Crect fill='%23d4a056' x='20' y='4' width='4' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='6' width='8' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='8' width='8' height='2'/%3E%3Crect fill='%23f0c878' x='24' y='7' width='2' height='2'/%3E%3Crect fill='%231a1a1a' x='22' y='8' width='2' height='2'/%3E%3Crect fill='%23d4a056' x='16' y='10' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='14' y='12' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='10' y='14' width='14' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='16' width='16' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%23f0c878' x='10' y='16' width='6' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='20' width='16' height='2'/%3E%3Crect fill='%238b6914' x='8' y='22' width='4' height='6'/%3E%3Crect fill='%238b6914' x='18' y='22' width='4' height='6'/%3E%3Crect fill='%235c3d1e' x='5' y='17' width='3' height='5'/%3E%3C/svg%3E");
    animation: horse-idle 1.5s ease-in-out infinite;
}

@keyframes horse-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Happy horse */
.pixel-horse.happy {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%235c3d1e' x='22' y='0' width='2' height='4'/%3E%3Crect fill='%23d4a056' x='20' y='2' width='4' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='4' width='8' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='6' width='8' height='2'/%3E%3Crect fill='%23f0c878' x='24' y='5' width='2' height='2'/%3E%3Crect fill='%231a1a1a' x='22' y='6' width='2' height='2'/%3E%3Crect fill='%23d4a056' x='16' y='8' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='14' y='10' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='10' y='12' width='14' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='14' width='16' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='16' width='16' height='2'/%3E%3Crect fill='%23f0c878' x='10' y='14' width='6' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%238b6914' x='10' y='20' width='4' height='6'/%3E%3Crect fill='%238b6914' x='18' y='20' width='4' height='6'/%3E%3Crect fill='%235c3d1e' x='5' y='15' width='3' height='5'/%3E%3C/svg%3E");
    animation: horse-happy 0.4s ease-in-out infinite;
}

@keyframes horse-happy {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

/* Sad horse - head down */
.pixel-horse.sad {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%235c3d1e' x='24' y='6' width='2' height='3'/%3E%3Crect fill='%23d4a056' x='22' y='8' width='4' height='2'/%3E%3Crect fill='%23d4a056' x='20' y='10' width='8' height='2'/%3E%3Crect fill='%23d4a056' x='20' y='12' width='8' height='2'/%3E%3Crect fill='%231a1a1a' x='24' y='12' width='2' height='2'/%3E%3Crect fill='%23d4a056' x='16' y='14' width='12' height='2'/%3E%3Crect fill='%23d4a056' x='12' y='16' width='12' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='20' width='16' height='2'/%3E%3Crect fill='%238b6914' x='8' y='22' width='4' height='6'/%3E%3Crect fill='%238b6914' x='18' y='22' width='4' height='6'/%3E%3Crect fill='%235c3d1e' x='6' y='19' width='2' height='3'/%3E%3C/svg%3E");
    animation: horse-sad 2s ease-in-out infinite;
}

@keyframes horse-sad {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(2px); }
}

/* Sick horse */
.pixel-horse.sick {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%235c3d1e' x='22' y='2' width='2' height='4'/%3E%3Crect fill='%23a08050' x='20' y='4' width='4' height='2'/%3E%3Crect fill='%23a08050' x='18' y='6' width='8' height='2'/%3E%3Crect fill='%23a08050' x='18' y='8' width='8' height='2'/%3E%3Crect fill='%231a1a1a' x='22' y='8' width='2' height='2'/%3E%3Crect fill='%23a08050' x='16' y='10' width='10' height='2'/%3E%3Crect fill='%23a08050' x='14' y='12' width='10' height='2'/%3E%3Crect fill='%23a08050' x='10' y='14' width='14' height='2'/%3E%3Crect fill='%23a08050' x='8' y='16' width='16' height='2'/%3E%3Crect fill='%23a08050' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%23a08050' x='8' y='20' width='16' height='2'/%3E%3Crect fill='%23706030' x='8' y='22' width='4' height='6'/%3E%3Crect fill='%23706030' x='18' y='22' width='4' height='6'/%3E%3Crect fill='%2390c060' x='26' y='10' width='4' height='3'/%3E%3C/svg%3E");
    animation: horse-sick 0.5s ease-in-out infinite;
}

@keyframes horse-sick {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Weird horse - inverted colors, glowing eye */
.pixel-horse.weird {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%23e0b0ff' x='22' y='2' width='2' height='4'/%3E%3Crect fill='%237050a0' x='20' y='4' width='4' height='2'/%3E%3Crect fill='%237050a0' x='18' y='6' width='8' height='2'/%3E%3Crect fill='%237050a0' x='18' y='8' width='8' height='2'/%3E%3Crect fill='%23ff0' x='22' y='8' width='2' height='2'/%3E%3Crect fill='%237050a0' x='16' y='10' width='10' height='2'/%3E%3Crect fill='%237050a0' x='14' y='12' width='10' height='2'/%3E%3Crect fill='%237050a0' x='10' y='14' width='14' height='2'/%3E%3Crect fill='%237050a0' x='8' y='16' width='16' height='2'/%3E%3Crect fill='%237050a0' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%237050a0' x='8' y='20' width='16' height='2'/%3E%3Crect fill='%235030a0' x='8' y='22' width='4' height='6'/%3E%3Crect fill='%235030a0' x='18' y='22' width='4' height='6'/%3E%3Crect fill='%23e0b0ff' x='5' y='17' width='3' height='5'/%3E%3C/svg%3E");
    animation: horse-weird 0.3s linear infinite;
}

@keyframes horse-weird {
    0%, 100% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg); }
    50% { transform: rotate(3deg) scale(1.02); filter: hue-rotate(30deg); }
}

/* Dead horse */
.pixel-horse.dead {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%23706050' x='2' y='18' width='4' height='2'/%3E%3Crect fill='%23a08060' x='4' y='14' width='4' height='6'/%3E%3Crect fill='%23a08060' x='8' y='12' width='16' height='8'/%3E%3Crect fill='%231a1a1a' x='6' y='14' width='2' height='2'/%3E%3Crect fill='%23a08060' x='24' y='14' width='4' height='6'/%3E%3Crect fill='%23706050' x='10' y='20' width='4' height='4'/%3E%3Crect fill='%23706050' x='18' y='20' width='4' height='4'/%3E%3Crect fill='%23706050' x='26' y='18' width='4' height='2'/%3E%3C/svg%3E");
    animation: none;
    opacity: 0.8;
}

/* === DIALOG BOX === */
.dialog-box {
    background: var(--bg-dark);
    border: 3px solid var(--bg-light);
    padding: 10px 12px;
    margin: 10px 12px;
}

.dialog-name {
    font-size: 6px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.dialog-text {
    font-size: 8px;
    color: var(--text-bright);
    line-height: 1.7;
    min-height: 28px;
}

/* === STATS PANEL === */
.stats-panel {
    padding: 8px 12px;
    background: var(--bg-dark);
    border-top: 2px solid var(--bg-main);
    border-bottom: 2px solid var(--bg-main);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

/* === PIXEL ICONS === */
.stat-icon {
    width: 12px;
    height: 12px;
    image-rendering: pixelated;
    background-size: 100% 100%;
}

.icon-apple {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%234a3020' x='3' y='0' width='2' height='2'/%3E%3Crect fill='%23e05040' x='1' y='2' width='6' height='5'/%3E%3Crect fill='%23ff7060' x='2' y='3' width='2' height='2'/%3E%3Crect fill='%23c04030' x='2' y='6' width='4' height='1'/%3E%3C/svg%3E");
}

.icon-heart {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23ff6080' x='1' y='1' width='2' height='2'/%3E%3Crect fill='%23ff6080' x='5' y='1' width='2' height='2'/%3E%3Crect fill='%23ff6080' x='0' y='2' width='8' height='3'/%3E%3Crect fill='%23ff9090' x='1' y='2' width='2' height='2'/%3E%3Crect fill='%23ff6080' x='1' y='5' width='6' height='1'/%3E%3Crect fill='%23ff6080' x='2' y='6' width='4' height='1'/%3E%3Crect fill='%23ff6080' x='3' y='7' width='2' height='1'/%3E%3C/svg%3E");
}

.icon-bolt {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23ffd040' x='4' y='0' width='2' height='2'/%3E%3Crect fill='%23ffd040' x='3' y='1' width='2' height='2'/%3E%3Crect fill='%23ffd040' x='2' y='2' width='4' height='2'/%3E%3Crect fill='%23ffe080' x='3' y='2' width='2' height='1'/%3E%3Crect fill='%23ffd040' x='1' y='4' width='5' height='1'/%3E%3Crect fill='%23ffd040' x='3' y='5' width='2' height='1'/%3E%3Crect fill='%23ffd040' x='2' y='6' width='2' height='1'/%3E%3Crect fill='%23ffd040' x='1' y='7' width='2' height='1'/%3E%3C/svg%3E");
}

.icon-cross {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%2350c050' x='3' y='0' width='2' height='8'/%3E%3Crect fill='%2350c050' x='0' y='3' width='8' height='2'/%3E%3Crect fill='%2380e080' x='3' y='1' width='1' height='2'/%3E%3Crect fill='%2380e080' x='1' y='3' width='2' height='1'/%3E%3C/svg%3E");
}

.icon-star {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23c080ff' x='3' y='0' width='2' height='2'/%3E%3Crect fill='%23c080ff' x='0' y='3' width='8' height='2'/%3E%3Crect fill='%23e0b0ff' x='3' y='3' width='2' height='2'/%3E%3Crect fill='%23c080ff' x='1' y='5' width='2' height='2'/%3E%3Crect fill='%23c080ff' x='5' y='5' width='2' height='2'/%3E%3Crect fill='%23c080ff' x='3' y='2' width='2' height='1'/%3E%3C/svg%3E");
}

.stat-label {
    font-size: 6px;
    width: 36px;
    color: var(--text-light);
}

.stat-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bar-bg);
    border: 2px solid var(--bg-main);
}

.stat-bar-fill {
    height: 100%;
    background: var(--bar-fill);
    transition: width 0.2s steps(10);
}

.stat-bar-fill.critical {
    background: var(--bar-critical);
    animation: bar-blink 0.4s steps(1) infinite;
}

@keyframes bar-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.stat-bar-fill.warning {
    background: var(--bar-warning);
}

.weird-track {
    border-color: #8060a0;
}

.weird-fill {
    background: linear-gradient(90deg, #8060c0 0%, #c080ff 100%);
}

.stat-value {
    font-size: 6px;
    width: 24px;
    text-align: right;
    color: var(--text-light);
}

/* === ACTIONS PANEL === */
.actions-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-main);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    background: var(--btn-bg);
    border: 2px solid var(--btn-border);
    border-top-color: var(--btn-hover);
    border-left-color: var(--btn-hover);
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    position: relative;
}

.action-btn:hover {
    background: var(--btn-hover);
}

.action-btn:active {
    background: var(--bg-light);
}

.action-btn:disabled {
    background: var(--bg-main);
    border-color: var(--bg-light);
    cursor: not-allowed;
}

/* Action icons */
.action-icon {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
    background-size: 100% 100%;
}

.icon-bucket {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23606060' x='1' y='0' width='6' height='1'/%3E%3Crect fill='%23808080' x='0' y='1' width='8' height='2'/%3E%3Crect fill='%23707070' x='1' y='3' width='6' height='4'/%3E%3Crect fill='%23909090' x='2' y='3' width='2' height='2'/%3E%3Crect fill='%23606060' x='2' y='7' width='4' height='1'/%3E%3C/svg%3E");
}

.icon-hand {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23f0c0a0' x='2' y='0' width='1' height='4'/%3E%3Crect fill='%23f0c0a0' x='3' y='0' width='1' height='5'/%3E%3Crect fill='%23f0c0a0' x='4' y='0' width='1' height='5'/%3E%3Crect fill='%23f0c0a0' x='5' y='1' width='1' height='4'/%3E%3Crect fill='%23f0c0a0' x='1' y='4' width='6' height='3'/%3E%3Crect fill='%23f0c0a0' x='0' y='5' width='2' height='2'/%3E%3Crect fill='%23e0b090' x='2' y='5' width='4' height='2'/%3E%3C/svg%3E");
}

.icon-shoe {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%234080e0' x='0' y='2' width='3' height='3'/%3E%3Crect fill='%234080e0' x='2' y='3' width='3' height='2'/%3E%3Crect fill='%234080e0' x='4' y='4' width='4' height='3'/%3E%3Crect fill='%23ffffff' x='0' y='5' width='8' height='2'/%3E%3Crect fill='%2360a0ff' x='1' y='2' width='1' height='2'/%3E%3C/svg%3E");
}

.icon-moon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23f0e060' x='2' y='0' width='4' height='1'/%3E%3Crect fill='%23f0e060' x='1' y='1' width='2' height='1'/%3E%3Crect fill='%23f0e060' x='0' y='2' width='2' height='4'/%3E%3Crect fill='%23fff080' x='1' y='2' width='1' height='2'/%3E%3Crect fill='%23f0e060' x='1' y='6' width='2' height='1'/%3E%3Crect fill='%23f0e060' x='2' y='7' width='4' height='1'/%3E%3Crect fill='%23f0e060' x='5' y='6' width='2' height='1'/%3E%3Crect fill='%23f0e060' x='6' y='2' width='1' height='4'/%3E%3C/svg%3E");
}

.icon-pill {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23ff6060' x='2' y='1' width='4' height='1'/%3E%3Crect fill='%23ff6060' x='1' y='2' width='6' height='2'/%3E%3Crect fill='%23ff8080' x='2' y='2' width='2' height='1'/%3E%3Crect fill='%23ffffff' x='1' y='4' width='6' height='2'/%3E%3Crect fill='%23ffffff' x='2' y='6' width='4' height='1'/%3E%3C/svg%3E");
}

.icon-chat {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23ffffff' x='0' y='0' width='8' height='5'/%3E%3Crect fill='%23e0e0e0' x='1' y='1' width='6' height='3'/%3E%3Crect fill='%23ffffff' x='0' y='5' width='3' height='2'/%3E%3Crect fill='%23404040' x='2' y='2' width='1' height='1'/%3E%3Crect fill='%23404040' x='4' y='2' width='2' height='1'/%3E%3C/svg%3E");
}

.icon-mystery {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Crect fill='%23c080ff' x='2' y='0' width='4' height='1'/%3E%3Crect fill='%23c080ff' x='1' y='1' width='2' height='1'/%3E%3Crect fill='%23c080ff' x='5' y='1' width='2' height='2'/%3E%3Crect fill='%23c080ff' x='4' y='3' width='2' height='1'/%3E%3Crect fill='%23c080ff' x='3' y='4' width='2' height='1'/%3E%3Crect fill='%23e0b0ff' x='4' y='3' width='1' height='1'/%3E%3Crect fill='%23c080ff' x='3' y='6' width='2' height='2'/%3E%3C/svg%3E");
}

.action-name {
    font-size: 5px;
    color: var(--text-bright);
}

.action-btn:disabled .action-name {
    color: var(--text-dim);
}

.action-cooldown {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 5px;
    color: var(--bar-warning);
    background: var(--bg-dark);
    padding: 1px 2px;
}

.action-btn:disabled .action-cooldown {
    display: block;
}

/* === FOOTER === */
.game-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 8px;
    background: var(--bg-dark);
    border-top: 2px solid var(--bg-main);
}

.footer-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 6px 12px;
    background: var(--bg-main);
    color: var(--text-light);
    border: 2px solid var(--bg-light);
    cursor: pointer;
}

.footer-btn:hover {
    background: var(--bg-light);
    color: var(--text-bright);
}

/* === MODALS === */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 40, 20, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-dark);
    border: 4px solid var(--bg-light);
    padding: 20px;
    width: 100%;
    max-width: 320px;
    text-align: center;
}

/* Event modal */
.event-header {
    margin-bottom: 12px;
}

.event-type {
    font-size: 9px;
    color: var(--text-bright);
    padding: 6px 12px;
    background: var(--bg-main);
    border: 2px solid var(--bg-light);
    display: inline-block;
}

.event-title {
    font-size: 10px;
    color: var(--text-bright);
    margin-bottom: 10px;
    line-height: 1.5;
}

.event-description {
    font-size: 7px;
    color: var(--text-light);
    margin-bottom: 14px;
    line-height: 1.7;
}

.event-dialog {
    margin-bottom: 14px;
}

.event-effects {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}

.effect-item {
    font-size: 7px;
    padding: 4px 8px;
    border: 2px solid;
}

.effect-item.positive {
    background: rgba(80, 192, 80, 0.2);
    border-color: #50c050;
    color: #80e080;
}

.effect-item.negative {
    background: rgba(192, 80, 80, 0.2);
    border-color: #c05050;
    color: #ff8080;
}

.effect-item.weird {
    background: rgba(160, 80, 192, 0.2);
    border-color: #a050c0;
    color: #e0b0ff;
}

/* Menu modal */
.menu-content {
    max-width: 220px;
}

.menu-title {
    font-size: 12px;
    color: var(--text-bright);
    margin-bottom: 20px;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-option {
    width: 100%;
}

/* === GAME OVER === */
#gameover-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #2a1a1a 0%, #1a1010 100%);
}

.gameover-content {
    text-align: center;
    padding: 24px;
}

.dead-horse {
    width: 80px;
    height: 40px;
    margin: 0 auto 20px;
    image-rendering: pixelated;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 16'%3E%3Crect fill='%23706050' x='2' y='8' width='4' height='2'/%3E%3Crect fill='%23a08060' x='4' y='4' width='6' height='8'/%3E%3Crect fill='%23a08060' x='10' y='4' width='14' height='8'/%3E%3Crect fill='%231a1a1a' x='6' y='6' width='2' height='2'/%3E%3Crect fill='%23a08060' x='24' y='6' width='4' height='6'/%3E%3Crect fill='%23706050' x='8' y='12' width='4' height='4'/%3E%3Crect fill='%23706050' x='18' y='12' width='4' height='4'/%3E%3Crect fill='%23706050' x='26' y='10' width='4' height='2'/%3E%3C/svg%3E");
    background-size: 100% 100%;
}

.gameover-title {
    font-size: 16px;
    color: #ff6060;
    margin-bottom: 14px;
    animation: blink 1s steps(1) infinite;
    text-shadow: 2px 2px 0 #400000;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.gameover-message {
    font-size: 8px;
    color: var(--text-light);
    margin-bottom: 18px;
    line-height: 1.7;
}

.final-stats {
    background: var(--bg-main);
    padding: 14px;
    margin-bottom: 18px;
    font-size: 7px;
    text-align: left;
    border: 2px solid var(--bg-light);
}

.final-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    color: var(--text-light);
}

.gameover-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* === VICTORY === */
#victory-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #2a3a1a 0%, #1a2a10 100%);
}

.victory-content {
    text-align: center;
    padding: 24px;
}

.victory-horse {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    image-rendering: pixelated;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect fill='%235c3d1e' x='22' y='0' width='2' height='4'/%3E%3Crect fill='%23d4a056' x='20' y='2' width='4' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='4' width='8' height='2'/%3E%3Crect fill='%23d4a056' x='18' y='6' width='8' height='2'/%3E%3Crect fill='%23f0c878' x='24' y='5' width='2' height='2'/%3E%3Crect fill='%231a1a1a' x='22' y='6' width='2' height='2'/%3E%3Crect fill='%23d4a056' x='16' y='8' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='14' y='10' width='10' height='2'/%3E%3Crect fill='%23d4a056' x='10' y='12' width='14' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='14' width='16' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='16' width='16' height='2'/%3E%3Crect fill='%23f0c878' x='10' y='14' width='6' height='2'/%3E%3Crect fill='%23d4a056' x='8' y='18' width='16' height='2'/%3E%3Crect fill='%238b6914' x='10' y='20' width='4' height='6'/%3E%3Crect fill='%238b6914' x='18' y='20' width='4' height='6'/%3E%3Crect fill='%235c3d1e' x='5' y='15' width='3' height='5'/%3E%3Crect fill='%23ffd700' x='12' y='0' width='6' height='4'/%3E%3Crect fill='%23ffd700' x='14' y='4' width='2' height='2'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    animation: horse-happy 0.4s ease-in-out infinite;
}

.victory-title {
    font-size: 14px;
    color: #80ff80;
    margin-bottom: 14px;
    text-shadow: 2px 2px 0 #004000;
}

.victory-message {
    font-size: 8px;
    color: var(--text-light);
    margin-bottom: 14px;
}

.victory-stats {
    background: var(--bg-main);
    padding: 14px;
    margin-bottom: 14px;
    font-size: 7px;
    text-align: left;
    border: 2px solid var(--bg-light);
}

.victory-dialog {
    margin-bottom: 18px;
}

/* === RESPONSIVE === */
@media (max-width: 420px) {
    .farm-scene {
        height: 150px;
    }

    .pixel-horse {
        width: 56px;
        height: 56px;
    }

    .actions-panel {
        gap: 4px;
        padding: 8px;
    }

    .action-btn {
        padding: 6px 2px;
    }

    .action-icon {
        width: 14px;
        height: 14px;
    }

    .action-name {
        font-size: 4px;
    }

    .stat-label {
        width: 30px;
        font-size: 5px;
    }
}

/* === UTILITIES === */
.hidden {
    display: none !important;
}

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

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

/* === HORSE ACTION ANIMATIONS === */

/* Particle container */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
}

/* Base particle style */
.particle {
    position: absolute;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    animation: particle-float 1s ease-out forwards;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
    z-index: 25;
}

@keyframes particle-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(0.5);
    }
}

/* Heart particles float up with wiggle */
.particle-heart {
    animation: particle-heart 1s ease-out forwards;
}

@keyframes particle-heart {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.2) translateX(5px);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8) translateX(-5px);
    }
}

/* Dust particles spread sideways */
.particle-dust {
    animation: particle-dust 0.8s ease-out forwards;
}

@keyframes particle-dust {
    0% {
        opacity: 0.8;
        transform: translateY(0) translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) translateX(30px);
    }
}

/* ZZZ particles float up slowly */
.particle-zzz {
    font-size: 10px;
    animation: particle-zzz 1.2s ease-out forwards;
}

@keyframes particle-zzz {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translateY(-10px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* Mystery particles spin and scatter */
.particle-mystery {
    animation: particle-mystery 1s ease-out forwards;
}

@keyframes particle-mystery {
    0% {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: rotate(360deg) translateY(-30px) scale(0.3);
    }
}

/* Horse container animations */
.horse-container {
    transition: transform 0.3s ease;
}

/* Horse moves right */
.horse-moving-right {
    animation: horse-run-right 0.6s ease-in-out forwards;
}

@keyframes horse-run-right {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(30%); }
}

/* Horse moves left (returns) */
.horse-moving-left {
    animation: horse-run-left 0.6s ease-in-out forwards;
}

@keyframes horse-run-left {
    0% { transform: translateX(30%); }
    100% { transform: translateX(-50%); }
}

/* Horse happy bounce */
.horse-happy-bounce {
    animation: horse-bounce 0.4s ease-in-out 3;
}

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

/* Horse nodding */
.horse-nodding {
    animation: horse-nod 0.2s ease-in-out 3;
}

@keyframes horse-nod {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    50% { transform: translateX(-50%) rotate(5deg); }
}

/* Horse shaking (pills reaction) */
.horse-shaking {
    animation: horse-shake 0.1s ease-in-out 5;
}

@keyframes horse-shake {
    0%, 100% { transform: translateX(-50%); }
    50% { transform: translateX(calc(-50% + 3px)); }
}

/* Horse sleeping (sinks down slightly) */
.horse-sleeping {
    animation: horse-sleep 1.5s ease-in-out infinite;
}

@keyframes horse-sleep {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(3px); }
}

/* Horse spinning (mystery action) */
.horse-spinning {
    animation: horse-spin 0.6s ease-in-out 2;
}

@keyframes horse-spin {
    0% { transform: translateX(-50%) rotate(0deg) scale(1); }
    50% { transform: translateX(-50%) rotate(180deg) scale(1.1); }
    100% { transform: translateX(-50%) rotate(360deg) scale(1); }
}

/* Action-specific sprite overrides */

/* Eating animation - head bobs down */
.pixel-horse.action-feed {
    animation: horse-eat 0.3s ease-in-out 4 !important;
}

@keyframes horse-eat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(5px) rotate(10deg); }
}

/* Pet animation - happy wiggle */
.pixel-horse.action-pet {
    animation: horse-pet-wiggle 0.2s ease-in-out 6 !important;
}

@keyframes horse-pet-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

/* Running animation - bounce faster */
.pixel-horse.action-run {
    animation: horse-gallop 0.15s steps(2) 8 !important;
}

@keyframes horse-gallop {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Nap animation - settle down */
.pixel-horse.action-nap {
    animation: horse-settle 1s ease-out forwards !important;
    opacity: 0.8;
}

@keyframes horse-settle {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(8px) scale(0.95); }
}

/* Pills animation - shudder */
.pixel-horse.action-pills {
    animation: horse-shudder 0.15s ease-in-out 8 !important;
}

@keyframes horse-shudder {
    0%, 100% { transform: translateX(0) scale(1); }
    50% { transform: translateX(2px) scale(1.02); }
}

/* Chat animation - head tilts */
.pixel-horse.action-chat {
    animation: horse-chat 0.5s ease-in-out 2 !important;
}

@keyframes horse-chat {
    0%, 100% { transform: rotate(0deg); }
    30% { transform: rotate(-5deg); }
    70% { transform: rotate(5deg); }
}

/* Mystery animation - glitch effect */
.pixel-horse.action-mystery {
    animation: horse-glitch 0.1s steps(2) 12 !important;
    filter: hue-rotate(90deg);
}

@keyframes horse-glitch {
    0%, 100% {
        transform: translateX(0) translateY(0);
        filter: hue-rotate(0deg);
    }
    25% {
        transform: translateX(-3px) translateY(2px);
        filter: hue-rotate(90deg);
    }
    50% {
        transform: translateX(3px) translateY(-2px);
        filter: hue-rotate(180deg);
    }
    75% {
        transform: translateX(-2px) translateY(-1px);
        filter: hue-rotate(270deg);
    }
}

/* Event reaction animations */
.pixel-horse.event-positive {
    animation: horse-celebrate 0.3s ease-in-out 4;
}

@keyframes horse-celebrate {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

.pixel-horse.event-negative {
    animation: horse-distressed 0.2s ease-in-out 5;
}

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

.pixel-horse.event-weird {
    animation: horse-weird-event 0.3s ease-in-out 5;
}

@keyframes horse-weird-event {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: hue-rotate(0deg);
    }
    50% {
        transform: scale(1.1) rotate(5deg);
        filter: hue-rotate(60deg);
    }
}

/* === ACHIEVEMENTS SYSTEM === */

/* Achievement notification popup */
.achievement-notification {
    position: fixed;
    top: 60px;
    right: 20px;
    background: rgba(15, 56, 15, 0.95);
    border: 3px solid #9bbc0f;
    border-radius: 4px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    animation: notification-slide-in 0.5s ease-out, notification-glow 1s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(155, 188, 15, 0.4);
}

.achievement-notification.fade-out {
    animation: notification-slide-out 0.5s ease-in forwards;
}

@keyframes notification-slide-in {
    0% {
        transform: translateX(120%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes notification-slide-out {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(120%);
        opacity: 0;
    }
}

@keyframes notification-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(155, 188, 15, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(155, 188, 15, 0.8);
    }
}

.achievement-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.achievement-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.achievement-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #9bbc0f;
    letter-spacing: 1px;
}

.achievement-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #e8f4c8;
}

.achievement-desc {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #8ab0d0;
}

/* Secret action unlock notification */
.secret-unlock-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(80, 20, 100, 0.95);
    border: 4px solid #b090e0;
    border-radius: 8px;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 2500;
    animation: secret-unlock-appear 0.6s ease-out;
    box-shadow: 0 0 40px rgba(176, 144, 224, 0.6);
}

.secret-unlock-notification.fade-out {
    animation: secret-unlock-disappear 0.5s ease-in forwards;
}

@keyframes secret-unlock-appear {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes secret-unlock-disappear {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
}

.secret-unlock-icon {
    font-size: 32px;
    animation: unlock-spin 1s ease-out;
}

@keyframes unlock-spin {
    0% { transform: rotate(-360deg); }
    100% { transform: rotate(0deg); }
}

.secret-unlock-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.secret-unlock-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #b090e0;
    letter-spacing: 1px;
}

.secret-unlock-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #e8f4c8;
    text-shadow: 0 0 10px rgba(176, 144, 224, 0.8);
}

/* Achievements modal */
.achievements-content {
    max-width: 400px;
    max-height: 80vh;
}

.achievements-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4a6a4a;
}

.achievements-title {
    font-size: 12px;
    color: #d4a056;
    margin: 0;
    text-align: center;
}

.achievements-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.achievements-progress span {
    font-size: 8px;
    color: #9bbc0f;
}

.achievements-bar {
    width: 120px;
    height: 10px;
    background: #1a2a1a;
    border: 2px solid #4a6a4a;
    border-radius: 2px;
    overflow: hidden;
}

.achievements-fill {
    height: 100%;
    background: linear-gradient(90deg, #9bbc0f 0%, #d4a056 100%);
    transition: width 0.5s ease-out;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 12px;
}

.achievements-list::-webkit-scrollbar {
    width: 6px;
}

.achievements-list::-webkit-scrollbar-track {
    background: #1a2a1a;
}

.achievements-list::-webkit-scrollbar-thumb {
    background: #4a6a4a;
    border-radius: 3px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(30, 50, 30, 0.8);
    border: 2px solid #3a5a3a;
    border-radius: 4px;
    transition: all 0.2s;
}

.achievement-item.unlocked {
    border-color: #9bbc0f;
    background: rgba(40, 60, 40, 0.9);
}

.achievement-item.locked {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.achievement-item.secret.locked {
    background: rgba(50, 30, 60, 0.5);
    border-color: #5a4a6a;
}

.achievement-item .achievement-icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.achievement-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.achievement-details .achievement-name {
    font-size: 7px;
    color: #e8f4c8;
}

.achievement-details .achievement-desc {
    font-size: 5px;
    color: #8aa87a;
}

.achievement-item.unlocked .achievement-name {
    color: #9bbc0f;
}

.achievements-secrets {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-top: 8px;
    border-top: 1px solid #3a5a3a;
}

.secrets-label {
    font-size: 6px;
    color: #b090e0;
}

.achievements-secrets #secrets-count {
    font-size: 6px;
    color: #d090f0;
}

/* Stats modal */
.stats-content {
    max-width: 380px;
    max-height: 80vh;
}

.stats-title {
    font-size: 12px;
    color: #d4a056;
    margin: 0 0 16px 0;
    text-align: center;
}

.stats-section {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(30, 50, 30, 0.6);
    border: 2px solid #4a6a4a;
    border-radius: 4px;
}

.stats-section-title {
    font-size: 8px;
    color: #9bbc0f;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #3a5a3a;
}

/* High scores list */
.high-scores-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.no-scores {
    font-size: 6px;
    color: #6a8a6a;
    text-align: center;
    margin: 0;
    padding: 10px;
}

.high-score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(40, 60, 40, 0.5);
    border-radius: 3px;
}

.high-score-item .rank {
    font-size: 7px;
    color: #d4a056;
    min-width: 24px;
}

.high-score-item .horse-name {
    font-size: 6px;
    color: #e8f4c8;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.high-score-item .days {
    font-size: 6px;
    color: #9bbc0f;
    min-width: 50px;
    text-align: right;
}

.high-score-item .ending-icon {
    font-size: 12px;
    min-width: 18px;
    text-align: center;
}

/* Endings grid */
.endings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.ending-item {
    font-size: 6px;
    padding: 8px;
    text-align: center;
    background: rgba(40, 60, 40, 0.5);
    border: 2px solid #3a5a3a;
    border-radius: 4px;
    transition: all 0.2s;
}

.ending-item.locked {
    opacity: 0.4;
    filter: grayscale(0.8);
}

.ending-item.discovered {
    border-color: #9bbc0f;
    background: rgba(50, 80, 50, 0.6);
    color: #e8f4c8;
}

.ending-item:nth-child(5) {
    grid-column: 1 / -1;
}

/* Lifetime stats */
.lifetime-stats {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.lifetime-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: rgba(40, 60, 40, 0.5);
    border-radius: 4px;
    min-width: 70px;
}

.lifetime-stat .stat-value {
    font-size: 14px;
    color: #9bbc0f;
}

.lifetime-stat .stat-label {
    font-size: 5px;
    color: #8aa87a;
    text-transform: uppercase;
}

/* Title screen button row */
.title-buttons-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.pixel-btn.small {
    padding: 8px 16px;
    font-size: 8px;
}

.pixel-btn.secondary {
    background: linear-gradient(180deg, #5a7d5a 0%, #3d5c3d 100%);
    border-color: #4a6d4a;
}

.pixel-btn.secondary:hover {
    background: linear-gradient(180deg, #6a8d6a 0%, #4d6c4d 100%);
}

/* Secret actions container */
.secret-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: rgba(60, 30, 80, 0.3);
    border-top: 2px solid #6a4a8a;
    border-bottom: 2px solid #6a4a8a;
    margin: 8px 0;
}

.secret-action {
    background: linear-gradient(180deg, #5a3a7a 0%, #3a2a5a 100%);
    border-color: #8a6aaa;
    color: #d0b0f0;
}

.secret-action:hover {
    background: linear-gradient(180deg, #7a5a9a 0%, #5a4a7a 100%);
    border-color: #a080c0;
    box-shadow: 0 0 10px rgba(160, 128, 192, 0.4);
}

.secret-action.cooldown {
    opacity: 0.5;
    cursor: not-allowed;
}

.secret-action .action-icon {
    font-size: 14px;
}

/* Konami code effects */
.konami-active {
    animation: konami-rainbow 0.5s linear infinite;
}

@keyframes konami-rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.konami-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
    animation: konami-flash-anim 0.5s ease-out forwards;
    pointer-events: none;
}

@keyframes konami-flash-anim {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* === SHARE BUTTON === */
.share-btn {
    margin-top: 16px;
    background: linear-gradient(180deg, #1a8cd8 0%, #0d5c94 100%);
    border-color: #4aa3e0;
    color: #ffffff;
    font-size: 7px;
    padding: 10px 20px;
}

.share-btn:hover {
    background: linear-gradient(180deg, #2a9ce8 0%, #1d6ca4 100%);
    border-color: #5ab3f0;
    box-shadow: 0 0 15px rgba(74, 163, 224, 0.5);
}

/* === LOADING INDICATOR === */
.dialog-loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #4a6a4a;
    border-top-color: #9bbc0f;
    border-radius: 50%;
    animation: spin-loading 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin-loading {
    to { transform: rotate(360deg); }
}

.dialog-text.loading::after {
    content: '...';
    animation: loading-dots 1s steps(3) infinite;
}

@keyframes loading-dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* API error state */
.api-error {
    color: #ff6a6a;
    font-size: 6px;
    padding: 4px 8px;
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid #ff6a6a;
    border-radius: 2px;
    margin-top: 8px;
    text-align: center;
}
