/* vote-app/public/style.css — mobile-first; refine visuals via frontend-design skill, keep selectors
   Direction: "Backstage Call Sheet" — matte charcoal panels like a clipboard under stage light,
   warm parchment text, a five-grade cool→warm rating scale (emerald through crimson), tactile
   shadows. Dim-light legibility and big touch targets are non-negotiable. */

:root {
  --ink: #0a0a0c;
  --panel: #17171b;
  --panel-2: #1e1e23;
  --hair: rgba(255,255,255,.09);
  --hair-strong: rgba(255,255,255,.16);
  --text: #f3f1ea;
  --text-dim: #a5a3ad;
  --approve: #34d17a;
  --approve-deep: #14532d;
  --reject: #ff5d5d;
  --reject-deep: #7a1f22;
  --pending: #ffcc33;
  --rate1: #8e2626; --rate1-hi: #c23a3a;   /* 1 = RED */
  --rate2: #1d4f8e; --rate2-hi: #3572c4;   /* 2 = BLUE */
  --rate3: #1f7a34; --rate3-hi: #35a854;   /* 3 = GREEN */
  --rate4: #8e7a1d; --rate4-hi: #c7a82b;   /* 4 = YELLOW */
  --rate5: #a35a1c; --rate5-hi: #d47c2c;   /* 5 = ORANGE */
  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow-lift: 0 16px 36px -14px rgba(0,0,0,.65), 0 3px 8px rgba(0,0,0,.45);
  --shadow-soft: 0 6px 18px -8px rgba(0,0,0,.55);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "SF Pro Text", system-ui, sans-serif;
  background: var(--ink);
  color: var(--text);
  position: relative;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 900px 500px at 50% -8%, rgba(255,214,10,.05), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 110%, rgba(52,209,122,.04), transparent 55%);
}
.screen { min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
          justify-content: center; gap: 16px; padding: 24px; text-align: center; }
.screen[hidden] { display: none; }
h1 { font-size: 1.7rem; line-height: 1.28; font-weight: 800; letter-spacing: -.01em; }
input, textarea { width: 100%; max-width: 340px; padding: 13px 14px; border-radius: var(--radius-md);
                  border: 1px solid var(--hair); background: var(--panel-2); color: var(--text);
                  font-size: 1rem; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--pending);
                  box-shadow: 0 0 0 3px rgba(255,204,51,.18); }
button { padding: 14px 22px; border-radius: var(--radius-md); border: none; background: var(--panel-2);
         color: var(--text); font-size: 1.05rem; font-weight: 600; cursor: pointer;
         box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,.06);
         transition: transform .1s ease-out, filter .15s, box-shadow .15s; }
button:active { transform: scale(.96); filter: brightness(.92); box-shadow: none; }
.dept-btn { width: 260px; font-size: 1.4rem; padding: 24px; letter-spacing: .02em; }
.error { color: var(--reject); font-weight: 600; }

#screen-deck { justify-content: flex-start; padding: 0; gap: 0; }
#deck-header { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px;
               padding-top: calc(10px + env(safe-area-inset-top)); }
#progress { flex: 1; background: var(--panel-2); border-radius: 8px; height: 24px; position: relative;
            overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
#progress-bar { background: linear-gradient(90deg, var(--approve-deep), var(--approve)); height: 100%;
                width: 0; transition: width .3s cubic-bezier(.3,.8,.4,1); }
#progress-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: .78rem;
                  font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
#pending-badge { font-size: .72rem; font-weight: 700; color: var(--pending); letter-spacing: .02em;
                 animation: badge-pulse 1.6s ease-in-out infinite; }

#card-zone { flex: 1; width: 100%; display: grid; place-items: center; padding: 10px 14px; min-height: 0; }
.card { width: 100%; max-width: 420px; height: 100%; max-height: 74dvh; border-radius: var(--radius-lg);
        overflow: hidden; background: var(--panel); display: flex; flex-direction: column;
        touch-action: pan-y; position: relative; border: 1px solid var(--hair);
        box-shadow: var(--shadow-lift); will-change: transform; }
.photo-wrap { flex: 1; position: relative; min-height: 0; }
.photo-wrap::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 64px;
        background: linear-gradient(rgba(0,0,0,.35), transparent); pointer-events: none; z-index: 1; }
.photo { width: 100%; height: 100%; object-fit: contain; display: block; }
.placeholder { height: 100%; display: flex; flex-direction: column; align-items: center;
               justify-content: center; gap: 12px; background: var(--panel-2); }
.placeholder span { font-size: 3.4rem; font-weight: 800; letter-spacing: .04em; color: var(--text-dim); }
.placeholder p { color: var(--text-dim); font-size: .9rem; }
.dots { position: absolute; top: 12px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center;
        z-index: 2; }
.dots i { width: 26px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3);
          transition: background .15s; }
.dots i.on { background: #fff; box-shadow: 0 0 6px rgba(255,255,255,.5); }
.meta { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); display: flex;
        flex-direction: column; gap: 7px; text-align: left; }
