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

:root {
    --bg: #000;
    --bg2: #111;
    --bg3: #1a1a1a;
    --accent: #00c896;
    --accent2: #00a87e;
    --text: #fff;
    --text2: #aaa;
    --danger: #ff4757;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    overflow-x: hidden;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* Profile Screen */
.app-header {
    text-align: center;
    padding: 60px 20px 30px;
}

.app-header h1 {
    font-size: 2.5em;
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--text2);
}

.app-header h1 span { color: var(--accent); }

.profiles-container { padding: 20px; }

.profile-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.profile-card {
    background: var(--bg2);
    border-radius: 20px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.profile-card:active { transform: scale(0.95); border-color: var(--accent); }
.profile-card .avatar { font-size: 3em; margin-bottom: 10px; }
.profile-card .name { font-size: 1em; font-weight: 600; }

.btn-add-profile {
    width: 100%;
    padding: 15px;
    background: var(--bg2);
    border: 2px dashed var(--bg3);
    border-radius: 15px;
    color: var(--text2);
    font-size: 1em;
    cursor: pointer;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: flex-end;
    z-index: 100;
}

.modal-content {
    background: var(--bg2);
    border-radius: 25px 25px 0 0;
    padding: 30px 20px;
    width: 100%;
}

.modal-content h2 { margin-bottom: 20px; text-align: center; }

.avatar-picker {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.avatar-option {
    font-size: 2em;
    padding: 8px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
}

.avatar-option.selected { border-color: var(--accent); background: var(--bg3); }

.modal-content input {
    width: 100%;
    background: var(--bg3);
    border: none;
    border-radius: 12px;
    padding: 15px;
    color: var(--text);
    font-size: 1em;
    margin-bottom: 12px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    border: none;
    font-size: 1em;
    cursor: pointer;
    background: var(--bg3);
    color: var(--text);
}

.modal-buttons .btn-primary {
    background: var(--accent);
    color: #000;
    font-weight: 700;
}

/* PIN Screen */
.pin-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px 40px;
    min-height: 100vh;
}

.pin-avatar { font-size: 5em; margin-bottom: 15px; }
.pin-screen h2 { font-size: 1.5em; margin-bottom: 8px; }
.pin-screen p { color: var(--text2); margin-bottom: 30px; }

.pin-dots {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg3);
    border: 2px solid var(--text2);
    transition: all 0.2s;
}

.pin-dot.filled { background: var(--accent); border-color: var(--accent); }

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 300px;
}

.pin-pad button {
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--bg2);
    border: none;
    color: var(--text);
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.1s;
}

.pin-pad button:active { transform: scale(0.9); background: var(--bg3); }

/* Main App */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 50px 20px 10px;
}

.btn-icon {
    background: var(--bg2);
    border: none;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
}

/* Fast Ring */
.fast-circle-container {
    position: relative;
    width: 280px;
    margin: 10px auto;
}

.progress-ring { width: 100%; transform: rotate(-90deg); }

.ring-bg { fill: none; stroke: #1a1a1a; stroke-width: 20; }
.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 20;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.fast-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fast-icon { font-size: 2em; margin-bottom: 5px; }
.fast-label { color: var(--text2); font-size: 0.85em; }
.fast-timer { font-size: 2.8em; font-weight: 800; line-height: 1.1; }
.fast-seconds { color: var(--text2); font-size: 0.9em; }
.fast-remaining { color: var(--accent); font-size: 0.85em; margin-top: 5px; }

.btn-fast {
    display: block;
    width: calc(100% - 40px);
    margin: 10px auto;
    padding: 18px;
    background: var(--accent);
    border: none;
    border-radius: 15px;
    color: #000;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-fast:active { transform: scale(0.98); }
.btn-fast.stopping { background: var(--danger); color: #fff; }

.fast-times {
    text-align: center;
    color: var(--text2);
    font-size: 0.85em;
    padding: 5px 20px;
    line-height: 1.8;
}

.tips-section { padding: 15px 20px 100px; }
.tips-section h3 { margin-bottom: 10px; font-size: 1em; }

.tip-card {
    background: var(--bg2);
    border-radius: 15px;
    padding: 15px;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text2);
}

/* Tab Content */
.tab-content { display: none; padding-bottom: 80px; }
.tab-content.active { display: block; }
.tab-header { padding: 50px 20px 20px; }
.tab-header h2 { font-size: 1.5em; }

/* Water */
.water-circle {
    position: relative;
    width: 200px;
    margin: 20px auto;
}

.water-circle svg { width: 100%; transform: rotate(-90deg); }

.water-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.water-amount { font-size: 2em; font-weight: 800; color: #4fc3f7; }
.water-unit { color: var(--text2); font-size: 0.8em; }
.water-goal { color: var(--text2); font-size: 0.75em; }

.water-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 10px 20px;
}

.water-buttons button {
    padding: 15px;
    background: var(--bg2);
    border: none;
    border-radius: 12px;
    color: #4fc3f7;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
}

.water-buttons button:active { transform: scale(0.95); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 20px 20px;
}

.stat-card {
    background: var(--bg2);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.stat-value { font-size: 1.8em; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--text2); font-size: 0.8em; margin-top: 5px; }

.weight-section, .history-section { padding: 10px 20px 20px; }
.weight-section h3, .history-section h3 { margin-bottom: 12px; }

.weight-input {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.weight-input input {
    flex: 1;
    background: var(--bg2);
    border: none;
    border-radius: 10px;
    padding: 12px;
    color: var(--text);
    font-size: 1em;
}

.weight-input select {
    background: var(--bg2);
    border: none;
    border-radius: 10px;
    padding: 12px;
    color: var(--text);
    font-size: 1em;
}

.weight-input button {
    background: var(--accent);
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    color: #000;
    font-weight: 700;
    cursor: pointer;
}

.weight-history, .fast-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background: var(--bg2);
    border-radius: 12px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.history-item .date { color: var(--text2); }
.history-item .value { color: var(--accent); font-weight: 600; }

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--bg2);
    display: flex;
    border-top: 1px solid var(--bg3);
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text2);
    padding: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.75em;
    transition: color 0.2s;
}

.nav-btn span:first-child { font-size: 1.5em; }
.nav-btn.active { color: var(--accent); }
