/* ============================================================
   Trailhands Name Poll — shared styles for vote flow + results
   Warm Trailhands palette (matches Trailendar / landing page).
   ============================================================ */

:root {
    --cream-50:  #fbf7ec;
    --cream-100: #f5ecd5;
    --cream-200: #ead5a0;
    --tan-300:   #c2a870;
    --tan-400:   #ad9363;
    --tan-500:   #896e4f;
    --bronze-700:#604a2e;
    --bronze-800:#4c3622;
    --bronze-900:#492f17;
    --bronze-950:#38270f;
    --moss-700:  #484f21;
    --gold:      #f2c03d;
    --gold-soft: #ffe9a8;

    --bg: var(--cream-50);
    --surface: #ffffff;
    --surface-2: #fbf3df;
    --text: var(--bronze-950);
    --text-muted: var(--tan-500);
    --border: rgba(73, 47, 23, 0.10);
    --border-strong: rgba(73, 47, 23, 0.22);
    --shadow-sm: 0 1px 2px rgba(73, 47, 23, 0.06);
    --shadow-md: 0 2px 4px rgba(73, 47, 23, 0.06), 0 12px 28px rgba(73, 47, 23, 0.10);
    --shadow-lg: 0 4px 10px rgba(73, 47, 23, 0.10), 0 30px 60px rgba(73, 47, 23, 0.18);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(242,192,61,0.20), transparent 60%),
        radial-gradient(1000px 600px at 110% 110%, rgba(173,147,99,0.18), transparent 55%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.45;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- App shell ---------- */
.poll-app, .results-app {
    max-width: 920px;
    margin: 0 auto;
    padding: 22px 24px 40px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Header ---------- */
.poll-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}
.poll-brand {
    margin: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.32em;
    color: var(--bronze-900);
}
.back-link, .results-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--bronze-700);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.back-link:hover, .results-link:hover {
    background: var(--cream-100);
    color: var(--bronze-900);
}
.results-link { justify-self: end; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 14px;
    transition: background 0.15s, transform 0.05s, box-shadow 0.15s, color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
    background: var(--gold);
    color: var(--bronze-950);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: #ffce4f; }
.btn-ghost {
    background: var(--surface);
    color: var(--bronze-800);
    border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--cream-100); }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 12px; }

/* ---------- Cards / screens ---------- */
.poll-main, .results-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.screen-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    padding: 32px clamp(20px, 5vw, 48px);
}
.screen-card h2 {
    margin: 0 0 8px;
    font-size: 24px;
    color: var(--bronze-900);
    letter-spacing: -0.01em;
}
.screen-card .lead {
    margin: 0 0 22px;
    color: var(--tan-500);
    font-size: 15px;
}
.muted { color: var(--text-muted); }
.muted.small { font-size: 12px; line-height: 1.5; margin-top: 12px; }

/* ---------- Welcome screen ---------- */
/* The welcome screen fills the available vertical space and centers its
   contents — so the name-entry box sits in the middle of the viewport. */
.screen--welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    min-height: 65vh;
}
.welcome-inner {
    width: 100%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.welcome-intro {
    text-align: center;
    padding: 0 8px;
}
.welcome-headline {
    margin: 0 0 12px;
    font-size: clamp(26px, 3.4vw, 34px);
    font-weight: 900;
    color: var(--bronze-900);
    letter-spacing: -0.01em;
    line-height: 1.15;
}
.welcome-lead {
    margin: 0;
    color: var(--bronze-700);
    font-size: 15px;
    line-height: 1.55;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}
.welcome-card {
    width: 100%;
}
.welcome-bypass {
    margin: 4px 0 0;
    text-align: center;
}
.bypass-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--bronze-700);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px dashed transparent;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.bypass-link:hover {
    color: var(--bronze-900);
    border-color: var(--border-strong);
    background: rgba(255,255,255,0.5);
}

.welcome-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bronze-700);
}
.field input {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(242,192,61,0.30);
}

/* ---------- Voting screen ---------- */
.screen--voting { display: flex; flex-direction: column; gap: 28px; }

.progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.progress-text {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.10em;
    color: var(--tan-500);
}
.progress-text .progress-sep { margin: 0 6px; opacity: 0.5; }
.progress-bar {
    width: 100%;
    max-width: 420px;
    height: 6px;
    background: var(--cream-200);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, #ffce4f 100%);
    transition: width 0.35s cubic-bezier(.5,.05,.25,1);
}

.name-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
    min-height: 38vh;
}
.name-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    padding: clamp(28px, 5vw, 56px) clamp(24px, 6vw, 64px);
    text-align: center;
    width: 100%;
    max-width: 760px;
    position: relative;
    overflow: hidden;
}
.name-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--gold) 0%, var(--tan-300) 100%);
}
.name-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: var(--tan-500);
    margin-bottom: 16px;
}
.name-text {
    margin: 0;
    font-size: clamp(28px, 5.5vw, 56px);
    font-weight: 900;
    letter-spacing: -0.01em;
    color: var(--bronze-900);
    line-height: 1.05;
}

.name-card.flip-in {
    animation: flipIn 0.35s cubic-bezier(.5,.05,.25,1);
}
@keyframes flipIn {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Stars ---------- */
.rating { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stars {
    display: flex;
    gap: clamp(4px, 1.5vw, 14px);
    justify-content: center;
}
.star {
    background: transparent;
    border: 0;
    padding: 4px;
    color: var(--cream-200);
    font-size: clamp(36px, 7vw, 56px);
    line-height: 1;
    transition: color 0.15s, transform 0.08s;
}
.star::before { content: "★"; }
.star:hover { transform: translateY(-2px); }
.star.hover  { color: var(--gold-soft); }
.star.filled { color: var(--gold); }
.star.filled.hover { color: var(--gold); }
.star:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.rating-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tan-500);
    height: 18px;
}

/* ---------- Nav buttons ---------- */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 8px;
}
.nav-buttons .btn { min-width: 140px; }

/* ---------- Submit summary ---------- */
.vote-summary {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 50vh;
    overflow-y: auto;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.summary-name { font-weight: 600; color: var(--bronze-900); flex: 1; min-width: 0; }
.summary-stars { color: var(--gold); font-size: 16px; letter-spacing: 1px; flex-shrink: 0; }

/* ---------- Thanks screen ---------- */
.thanks-header {
    text-align: center;
    margin-bottom: 28px;
}
.thanks-header h2 {
    margin: 12px 0 4px;
    font-size: 28px;
    color: var(--bronze-900);
}
.check-icon {
    color: var(--moss-700);
    background: rgba(72, 79, 33, 0.12);
    border-radius: 50%;
    padding: 10px;
    width: 60px;
    height: 60px;
}

.suggestion-section {
    background: var(--surface-2);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 24px;
}
.suggestion-section h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--bronze-900);
}
.suggestion-form {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.suggestion-form input {
    flex: 1;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    min-width: 0;
}
.suggestion-form input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(242,192,61,0.30);
}
.suggestions-mine {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.suggestion-mine {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(72, 79, 33, 0.08);
    border: 1px solid rgba(72, 79, 33, 0.20);
    border-radius: 8px;
    font-size: 13px;
}
.suggestion-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--moss-700);
    color: var(--cream-50);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Footer ---------- */
.poll-footer {
    margin-top: auto;
    padding-top: 28px;
    text-align: center;
    color: var(--tan-500);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.20em;
    text-transform: uppercase;
}

/* ---------- Status / toast ---------- */
.status {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bronze-950);
    color: var(--cream-100);
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    z-index: 200;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ============================================================
   RESULTS PAGE
   ============================================================ */

.results-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: 18px;
    text-align: center;
}
.stat-value {
    font-size: 32px;
    font-weight: 900;
    color: var(--bronze-900);
    line-height: 1;
}
.stat-label {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tan-500);
}

.section-title {
    margin: 36px 0 14px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bronze-700);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.result-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.result-row:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
