/* Kararsızım design system (CLAUDE.md section 8). Mobile-first, no frameworks. */

:root {
  /* Surfaces */
  --bg:            #FAF7FF;
  --surface:       #FFFFFF;
  --surface-soft:  #F3EEFF;
  --border:        #ECE6F7;

  /* Text. --text-muted is a touch darker than the original #7A7491 so small
     muted text keeps WCAG AA contrast (>= 4.5:1) on the lilac background. */
  --text:          #2A2540;
  --text-muted:    #6E6887;

  /* Brand colors (vivid but softened) */
  --primary:       #7C5CFF;
  --primary-soft:  #E9E3FF;
  --pink:          #FF7EB6;
  --pink-soft:     #FFE4F0;
  --mint:          #3DD9A4;
  --mint-soft:     #DDF8EE;
  --sun:           #FFC857;
  --sun-soft:      #FFF3D6;
  --sky:           #5CC8FF;
  --sky-soft:      #DFF4FF;

  /* Status */
  --danger:        #FF5C7A;
  --success:       #2EC892;

  /* Shape */
  --radius-sm:     10px;
  --radius:        16px;
  --radius-lg:     24px;
  --shadow:        0 6px 24px rgba(124, 92, 255, 0.08);
  --shadow-hover:  0 10px 32px rgba(124, 92, 255, 0.14);
  --gradient:      linear-gradient(135deg, #7C5CFF 0%, #FF7EB6 100%);

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ring: 0 0 0 3px var(--primary-soft);
}

/* --- Base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

h1, h2, h3 { font-weight: 800; line-height: 1.25; }
a { color: var(--primary); }
a:hover { text-decoration: none; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }

.container { max-width: 680px; margin: 0 auto; padding: 24px 16px 48px; }

.skip-link { position: absolute; left: 16px; top: -48px; z-index: 40; background: var(--surface); padding: 8px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }

/* --- Navbar ---------------------------------------------------------------- */

.navbar { position: sticky; top: 0; z-index: 10; background: var(--surface); box-shadow: 0 2px 16px rgba(124, 92, 255, 0.07); }
.navbar-inner { max-width: 680px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.logo { display: inline-flex; align-items: center; gap: 6px; font-size: 1.25rem; font-weight: 800; text-decoration: none; }
.logo-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.navbar-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.navbar-links form { margin: 0; }
.navbar-user { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; text-decoration: none; padding: 6px 8px; border-radius: var(--radius-sm); }
.navbar-user:hover { background: var(--surface-soft); }

/* --- Buttons --------------------------------------------------------------- */

.btn { display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 600; line-height: 1.2; padding: 10px 18px; border-radius: 999px; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 4px 14px rgba(124, 92, 255, 0.25); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(124, 92, 255, 0.35); }
.btn-text { background: transparent; color: var(--text); }
.btn-text:hover { background: var(--surface-soft); }
.btn-soft { background: var(--surface-soft); color: var(--primary); }
.btn-soft:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-text { background: transparent; color: #D93A59; }
.btn-danger-text:hover { background: var(--pink-soft); }
.btn-block { display: block; width: 100%; padding: 13px 18px; margin-top: 8px; text-align: center; }
.btn[hidden] { display: none; }

/* --- Cards / headings ------------------------------------------------------ */

.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; }
.page-title { font-size: 2rem; margin: 8px 0 20px; }
.empty-state { text-align: center; padding: 32px 22px; }
.empty-state p:first-child { font-size: 1.25rem; font-weight: 800; margin: 0 0 4px; }
.empty-state .btn { margin-top: 12px; }

/* --- Forms ----------------------------------------------------------------- */

.form-card h1 { margin-top: 0; font-size: 1.6rem; }
.form-footer { text-align: center; color: var(--text-muted); }
.field { margin-bottom: 16px; }
.field label, .options-field legend { display: block; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select, .option-row input { width: 100%; padding: 11px 14px; font: inherit; color: var(--text); background: var(--surface-soft); border: 1px solid transparent; border-radius: var(--radius); transition: border-color .15s ease, box-shadow .15s ease; }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .option-row input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.field-help { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; }
.field-help ul { margin: 4px 0 0; padding-left: 18px; }
.field-errors { list-style: none; margin: 6px 0 0; padding: 0; color: #C42B4A; font-size: 0.9rem; font-weight: 600; }
.form-errors { background: var(--pink-soft); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 16px; color: #C42B4A; font-weight: 600; }
.form-errors p { margin: 4px 0; }
.notice { background: var(--primary-soft); border-radius: var(--radius); padding: 8px 14px; }

.options-field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.option-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.option-row[hidden] { display: none; }
.option-remove { font-size: 1.3rem; line-height: 1; padding: 6px 12px; }

/* --- Messages / toasts ----------------------------------------------------- */

.messages { max-width: 680px; margin: 12px auto 0; padding: 0 16px; }
.message { border-radius: var(--radius); padding: 11px 16px; margin-bottom: 8px; font-weight: 600; box-shadow: var(--shadow); transition: opacity .3s ease, transform .3s ease; }
.message-success { background: var(--mint-soft); }
.message-error { background: var(--pink-soft); }
.message-info, .message-warning { background: var(--primary-soft); }
/* main.js turns the strip into a floating toast that fades away. */
.messages.is-toast { position: fixed; z-index: 30; bottom: 16px; left: 50%; transform: translateX(-50%); width: min(680px, 100%); margin: 0; pointer-events: none; }
.message.is-leaving { opacity: 0; transform: translateY(8px); }

/* --- Poll feed ------------------------------------------------------------- */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab { padding: 7px 16px; border-radius: 999px; background: var(--surface); color: var(--text-muted); text-decoration: none; font-weight: 600; box-shadow: var(--shadow); }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--primary-soft); color: var(--primary); }

.poll-card { position: relative; margin-bottom: 16px; transition: transform .2s ease, box-shadow .2s ease; }
.poll-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.poll-meta { color: var(--text-muted); font-size: 0.9rem; }
.poll-author { position: relative; z-index: 1; font-weight: 600; text-decoration: none; }
.poll-author:hover { text-decoration: underline; }
.poll-question { font-size: 1.35rem; margin: 6px 0 14px; }
.poll-link { color: var(--text); text-decoration: none; }
/* The whole card is clickable through the question link. */
.poll-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.poll-link:focus-visible { outline: none; }
.poll-link:focus-visible::after { outline: 3px solid var(--primary); outline-offset: 2px; }
.poll-footer { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--text-muted); font-size: 0.9rem; }
.badge { background: var(--mint-soft); color: var(--text); border-radius: 999px; padding: 2px 10px; font-weight: 600; }

.mini-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mini-label { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92rem; margin-bottom: 4px; }
.mini-percent { color: var(--text-muted); white-space: nowrap; }
.mini-results .bar { height: 6px; }
.option-more { color: var(--text-muted); font-size: 0.9rem; }

.profile-count { color: var(--text-muted); margin-top: -12px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 8px; }
.pagination-info { color: var(--text-muted); }

/* --- Option colors + result bars ------------------------------------------ */

.option-color-0 { --opt: var(--primary); --opt-soft: var(--primary-soft); }
.option-color-1 { --opt: var(--pink);    --opt-soft: var(--pink-soft); }
.option-color-2 { --opt: var(--mint);    --opt-soft: var(--mint-soft); }
.option-color-3 { --opt: var(--sun);     --opt-soft: var(--sun-soft); }
.option-color-4 { --opt: var(--sky);     --opt-soft: var(--sky-soft); }

.bar { height: 11px; background: var(--opt-soft); border-radius: 999px; overflow: hidden; }
/* Width comes from the inline style; the animation grows it from 0 on load. */
.bar-fill { height: 100%; background: var(--opt); border-radius: 999px; animation: bar-grow .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes bar-grow { from { width: 0; } }

/* --- Poll detail ----------------------------------------------------------- */

.poll-detail .poll-question { font-size: 1.6rem; }
.poll-description { color: var(--text-muted); }

.vote-form { margin: 18px 0 28px; }
.vote-options { display: grid; gap: 10px; margin-bottom: 14px; }
.vote-pill { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-soft); border: 2px solid transparent; border-radius: var(--radius); padding: 13px 16px; font-weight: 600; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
.vote-pill:hover { border-color: var(--opt-soft); transform: translateY(-1px); }
.vote-pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.vote-pill-check { visibility: hidden; color: var(--opt); font-weight: 800; font-size: 1.1rem; }
.vote-pill:has(input:checked) { border-color: var(--opt); background: var(--opt-soft); }
.vote-pill:has(input:checked) .vote-pill-check { visibility: visible; }
.vote-pill:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }

.results-title { font-size: 1.1rem; margin: 0 0 14px; }
.result { margin-bottom: 18px; }
.result-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-weight: 600; }
.result-numbers { color: var(--text-muted); font-weight: 400; white-space: nowrap; }
.result.is-winner .result-text { font-weight: 800; }
.result.is-winner .bar { box-shadow: 0 0 0 2px var(--opt-soft); }
.voters { margin-top: 8px; font-size: 0.9rem; }
.voters summary { cursor: pointer; color: var(--text-muted); }
.voters ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.voters li a { display: inline-block; background: var(--surface-soft); border-radius: 999px; padding: 2px 10px; text-decoration: none; }
.voters li a:hover { background: var(--primary-soft); }

/* --- Poll deadline / decided -------------------------------------------- */

.closed-banner { display: flex; flex-direction: column; gap: 2px; margin: 16px 0 24px; padding: 14px 16px; background: var(--sun-soft); border-radius: var(--radius); }
.deadline { margin: 12px 0 0; color: var(--text-muted); }
.deadline-chip { color: var(--text-muted); }
.badge-closed { background: var(--sun-soft); }

/* --- Share ----------------------------------------------------------------- */

.share { margin: 8px 0 20px; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-input { flex: 1 1 220px; min-width: 0; padding: 10px 14px; font: inherit; font-size: 0.9rem; color: var(--text-muted); background: var(--surface-soft); border: 1px solid transparent; border-radius: var(--radius); }
.share-status { min-height: 1.4em; margin: 6px 0 0; color: var(--text-muted); font-size: 0.9rem; }

/* --- E-mail verification banner -------------------------------------------- */

.verify-banner { max-width: 680px; margin: 12px auto 0; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: var(--sun-soft); border-radius: var(--radius); }
.verify-banner form { margin: 0; }

/* --- Error pages ----------------------------------------------------------- */

.error-page { text-align: center; padding: 40px 22px; }
.error-code { font-size: 4rem; font-weight: 800; line-height: 1; margin: 0; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { font-size: 1.5rem; margin: 12px 0 6px; }
.error-page p { color: var(--text-muted); }
.error-page .btn { margin-top: 12px; }

/* --- Small screens / motion ----------------------------------------------- */

@media (max-width: 480px) {
  .page-title { font-size: 1.6rem; }
  .card { padding: 18px; }
  .poll-question { font-size: 1.2rem; }
  .poll-detail .poll-question { font-size: 1.35rem; }
  .btn { padding: 9px 14px; }
  .navbar-inner { padding: 8px 12px; }
  .navbar-links { flex: 1 1 auto; justify-content: flex-end; gap: 4px; }
  .navbar-links .btn { padding: 8px 12px; }
  .navbar-user { max-width: 7rem; font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .btn:hover, .poll-card:hover, .vote-pill:hover { transform: none; }
}