.meta strong { font-size: 1.18rem; font-weight: 800; letter-spacing: -.005em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel-2); border: 1px solid var(--hair); border-radius: 999px;
        padding: 4px 11px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.group-RED { background:#7a2323; border-color: rgba(255,255,255,.12); }
.group-BLUE { background:#1c4a82; border-color: rgba(255,255,255,.12); }
.group-GREEN { background:#1c6e34; border-color: rgba(255,255,255,.12); }
.group-YELLOW { background:#d9b431; color:#1a1502; border-color: rgba(0,0,0,.2); }
.group-ORANGE { background:#a8551a; border-color: rgba(255,255,255,.12); }

/* ---------- rating row: five judged grades, cool→warm at a glance ---------- */
#vote-footer { display: flex; flex-direction: column; align-items: center; gap: 8px;
               width: 100%; padding: 6px 14px calc(14px + env(safe-area-inset-bottom)); }
#scale-hint { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
              color: var(--text-dim); opacity: .85; }
.rate-row { display: flex; gap: 8px; justify-content: center; width: 100%; max-width: 420px; }
.rate-row[hidden] { display: none; }
.rate-btn { flex: 1; height: 60px; border-radius: 14px; font-size: 1.35rem; font-weight: 800; color: #fff;
            display: grid; place-items: center; padding: 0; font-variant-numeric: tabular-nums;
            border: 1px solid rgba(255,255,255,.12);
            box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,.2), inset 0 -12px 16px -10px rgba(0,0,0,.4); }
.rate-btn[data-rating="1"] { background: linear-gradient(160deg, var(--rate1-hi), var(--rate1));
                              box-shadow: var(--shadow-soft), 0 0 0 1px rgba(194,58,58,.4), inset 0 1px 0 rgba(255,255,255,.22); }
.rate-btn[data-rating="2"] { background: linear-gradient(160deg, var(--rate2-hi), var(--rate2));
                              box-shadow: var(--shadow-soft), 0 0 0 1px rgba(53,114,196,.35), inset 0 1px 0 rgba(255,255,255,.22); }
.rate-btn[data-rating="3"] { background: linear-gradient(160deg, var(--rate3-hi), var(--rate3));
                              box-shadow: var(--shadow-soft), 0 0 0 1px rgba(53,168,84,.35), inset 0 1px 0 rgba(255,255,255,.24); }
.rate-btn[data-rating="4"] { background: linear-gradient(160deg, var(--rate4-hi), var(--rate4)); color: #1a1502;
                              box-shadow: var(--shadow-soft), 0 0 0 1px rgba(199,168,43,.32), inset 0 1px 0 rgba(255,255,255,.32); }
.rate-btn[data-rating="5"] { background: linear-gradient(160deg, var(--rate5-hi), var(--rate5));
                              box-shadow: var(--shadow-soft), 0 0 0 1px rgba(212,124,44,.34), inset 0 1px 0 rgba(255,255,255,.22); }
#footer-aux { display: flex; gap: 14px; }
#footer-aux button { width: 52px; height: 44px; border-radius: 12px; font-size: 1.1rem;
                      display: grid; place-items: center; }
#footer-aux #btn-undo:disabled { opacity: .35; }
.chip.rate-1 { background: var(--rate1); color: #ffdada; border-color: rgba(194,58,58,.4); }
.chip.rate-2 { background: var(--rate2); color: #d8e8ff; border-color: rgba(53,114,196,.4); }
.chip.rate-3 { background: var(--rate3); color: #d9f9e3; border-color: rgba(53,168,84,.4); }
.chip.rate-4 { background: var(--rate4); color: #1a1502; border-color: rgba(199,168,43,.4); }
.chip.rate-5 { background: var(--rate5); color: #ffe4cc; border-color: rgba(212,124,44,.4); }

#note-sheet, #menu-sheet, #revote-sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6);
                           backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
                           display: grid; place-items: end center; z-index: 10; }
#note-sheet[hidden], #menu-sheet[hidden], #revote-sheet[hidden] { display: none; }
.sheet-body { background: var(--panel); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0;
              padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
              display: flex; flex-direction: column; gap: 13px; border: 1px solid var(--hair-strong);
              border-bottom: none; box-shadow: var(--shadow-lift); animation: sheet-in .2s ease-out; }
.sheet-body::before { content: ''; align-self: center; width: 40px; height: 4px; border-radius: 2px;
              background: var(--hair-strong); margin-bottom: 2px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions[hidden] { display: none; }
.sheet-actions button { flex: 1; }
#note-save { background: var(--reject-deep); color: #ffdada; }

#revote-name { font-size: 1.15rem; font-weight: 800; letter-spacing: -.005em; text-align: left; }
#revote-photo { width: 100%; background: var(--panel-2); box-shadow: var(--shadow-soft); }
#revote-rate-row { margin: 2px 0; }

#screen-browse { justify-content: flex-start; align-items: stretch; text-align: left; }
#screen-browse header { display: flex; gap: 12px; align-items: center;
                        padding-top: env(safe-area-inset-top); }
#browse-list { list-style: none; width: 100%; overflow-y: auto; }
#browse-list li { display: flex; justify-content: space-between; align-items: center;
                  padding: 14px 6px; border-bottom: 1px solid var(--hair); transition: background .1s; }
#browse-list li:active { background: var(--panel-2); }

@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
