:root {
    /* Gentleman's Lounge - Luxury Dark Palette */
    --bg-primary: #0D0D0D;
    --bg-secondary: #141414;
    --bg-surface: #1C1C1C;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(212, 175, 55, 0.15);

    --accent-gold: #D4AF37;
    --accent-gold-dim: #C5A028;
    --accent-gold-light: #F3E5AB;

    --text-primary: #F2F2F2;
    --text-secondary: #B0B0B0;
    --text-muted: #666666;

    --success: #81C784;
    --danger: #FF5252;

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;

    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 15px rgba(212, 175, 55, 0.2);

    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.6;
    min-height: 100vh;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--accent-gold-dim);
    border-radius: 10px;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    letter-spacing: 0.01em;
}

/* Layout */
.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    padding-bottom: 100px;
}

/* Header */
.main-header {
    background: rgba(13, 13, 13, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.3));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    flex-shrink: 0;
}

.brand-logo:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 12px rgba(212, 175, 55, 0.5));
}

.brand h1 {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
    background: linear-gradient(135deg, #E8D4A0 0%, var(--accent-gold) 50%, #C9A961 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1.2;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lang-toggle {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    padding: 6px 14px;
    border-radius: 30px;
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lang-toggle:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: var(--shadow-glow);
}

.header-stats {
    text-align: right;
}

.header-stats span {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    font-family: var(--font-heading);
    color: var(--text-primary);
}

.header-stats small {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-gold);
}

/* Records List */
.records-feed {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.record-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
    animation: fadeIn 0.6s ease-out;
}

.record-card:active {
    transform: scale(0.98);
}

/* Card Photo */
.card-photo {
    width: 100%;
    max-height: 240px;
    min-height: 180px;
    object-fit: cover;
    object-position: center;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    background: rgba(20, 20, 20, 0.5);
}

.card-photo:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25);
    border-color: rgba(212, 175, 55, 0.4);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.card-title h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.card-title p {
    color: var(--accent-gold);
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.9;
}

.card-rating {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    padding: 6px 10px;
    border-radius: 12px;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 1rem;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.meta-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: 30px;
    letter-spacing: 0.5px;
}

.card-notes {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 2px solid var(--accent-gold);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.btn-delete {
    background: rgba(255, 82, 82, 0.1);
    border: none;
    color: var(--danger);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 30px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dim));
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.3);
    border: none;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 500;
    transition: var(--transition-smooth);
}

.fab:hover {
    transform: translateY(-5px) rotate(90deg);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.modal[open] {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-wrapper {
    background: var(--bg-surface);
    width: 100%;
    border-radius: 32px 32px 0 0;
    padding: 30px;
    border-top: 1px solid var(--border-glass);
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.8);
    max-height: 92vh;
    overflow-y: auto;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h2 {
    font-size: 1.6rem;
    color: var(--text-primary);
}

.btn-close {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
}

/* Form Styles */
.form-section {
    margin-bottom: 25px;
}

.form-section label {
    display: block;
    font-size: 0.7rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-weight: 700;
}

.input-group {
    margin-bottom: 16px;
    position: relative;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

input,
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

input:focus,
textarea:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-gold);
    outline: none;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.btn-save {
    width: 100%;
    background: linear-gradient(to right, var(--accent-gold), var(--accent-gold-dim));
    color: #000;
    padding: 20px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}

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

/* Smart UI Elements */
.smart-input-container {
    position: relative;
}

.smart-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--accent-gold);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    /* 移动端平滑滚动 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.smart-select-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

/* 向上展开的下拉菜单 */
.smart-select-dropdown.dropdown-upward {
    animation: fadeInUp 0.2s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .smart-select-dropdown {
        max-height: 40vh; /* 移动端限制最大高度为视口的 40% */
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    }

    .smart-select-item {
        padding: 16px 18px; /* 增大触摸区域 */
        font-size: 1rem;
    }

    /* 防止页面缩放 */
    .smart-input-container input {
        font-size: 16px; /* iOS 16px 以下会自动缩放 */
    }

    /* 移动端：阻止虚拟键盘 */
    .smart-input-container input[readonly] {
        opacity: 1;
        -webkit-user-select: none;
        user-select: none;
        cursor: pointer;
    }
}

.smart-select-item {
    padding: 14px 20px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: rgba(212, 175, 55, 0.1);
    user-select: none;
    -webkit-user-select: none;
}

.smart-select-item:active {
    background: rgba(212, 175, 55, 0.15);
    transform: scale(0.98);
}

.smart-select-item:last-child {
    border-bottom: none;
}

.smart-select-item:hover,
.smart-select-item.highlighted {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent-gold);
}

.match {
    color: var(--accent-gold-light);
    font-weight: 700;
    text-decoration: underline;
}

/* Photo Upload Component */
.photo-upload-container {
    width: 100%;
}

.photo-preview-card {
    width: 100%;
    min-height: 120px;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.6) 0%, rgba(20, 20, 20, 0.8) 100%);
    border: 2px dashed rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.photo-preview-card:hover {
    border-color: var(--accent-gold);
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.8) 0%, rgba(20, 20, 20, 0.9) 100%);
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.15);
    transform: translateY(-2px);
}

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 12px;
}

.photo-icon {
    stroke: var(--accent-gold);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.photo-preview-card:hover .photo-icon {
    opacity: 1;
    transform: scale(1.1);
}

.photo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.photo-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-gold);
    letter-spacing: 0.5px;
}

.photo-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.photo-preview-card:hover .photo-hint {
    opacity: 1;
    color: var(--accent-gold-light);
}

/* When photo is uploaded */
.photo-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.photo-preview-card.has-image {
    min-height: 200px;
    border-style: solid;
    border-color: var(--accent-gold);
    background: transparent;
}

.photo-preview-card.has-image:hover {
    transform: scale(1.02);
}

/* Action Buttons within Inputs */
.btn-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 1.2rem;
}

.smart-input-container input:not(:placeholder-shown)+.btn-clear {
    display: flex;
}

.btn-clear:hover {
    background: rgba(255, 82, 82, 0.2);
    color: var(--danger);
}

.smart-input-container input {
    padding-right: 48px;
}

/* Advanced Rating Control */
.rating-control {
    background: rgba(0, 0, 0, 0.2);
    padding: 24px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--border-glass);
}

.rating-display {
    display: block;
    font-size: 3rem;
    font-weight: 900;
    font-family: var(--font-heading);
    color: var(--accent-gold);
    margin-bottom: 10px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    outline: none;
    margin-top: 10px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-gold);
    color: #000;
    padding: 12px 30px;
    border-radius: 40px;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: var(--transition-smooth);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* iPad/Desktop */
@media (min-width: 768px) {
    body {
        background: #000;
    }

    .app-container {
        margin: 40px auto;
        border-radius: 30px;
        box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
        border: 1px solid var(--border-glass);
    }
}