/* ---- Leader row treatment: stronger gold framing, ribbon badge ---- */
.result-row.is-leader {
    background:
        linear-gradient(135deg, rgba(242,192,61,0.22) 0%, rgba(242,192,61,0.08) 60%, transparent 100%),
        var(--surface);
    border: 2px solid var(--gold);
    box-shadow:
        0 0 0 4px rgba(242,192,61,0.18),
        0 4px 14px rgba(73,47,23,0.10);
    padding: 18px 18px;
    grid-template-columns: 50px 1fr auto;
    transform: translateY(0);
}
.result-row.is-leader:hover {
    box-shadow:
        0 0 0 4px rgba(242,192,61,0.30),
        var(--shadow-md);
}
.result-rank {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--cream-200);
    color: var(--bronze-900);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 16px;
}
.result-row.is-leader .result-rank {
    width: 50px;
    height: 50px;
    background: linear-gradient(180deg, var(--gold) 0%, #d4a330 100%);
    color: var(--bronze-950);
    border-radius: 14px;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 2px 6px rgba(73,47,23,0.20), inset 0 1px 0 rgba(255,255,255,0.40);
    line-height: 1;
}
.result-row.is-leader .rank-trophy {
    font-size: 16px;
    line-height: 1;
    color: var(--bronze-950);
    text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}
.result-row.is-leader .rank-num {
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    margin-top: 1px;
}
.leader-badge {
    display: inline-block;
    background: var(--bronze-900);
    color: var(--gold);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.18em;
    padding: 3px 8px;
    border-radius: 5px;
    margin-right: 10px;
    vertical-align: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.20);
}
.result-row.is-leader .result-name {
    font-size: 18px;
    color: var(--bronze-950);
}
.result-row.is-leader .result-bar { max-width: 420px; }
.result-row.is-leader .result-bar-fill {
    background: linear-gradient(90deg, var(--gold) 0%, #ffce4f 100%);
    box-shadow: 0 0 0 1px rgba(73,47,23,0.10);
}
.result-info { min-width: 0; }
.result-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--bronze-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.result-bar {
    margin-top: 6px;
    height: 6px;
    background: var(--cream-200);
    border-radius: 3px;
    overflow: hidden;
    max-width: 360px;
}
.result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, var(--tan-300) 100%);
    transition: width 0.4s ease;
}
.result-score { text-align: right; flex-shrink: 0; }
.result-stars {
    font-size: 32px;
    letter-spacing: 2px;
    line-height: 1;
    margin-bottom: 6px;
}
.result-stars .s { display: inline-block; }
.result-stars .s-full  { color: var(--gold); }
.result-stars .s-empty { color: var(--cream-200); }
.result-stars .s-half  {
    background: linear-gradient(90deg, var(--gold) 50%, var(--cream-200) 50%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.result-meta {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tan-500);
}

.suggestions-list, .voters-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.suggestion-row, .voter-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
}
.suggestion-name { font-weight: 700; color: var(--bronze-900); }
.suggestion-meta, .voter-meta {
    font-size: 11px;
    color: var(--tan-500);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.voter-name { font-weight: 600; color: var(--bronze-900); }

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ---------- Smaller screens ---------- */
@media (max-width: 600px) {
    .poll-app, .results-app { padding: 16px 16px 28px; }
    .poll-header { gap: 8px; padding-bottom: 14px; margin-bottom: 18px; }
    .nav-buttons .btn { min-width: auto; flex: 1; }
    .name-display { min-height: 30vh; padding: 12px 0; }
    .name-card { padding: 28px 18px; }
    .results-summary { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat { padding: 12px 8px; }
    .stat-value { font-size: 24px; }
    .result-row { grid-template-columns: 28px 1fr; padding: 12px; }
    .result-score { grid-column: 2; text-align: left; }
    .result-row .result-rank { width: 28px; height: 28px; font-size: 13px; }
    .suggestion-form { flex-direction: column; }
    .suggestion-row, .voter-row { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .name-card.flip-in { animation: none; }
    .progress-fill, .result-bar-fill { transition: none; }
    .star { transition: color 0.15s; }
    .star:hover { transform: none; }
}
