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

:root {
    --bg: #f2f2f7;
    --card-bg: #fff;
    --text: #1c1c1e;
    --text-secondary: #8e8e93;
    --tint: #007aff;
    --tint-light: #e8f0fe;
    --separator: #c6c6c8;
    --green: #34c759;
    --red: #ff3b30;
    --orange: #ff9500;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 100px;
    -webkit-font-smoothing: antialiased;
}

.nav-bar {
    background: var(--card-bg);
    border-bottom: 0.5px solid var(--separator);
    padding: 12px 16px;
    padding-top: env(safe-area-inset-top, 12px);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255,255,255,0.9);
}

.nav-bar h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.nav-bar .nav-btn {
    background: none;
    border: none;
    color: var(--tint);
    font-size: 17px;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 8px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    margin: 12px 16px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.card .subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    font-size: 17px;
    font-family: inherit;
    background: var(--bg);
    border: none;
    border-radius: 10px;
    outline: none;
}

.form-group input:focus {
    background: var(--tint-light);
}

.btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:active {
    opacity: 0.7;
}

.btn-primary {
    background: var(--tint);
    color: #fff;
}

.btn-primary:disabled {
    opacity: 0.4;
}

.btn-secondary {
    background: var(--tint-light);
    color: var(--tint);
}

.status-message {
    padding: 14px 16px;
    margin: 8px 16px;
    border-radius: 12px;
    font-size: 15px;
    text-align: center;
    display: none;
}

.status-message.success {
    display: block;
    background: #e8f8e8;
    color: #1a7d32;
}

.status-message.error {
    display: block;
    background: #ffe8e8;
    color: #c41e1e;
}

.segmented-control {
    display: flex;
    background: var(--bg);
    border-radius: 9px;
    padding: 2px;
    margin: 12px 16px;
    overflow: hidden;
}

.segmented-control .segment {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.segmented-control .segment.active {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 12px 16px;
}

.photo-item {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.2s;
}

.photo-item:active {
    transform: scale(0.97);
}

.photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.photo-item .photo-info {
    padding: 8px 10px;
}

.photo-item .photo-info .name {
    font-size: 13px;
    font-weight: 500;
}

.photo-item .photo-info .desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.photo-item .photo-actions {
    display: flex;
    border-top: 0.5px solid var(--separator);
}

.photo-item .photo-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.photo-item .photo-actions button:active {
    background: var(--bg);
}

.photo-item .photo-actions .accept { color: var(--green); }
.photo-item .photo-actions .discard { color: var(--red); }
.photo-item .photo-actions .review { color: var(--orange); }

.category-section {
    margin: 8px 16px;
}

.category-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    padding: 0 4px;
}

.category-section .count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding: 0 4px;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.3;
}

.empty-state .text {
    font-size: 16px;
}

.auth-card {
    margin-top: 80px;
}

.hidden { display: none; }

#detail-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#detail-view.active {
    display: flex;
}

#detail-view img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
}

#detail-view .close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    font-size: 20px;
    cursor: pointer;
}

#detail-view .detail-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 16px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

@media (min-width: 600px) {
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .card { max-width: 500px; margin: 12px auto; }
    .auth-card { max-width: 400px; }
}
