/* Secret Life of Fishies — Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: #0a1628;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

canvas#tank {
    display: block;
    width: 100%; height: 100%;
    position: fixed; top: 0; left: 0;
}

/* Start overlay */
#start-overlay {
    position: fixed; inset: 0;
    background: rgba(10, 22, 40, 0.95);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    transition: opacity 0.5s;
}
#start-overlay.hidden { opacity: 0; pointer-events: none; }
.start-content { text-align: center; color: #b0d4f1; }
.start-content h1 { font-size: 1.8rem; margin-bottom: 0.5rem; color: #e0f0ff; }
.start-content p { font-size: 0.95rem; margin-bottom: 1.5rem; opacity: 0.7; }
#start-btn {
    padding: 0.8rem 2rem; font-size: 1.1rem;
    border: 2px solid #4a9eff; background: rgba(74, 158, 255, 0.15);
    color: #4a9eff; border-radius: 2rem; cursor: pointer;
    transition: background 0.2s;
}
#start-btn:active { background: rgba(74, 158, 255, 0.35); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#hud-top-right { position: absolute; top: 12px; right: 12px; }
#hud-bottom {
    position: absolute; bottom: 0; left: 0; right: 0;
    display: flex; flex-direction: column; gap: 4px;
    padding: 8px 12px;
}
#coin-row, #xp-row {
    display: flex; align-items: center; gap: 8px;
}
#coin-bar-container {
    flex: 1; height: 4px; background: rgba(255,255,255,0.1);
    border-radius: 2px; overflow: hidden;
}
#coin-bar {
    height: 100%; width: 0%; background: #f9d849;
    transition: width 0.3s;
}

#coin-count {
    color: #f9d849; font-size: 0.75rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    min-width: 36px; white-space: nowrap;
}

#pellet-count {
    color: #a0c8a0; font-size: 0.72rem;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    min-width: 36px;
}

#menu-btn {
    background: rgba(0,0,0,0.3); border: none; color: #cde;
    font-size: 1.4rem; width: 40px; height: 40px;
    border-radius: 8px; cursor: pointer; line-height: 1;
}
#menu-btn:active { background: rgba(0,0,0,0.5); }

#xp-bar-container {
    flex: 1; height: 4px; background: rgba(255,255,255,0.1);
    border-radius: 2px; overflow: hidden;
}
#xp-bar {
    height: 100%; width: 0%; background: #4a9eff;
    transition: width 0.3s;
}
#xp-label {
    color: rgba(255,255,255,0.5); font-size: 0.7rem;
    white-space: nowrap;
}

/* Drawer */
#drawer-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 20; transition: opacity 0.3s;
}
#drawer-overlay.hidden { opacity: 0; pointer-events: none; }

#drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(320px, 85vw); background: #0f1d30;
    z-index: 30; transform: translateX(0);
    transition: transform 0.3s ease;
    display: flex; flex-direction: column;
    color: #b0c8e0;
}
#drawer.hidden { transform: translateX(100%); }

#drawer-tabs {
    display: flex; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tab {
    flex: 1; padding: 12px 0; background: none; border: none;
    color: rgba(255,255,255,0.4); font-size: 0.85rem; cursor: pointer;
    border-bottom: 2px solid transparent; transition: all 0.2s;
}
.tab.active { color: #4a9eff; border-bottom-color: #4a9eff; }

#drawer-content {
    flex: 1; overflow-y: auto; padding: 16px;
    -webkit-overflow-scrolling: touch;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel h3 { font-size: 0.9rem; color: #6090b0; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Stats bars */
.stat-row {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px; font-size: 0.8rem;
}
.stat-row label { width: 60px; color: #7090a8; }
.bar-bg {
    flex: 1; height: 8px; background: rgba(255,255,255,0.08);
    border-radius: 4px; overflow: hidden;
}
.bar { height: 100%; border-radius: 4px; transition: width 0.3s, background 0.3s; width: 0%; }
.ammonia-bar { background: #e6c84a; }
.nitrite-bar { background: #e67ab0; }
.nitrate-bar { background: #6abe6a; }
.bacteria-bar { background: #5a9ed6; }
.algae-bar { background: #7ab85a; }
.stat-val { width: 28px; text-align: right; font-size: 0.75rem; color: #608090; }

.tank-actions { margin-top: 16px; }
#btn-water-change {
    width: 100%; padding: 10px; border: 1px solid #4a9eff;
    background: rgba(74, 158, 255, 0.1); color: #4a9eff;
    border-radius: 8px; font-size: 0.9rem; cursor: pointer;
    margin-bottom: 12px;
}
#btn-water-change:active { background: rgba(74, 158, 255, 0.25); }

.toggle-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.85rem; color: #7090a8; cursor: pointer;
}
.toggle-row input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: #4a9eff;
}

/* Store list */
#store-capacity {
    font-size: 0.8rem; color: #6090b0; margin-bottom: 12px;
    padding: 6px 10px; background: rgba(255,255,255,0.04); border-radius: 6px;
}
.store-item, .fish-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; margin-bottom: 8px;
    background: rgba(255,255,255,0.04); border-radius: 8px;
    cursor: pointer; transition: background 0.15s;
}
.store-item:active, .fish-item:active { background: rgba(255,255,255,0.08); }
.store-item.locked { opacity: 0.4; cursor: default; }
.store-item .preview {
    width: 36px; height: 36px; border-radius: 50%;
    flex-shrink: 0;
}
.store-item .info, .fish-item .info { flex: 1; }
.store-item .name, .fish-item .name { font-size: 0.85rem; color: #c0d8e8; }
.store-item .detail, .fish-item .detail { font-size: 0.72rem; color: #607888; margin-top: 2px; }
.fish-item .happiness-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0;
}

/* Fish stats popup */
#fish-stats-popup {
    position: fixed;
    transform: translate(-50%, -100%);
    background: rgba(10, 20, 35, 0.9);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 10px;
    padding: 10px 14px;
    z-index: 15;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s;
    min-width: 130px;
}
#fish-stats-popup.visible { opacity: 1; }
#fish-stats-popup .stats-name {
    font-size: 0.8rem;
    color: #c0d8e8;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
}
#fish-stats-popup .stats-body {
    font-size: 0.7rem;
    color: #8aa8c0;
    line-height: 1.5;
}
#fish-stats-popup .stats-body b {
    color: #c0d8e8;
}

/* View hint */
.view-hint {
    position: fixed; bottom: 40px; left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.3); font-size: 0.75rem;
    pointer-events: none; z-index: 5;
    transition: opacity 0.5s;
}
