/* My First Data Center - Cyber-Lovecraftian Idle Clicker */
:root {
    --bg-color: #0a0e17;
    --panel-bg: #141b2d;
    --text-primary: #e8edf5;
    --text-secondary: #8b9dc3;
    --accent-blue: #4fc3f7;
    --accent-green: #69f0ae;
    --accent-red: #ff5252;
    --neon-purple: #e040fb;
    --border-color: #2a3f5f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #1a237e, #4a148c);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(79, 195, 247, 0.2);
}

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 8px;
    text-shadow: 0 0 20px var(--accent-blue), 0 0 40px var(--neon-purple);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 15px var(--accent-blue), 0 0 30px var(--neon-purple); }
    to { text-shadow: 0 0 25px var(--neon-purple), 0 0 50px var(--accent-blue); }
}

.subtitle {
    color: var(--text-secondary);
    font-style: italic;
}

/* Main Area Layout */
.main-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .main-area {
        grid-template-columns: 1fr;
    }
}

/* Fishing Zone */
.fishing-zone {
    background: var(--panel-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.river-scene {
    width: 100%;
    height: 250px;
    background: linear-gradient(180deg, #87ceeb 0%, #4682b4 40%, #3cb371 100%);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    transition: all 1s ease;
}

/* Act-specific river themes */
.river-scene.act-ii {
    background: linear-gradient(180deg, #90ee90 0%, #3cb371 40%, #6b8e23 100%);
}

.river-scene.act-iii {
    background: linear-gradient(180deg, #ff6347 0%, #4a004a 40%, #191970 100%);
}

.water {
    height: 70%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shore {
    height: 30%;
    background: #8b4513;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 20px;
    padding-bottom: 10px;
}

.player-icon, .rod {
    font-size: 2em;
}

.fish-icon {
    font-size: 3em;
    animation: fishSwim 2s ease-in-out infinite alternate;
}

@keyframes fishSwim {
    from { transform: translateX(-50px) rotate(10deg); }
    to { transform: translateX(50px) rotate(-10deg); }
}

.glow-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 0, 0.3) 0%, transparent 70%);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    from { opacity: 0.3; }
    to { opacity: 0.8; }
}

.hidden.hidden {
    display: none;
}

/* Fish Button */
.fish-button {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

.fish-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.4);
}

.fish-button:active {
    transform: translateY(0) scale(0.98);
}

.catch-info {
    margin-top: 15px;
    font-size: 1.1em;
    color: var(--accent-green);
    text-align: center;
    min-height: 30px;
    font-weight: bold;
}

/* Stats Panel */
.stats-panel {
    background: var(--panel-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.stats-panel h2 {
    color: var(--accent-blue);
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: bold;
    color: var(--accent-green);
}

.phase-indicator {
    margin-top: 15px;
    padding: 10px;
    background: rgba(79, 195, 247, 0.1);
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    color: var(--accent-blue);
}

.save-controls {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.small-btn {
    background: #1e3a5f;
    color: white;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 4px;
    cursor: pointer;
}

.small-btn:hover {
    background: #2a5f8b;
}

/* Upgrade Shop */
.upgrade-section {
    margin-bottom: 30px;
}

.upgrade-section h2 {
    color: var(--accent-purple, #e040fb);
    margin-bottom: 10px;
}

.shop-flavor {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

/* Upgrade Cards */
.upgrade-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
}

.upgrade-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-blue);
}

.upgrade-card.locked {
    opacity: 0.6;
    filter: grayscale(70%);
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.upgrade-name {
    font-weight: bold;
    color: var(--accent-blue);
}

.upgrade-cost {
    background: #1e3a5f;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
}

.upgrade-cost.affordable {
    background: #2e7d32;
}

.upgrade-requirement {
    color: var(--accent-red);
    font-size: 0.85em;
    margin-bottom: 10px;
    font-style: italic;
}

.upgrade-description {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.buy-btn {
    width: 100%;
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    color: white;
    border: none;
    padding: 8px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
}

.buy-btn:hover {
    filter: brightness(1.1);
}

/* Narrative Log */
.narrative-section {
    background: var(--panel-bg);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.narrative-section h2 {
    color: var(--neon-purple);
    margin-bottom: 15px;
}

.log-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.log-entry {
    background: rgba(30, 58, 95, 0.6);
    border-left: 3px solid var(--accent-blue);
    padding: 12px 15px;
    margin-bottom: 12px;
    border-radius: 0 6px 6px 0;
}

.log-entry.narrative {
    border-left-color: var(--neon-purple);
    background: rgba(224, 64, 251, 0.1);
}

.log-entry.text-message {
    border-left-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.log-timestamp {
    font-size: 0.75em;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

/* Endgame Overlay */
.endgame-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.endgame-content {
    background: var(--panel-bg);
    border-radius: 15px;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 10px 50px rgba(79, 195, 247, 0.3);
}

.endgame-content h2 {
    color: var(--accent-blue);
    font-size: 2em;
    margin-bottom: 20px;
}

#continueBtn {
    margin-top: 20px;
    margin-right: 10px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a5f8b;
}

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.log-entry {
    animation: slideIn 0.4s ease-out;
}

/* Floating text effect */
.float-text {
    position: absolute;
    font-weight: bold;
    color: var(--accent-green);
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
}

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

/* Illustrated river scene */
#riverScene { height:auto;aspect-ratio:1.75;position:relative;overflow:hidden;border:1px solid #72bdd0;border-radius:12px;background:#7acddd; }
#fishingCanvas { display:block;width:100%;height:100%; }
.weather-label { position:absolute;top:12px;left:12px;padding:6px 10px;border-radius:16px;background:#102e46b8;color:#f0fcff;font-size:12px;pointer-events:none; }
@media(max-width:600px){ #riverScene { aspect-ratio:1.3; } }

/* Keep the idle game and its controls within narrow phone screens. */
html { -webkit-text-size-adjust:100%; }
body { overflow-x:hidden; }
.game-container { width:min(100%,1240px); padding:clamp(10px,3vw,20px); }
.game-header, .fishing-zone, .stats-panel, .upgrade-section, .narrative-section { min-width:0; }
.game-header h1 { font-size:clamp(1.45rem,6vw,2.5rem); }
.main-area { grid-template-columns:minmax(0,2fr) minmax(250px,1fr); }
.upgrades-grid { grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr)); }
.save-controls { flex-wrap:wrap; }
button, input, select { max-width:100%; }
@media(max-width:760px) {
    .main-area { grid-template-columns:minmax(0,1fr); }
    .game-header { margin-bottom:16px; padding:18px 14px; }
    .game-header h1 { line-height:1.2; }
    .fishing-zone, .stats-panel, .upgrade-section, .narrative-section { padding:16px; }
    .river-scene { min-height:170px; }
    .fish-button { min-height:52px; max-width:100%; padding:12px 22px; font-size:1.1em; }
    .save-controls { gap:8px; }
    .save-controls button { min-height:44px; flex:1 1 auto; }
    .endgame-content { width:min(100%,600px); max-height:90svh; overflow:auto; padding:24px 18px; }
    .endgame-content h2 { font-size:1.55em; }
}
@media(max-width:420px) {
    .game-container { padding:10px; }
    .stat-item { gap:10px; font-size:14px; }
    .stat-value { text-align:right; overflow-wrap:anywhere; }
    .upgrades-grid { grid-template-columns:minmax(0,1fr); }
}
