:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --primary: #2b6cb0;
    --primary-hover: #235a96;
    --text: #1a202c;
    --muted: #718096;
    --border: #e2e8f0;
    --error: #c53030;
    --success: #2f855a;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 { margin: 0; font-size: 1.5rem; }

#user-bar { display: flex; gap: 1rem; align-items: center; }

main {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
}

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.tab {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

form { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; font-size: 0.9rem; color: var(--muted); gap: 0.25rem; }

input, select {
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    color: var(--text);
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

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

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}
button:hover { background: var(--primary-hover); }
button#logout-btn {
    background: transparent;
    border: 1px solid white;
}

.hidden { display: none !important; }
.error { color: var(--error); margin-top: 1rem; }

#results { margin-top: 2rem; }

.result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 2.5rem 1rem 1rem;
    margin-bottom: 0.75rem;
    background: #fafbfd;
    position: relative;
}
.result-card .rank { color: var(--muted); font-size: 0.85rem; }
.result-card .name { font-weight: 600; font-size: 1.1rem; }
.result-card .score { float: right; color: var(--success); font-weight: 600; }
.result-card .reason { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }

.fav-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--muted);
    padding: 0.2rem;
    line-height: 1;
    transition: color 0.15s, transform 0.1s;
}
.fav-btn:hover { color: #e6a817; transform: scale(1.2); background: none; }
.fav-btn.active { color: #e6a817; }

.fav-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: #fafbfd;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.fav-card-info { flex: 1; }
.fav-card-info .name { font-weight: 600; }
.fav-card-info .muted { color: var(--muted); font-size: 0.875rem; }

.unfav-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.unfav-btn:hover { color: var(--error); border-color: var(--error); background: none; }
.unfav-btn:disabled { opacity: 0.5; cursor: default; }

.muted { color: var(--muted); font-size: 0.9rem; }
