:root {
    --bg-color: #1a1a1a;
    --panel-bg: #222222;
    --text-main: #e0e0e0;
    --text-dim: #888888;
    --accent-color: #ff3b30; /* 经典复古红 */
    --accent-yellow: #ffcc00;
    --lcd-bg: #2a2a2a;
    --font-stack: 'Space Mono', monospace, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    width: 100%;
    text-transform: uppercase; /* 复古设备常全大写 */
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background-color: #000;
}

/* --- Top Strip (Static Flex Item) --- */
.top-strip {
    flex: 0 0 auto; /* Don't shrink or grow */
    background: #1a1a1a;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    z-index: 20;
}

.brand-badge {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 1px;
    color: var(--text-main);
    border: 1px solid var(--text-dim);
    padding: 2px 6px;
    border-radius: 2px;
}

.settings-row {
    display: flex;
    gap: 15px;
}

.retro-select-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.retro-select-group label {
    font-size: 8px;
    color: var(--text-dim);
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.retro-select-group select {
    background: transparent;
    color: var(--accent-yellow);
    border: none;
    font-family: var(--font-stack);
    font-size: 12px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    text-align: right;
    padding-right: 15px;
    /* Custom Arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 12px;
}

/* --- Viewfinder (Flex 1, Canvas) --- */
.viewfinder-container {
    flex: 1; /* Take up all remaining space */
    position: relative;
    background-color: #050505;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

canvas {
    display: block;
    /* Max limits to ensure it fits within container */
    max-width: 100%;
    max-height: 100%;
    /* Let JS control actual size, but CSS keeps it contained */
    object-fit: contain; 
}

/* --- Bottom Control Deck (Static Flex Item) --- */
.control-deck {
    flex: 0 0 auto; /* Don't shrink or grow */
    background: #1a1a1a;
    padding: 20px 30px 40px; /* Safe area padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #333;
    z-index: 20;
}

/* --- Buttons --- */
.deck-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.deck-btn:active {
    transform: scale(0.95);
    color: var(--accent-color);
}

.icon-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
}

.notification-dot {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--accent-color);
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--panel-bg);
}

/* --- Shutter Button (Retro) --- */
.shutter-btn-retro {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #e0e0e0; /* Metal ring */
    border: none;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
}

.shutter-btn-retro:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.shutter-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #aaa;
    box-sizing: border-box;
}

.shutter-cap {
    width: 56px;
    height: 56px;
    background: radial-gradient(circle at 30% 30%, #ff5e52, #cc0000);
    border-radius: 50%;
    border: 2px solid #aa0000;
}


/* --- Gallery Overlay --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--panel-bg);
    border-bottom: 1px solid #333;
}

.overlay-header h2 {
    font-size: 14px;
    letter-spacing: 2px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    cursor: pointer;
}

.gallery-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 2px;
    background: #000;
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

.gallery-item {
    position: relative;
    padding-bottom: 100%;
    overflow: hidden;
    cursor: pointer;
    background: #111;
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 101;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.gallery-preview img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.preview-actions {
    position: absolute;
    bottom: 30px;
    display: flex;
    gap: 20px;
    width: 100%;
    justify-content: center;
}

.retro-action-btn {
    background: var(--panel-bg);
    color: var(--text-main);
    border: 1px solid var(--text-dim);
    padding: 10px 20px;
    font-family: var(--font-stack);
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
}

.retro-action-btn:active {
    background: var(--text-dim);
    color: #000;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}