:root {
    --bg-gradient: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 99%, #FECFEF 100%);
    --card-bg: rgba(255, 255, 255, 0.45);
    --card-border: rgba(255, 255, 255, 0.4);
    --text-color: #2D3748;
    --text-muted: #718096;
    --shadow-color: rgba(31, 38, 135, 0.15);
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-border: rgba(255, 255, 255, 0.3);
    --btn-bg: linear-gradient(135deg, #FF0844 0%, #FFB199 100%);
    --btn-text: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.2);
    --hint-bg: #E2E8F0;
    --hint-text: #4A5568;
}

[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #0F2027 0%, #203A43 50%, #2C5364 100%);
    --card-bg: rgba(26, 32, 44, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-color: #E2E8F0;
    --text-muted: #A0AEC0;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --input-bg: rgba(10, 10, 15, 0.5);
    --input-border: rgba(255, 255, 255, 0.1);
    --btn-bg: linear-gradient(135deg, #8A2387 0%, #E94057 50%, #F27121 100%);
    --btn-text: #ffffff;
    --header-bg: rgba(0, 0, 0, 0.25);
    --hint-bg: #2D3748;
    --hint-text: #E2E8F0;
}

[data-theme="golden"] {
    --bg-gradient: linear-gradient(135deg, #111111 0%, #2A2000 50%, #4D3D00 100%);
    --card-bg: rgba(42, 32, 0, 0.45);
    --card-border: rgba(255, 215, 0, 0.25);
    --text-color: #FFE680;
    --text-muted: #D4AF37;
    --shadow-color: rgba(212, 175, 55, 0.2);
    --input-bg: rgba(20, 15, 0, 0.5);
    --input-border: rgba(255, 215, 0, 0.2);
    --btn-bg: linear-gradient(135deg, #BF953F 0%, #FCF6BA 25%, #B38728 50%, #FBF5B7 75%, #AA771C 100%);
    --btn-text: #231207;
    --header-bg: rgba(42, 32, 0, 0.3);
    --hint-bg: #3A2F00;
    --hint-text: #FFE680;
}

* { box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    text-align: center;
    padding: 0;
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: background 0.5s ease, color 0.5s ease;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Modal Overlay styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    width: 320px;
    padding: 24px;
    border-radius: 24px;
    color: var(--text-color);
    box-shadow: 0 10px 30px var(--shadow-color);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

/* Profile input styling */
.profile-field {
    text-align: left;
    margin-bottom: 16px;
}

.profile-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.profile-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.char-count {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.6;
    transition: color 0.2s;
}

.char-count.limit-reached {
    color: #EF4444;
    opacity: 1;
}

.profile-input-wrapper {
    display: flex;
    gap: 8px;
}

.profile-input {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    height: 40px;
    box-sizing: border-box;
}

.profile-input:focus {
    border-color: var(--text-color);
}

.btn-save {
    background: linear-gradient(45deg, #10B981, #059669);
    border: none;
    color: white;
    padding: 0 16px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-save:hover {
    opacity: 0.9;
}

.btn-save:active {
    transform: scale(0.95);
}

/* Stats display styling */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 16px;
    text-align: center;
}

.stat-box.full-width {
    grid-column: span 2;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    font-weight: 600;
}

/* Action buttons styling */
.btn-reset {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #EF4444;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-install {
    width: 100%;
    background: linear-gradient(45deg, #10B981, #059669);
    border: none;
    color: white;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    height: 40px;
    box-sizing: border-box;
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.btn-install:hover {
    opacity: 0.9;
}

.btn-install:active {
    transform: scale(0.98);
}

.save-status {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    height: 16px;
    transition: opacity 0.3s;
    opacity: 0;
}

/* Preferences Toggle Buttons */
.preferences-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.preference-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 10px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    height: 40px;
}

.preference-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.preference-btn:active {
    transform: scale(0.97);
}

.preference-btn svg {
    width: 16px;
    height: 16px;
}

.preference-btn.active {
    color: #E94057;
    border-color: rgba(233, 64, 87, 0.4);
    background: rgba(233, 64, 87, 0.1);
    box-shadow: 0 0 10px rgba(233, 64, 87, 0.2);
}
