/* v1 additions on top of styles.css */
select { min-height: 48px; padding: 0 12px; border: 1px solid #b8c3d3; border-radius: var(--radius-control); color: var(--ink); background: #fff; font: inherit; max-width: 100%; }
select:focus { border-color: var(--accent); outline: 3px solid rgba(21,94,239,.13); }
input[disabled], select[disabled] { background: #f1f4f8; color: #6e7789; }
.header-tools { display: inline-flex; align-items: center; gap: 8px; }
.lang-button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); background: #fff; font-size: .74rem; font-weight: 800; }
.list-panel h1 { margin: 0 0 24px; font-size: 1.9rem; letter-spacing: -.03em; word-break: keep-all; }
.event-links { display: grid; gap: 10px; }
.event-link { display: flex; justify-content: space-between; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-card); color: var(--ink); background: #fff; text-decoration: none; }
.event-link span { color: var(--accent); font-size: .8rem; font-weight: 800; }
.button.kakao { display: grid; place-items: center; color: #191919; background: #fee500; text-decoration: none; }
.category-block { margin: 0 0 34px; }
.category-title { display: block; width: 100%; margin-bottom: 14px; padding: 0; font-size: 1.25rem; font-weight: 850; letter-spacing: -.02em; }
.category-title small { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; font-weight: 500; }
.candidate-option.has-image { grid-template-columns: 64px 1fr 30px; }
.candidate-photo { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: #e7ecf3; }
.receipt-list { margin: 26px 0 16px; }
.receipt-list .receipt { margin: 0; padding: 14px 0; border-top: 0; }
.receipt-list .receipt:first-child { border-top: 1px solid var(--line); }
.receipt em { color: var(--muted); font-style: normal; font-weight: 500; }
.complete-panel .button + .button { margin-top: 10px; }
.results-box { margin-top: 30px; }
.results-heading { margin: 0 0 14px; font-size: 1.1rem; }
.mini-results { margin-bottom: 18px; }
.mini-results h3 { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.mini-row { display: grid; grid-template-columns: minmax(70px, .9fr) 1.4fr 42px; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .86rem; }
.mini-row div { height: 8px; overflow: hidden; border-radius: 8px; background: #e7ecf3; }
.mini-row i { display: block; height: 100%; background: var(--accent); }
.mini-row b { text-align: right; font-variant-numeric: tabular-nums; }

/* admin */
.admin-nav { overflow-y: auto; }
.nav-bottom { display: grid; gap: 8px; margin-top: auto; }
.nav-bottom .nav-link-bottom { margin-top: 0; text-align: left; }
.nav-button { border: 1px solid rgba(255,255,255,.14); background: transparent; font: inherit; cursor: pointer; color: #aebad0; }
.topbar-tools { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.topbar-tools select { min-height: 42px; max-width: 280px; }
.heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.tab-pane + .tab-pane { margin-top: 0; }
.result-group + .result-group { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.result-group h3 { margin: 0 0 14px; font-size: 1rem; }
.result-group h3 small { margin-left: 6px; color: var(--muted); font-weight: 500; }
.event-card > strong.is-word { font-size: 1.7rem; letter-spacing: .02em; }
.join-qr { align-self: center; width: 150px; height: 150px; margin-top: 18px; border-radius: 10px; background: #fff; }
.join-url { margin: 12px 0 0; word-break: break-all; text-align: center; font-size: .75rem !important; }
.category-card { margin-bottom: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfd; }
.category-head { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 1.4fr) auto; gap: 10px; align-items: center; margin-bottom: 14px; }
.category-head .cat-name { font-weight: 800; }
.cand-list { display: grid; gap: 8px; }
.cand-row { display: grid; grid-template-columns: 48px minmax(120px, 1fr) minmax(120px, 1.4fr) auto; gap: 10px; align-items: center; }
.cand-thumb { display: grid; width: 48px; height: 48px; place-items: center; overflow: hidden; border-radius: 10px; color: var(--muted); background: #e7ecf3; font-size: .8rem; font-weight: 800; }
.cand-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.row-actions button, .mini-button { display: inline-flex; align-items: center; min-height: 34px; margin: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); background: #fff; font-size: .78rem; font-weight: 700; cursor: pointer; }
.row-actions button:hover:not(:disabled), .mini-button:hover { border-color: #9eabc0; }
.row-actions .danger-link { color: var(--danger); border-color: #f0b7b2; }
.add-row { flex-wrap: wrap; margin-top: 14px; }
.add-row input, .add-row select { min-width: 140px; }
.cand-add { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th { padding: 10px 8px; border-bottom: 2px solid var(--line); color: var(--muted); text-align: left; font-size: .76rem; }
.data-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table code { font-size: .92rem; letter-spacing: .06em; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; color: var(--muted); background: #e7ecf3; font-size: .74rem; font-weight: 800; }
.pill.ok { color: var(--success); background: #d9f3e8; }
.pill.bad { color: var(--danger); background: #fde4e1; }
.trend-chart svg { width: 100%; height: auto; }
.trend-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 10px; font-size: .82rem; }
.trend-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.trend-legend small { margin-left: auto; color: var(--muted); }
.flag { margin-bottom: 8px; padding: 12px 14px; border-radius: 10px; font-size: .86rem; font-weight: 650; }
.flag.info { color: #0e48bd; background: #e8f0ff; }
.flag.warn { color: #8a4b00; background: #fff0d5; }
.flag.ok { color: var(--success); background: #d9f3e8; }
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 20px; }
.insight-grid h3 { margin: 0 0 10px; font-size: .9rem; }
.mini-table > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.audit-list small { margin-left: 8px; color: var(--muted); }
.settings-section + .settings-section, .settings-section + .audit-section { margin-top: 24px; }
.settings-footer .button.danger { margin-right: auto; }
.archived-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 22px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
.archived-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.archived-dialog h2 { margin: 0 0 8px; }
.archived-help { margin: 0 0 14px; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.archived-actions { white-space: nowrap; text-align: right; }
.archived-actions .button { min-height: 36px; padding: 6px 12px; margin-left: 6px; }
.archived-empty { padding: 18px 0; color: var(--muted); text-align: center; }
.archived-footer { display: flex; justify-content: flex-end; margin-top: 14px; }
.notice-editor { margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.notice-editor-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; }
.notice-editor-head small { color: var(--muted); }
.notice-editor-fields { display: grid; grid-template-columns: 1.6fr 1.2fr auto auto; gap: 8px; }
.notice-editor-fields input { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
#noticeStatus { margin: 8px 0 0; color: var(--muted); font-size: .84rem; }
@media (max-width: 800px) { .notice-editor-fields { grid-template-columns: 1fr; } }
#eventArea .settings-section { background: #fff; padding: 26px; border-radius: var(--radius-card); }

/* report / tickets */
.report-page { background: #e9edf3; }
.report-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.report-toolbar .button { display: inline-grid; place-items: center; text-decoration: none; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.login-needed { margin: 40px auto; color: var(--danger); text-align: center; font-weight: 700; }
.report-sheet { width: min(100%, 900px); margin: 24px auto; padding: 48px; background: #fff; box-shadow: var(--shadow); }
.report-header h1 { margin: 0 0 6px; font-size: 2rem; letter-spacing: -.03em; }
.report-header > p:last-of-type { margin: 0; color: var(--muted); }
.report-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; margin: 24px 0 8px; }
.report-meta dt { color: var(--muted); font-size: .76rem; font-weight: 700; }
.report-meta dd { margin: 4px 0 0; font-weight: 750; }
.report-category { margin-top: 32px; break-inside: avoid; }
.report-category h2 { margin: 0 0 10px; font-size: 1.3rem; }
.report-category h2 small { color: var(--muted); font-size: .8rem; font-weight: 500; }
.report-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.report-table th, .report-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.report-table th { color: var(--muted); font-size: .76rem; }
.report-table .bar-col { width: 32%; }
.report-table tr.is-winner td { font-weight: 800; }
.report-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.ticket-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: min(100%, 900px); margin: 20px auto; padding: 0 12px; }
.ticket { display: grid; grid-template-columns: 1fr 130px; gap: 14px; align-items: center; padding: 14px 16px; border: 1.5px dashed #8b96a8; border-radius: 12px; background: #fff; break-inside: avoid; }
.ticket img { width: 130px; height: 130px; }
.ticket p { margin: 0 0 6px; }
.ticket-event { font-size: 1rem; font-weight: 850; }
.ticket-label { color: var(--accent); font-weight: 800; }
.ticket-hint { color: var(--muted); font-size: .72rem; }
.ticket code { display: block; margin-top: 8px; font-size: 1.05rem; font-weight: 800; letter-spacing: .12em; }

@media (max-width: 960px) {
  .nav-bottom { position: absolute; top: 9px; right: 12px; display: flex; margin: 0; }
  .nav-bottom .nav-link-bottom { padding: 6px 8px; font-size: .75rem; }
  .admin-nav nav { display: flex; flex-wrap: wrap; margin-top: 14px; }
  .insight-grid { grid-template-columns: 1fr; }
  .category-head, .cand-row { grid-template-columns: 1fr; }
  .cand-thumb { display: none; }
}

@media print {
  .no-print { display: none !important; }
  body.report-page { background: #fff; }
  .report-sheet { width: 100%; margin: 0; padding: 0; box-shadow: none; }
  .ticket-sheet { width: 100%; margin: 0; padding: 0; gap: 8px; }
  @page { margin: 14mm; }
}

/* ===== participant layout fixes ===== */
/* A transform animation on the panel made the fixed action bar attach to the panel instead of the viewport,
   covering the last candidates. Fade only, and keep the bar in normal flow (sticky) so nothing can be hidden. */
@keyframes panel-in { from { opacity: .001; } to { opacity: 1; } }
.mobile-action-bar { position: sticky; bottom: 0; right: auto; left: auto; max-width: none; margin: 24px -18px 0; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); }
.participant-shell { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.vote-intro h1 { max-width: none; }

@media (min-width: 768px) {
  .participant-shell { width: min(100%, 760px); padding: 32px 32px 40px; }
  .mobile-action-bar { margin: 28px -32px 0; padding-left: 32px; padding-right: 32px; }
  .access-panel h1, .vote-panel h1, .complete-panel h1, .waiting-panel h1 { max-width: none; }
}
@media (min-width: 1100px) {
  .participant-shell { width: min(100%, 1040px); }
  .candidate-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .access-form { max-width: 520px; }
  .mini-results, .receipt-list { max-width: 620px; }
}
.participant-shell:has(.vote-panel:not([hidden])) { padding-bottom: 0; }

.early-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; color: #0e48bd; background: #e8f0ff; font-size: .86rem; font-weight: 700; line-height: 1.5; }
.early-note:empty { display: none; }

/* ===== scoring (rubric) ===== */
.cat-mode-line { margin-bottom: 10px; }
.mode-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .74rem; font-weight: 800; color: var(--muted); background: #e7ecf3; }
.mode-badge.score { color: #7a2ea0; background: #f3e6fb; }
.rubric { margin: 0 0 16px; padding: 14px 16px; border: 1px solid #e0cdf0; border-radius: 12px; background: #fbf7fe; }
.rubric-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 4px; }
.rubric-sum { font-weight: 850; font-variant-numeric: tabular-nums; }
.rubric-sum.ok { color: var(--success); }
.rubric-sum.bad { color: var(--danger); }
.min-raters { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 0 auto; font-size: .82rem; }
.min-raters input { width: 72px; min-height: 36px; }
.crit-row { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto; gap: 10px; align-items: center; margin-top: 8px; }
.crit-points-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); white-space: nowrap; }
.crit-points-wrap input { width: 76px; min-height: 40px; text-align: right; }
.crit-add { margin-top: 12px; align-items: center; }
.crit-avgs { margin-top: 6px; color: var(--muted); font-size: .76rem; line-height: 1.5; }
@media (max-width: 960px) { .crit-row { grid-template-columns: 1fr; } .min-raters { margin-left: 0; } }

/* attendee score sheets */
.score-block .category-title small { max-width: 60ch; }
.score-progress { margin: 0 0 12px; color: var(--accent); font-size: .82rem; font-weight: 800; }
.score-list { display: grid; gap: 11px; }
.score-card { border: 1px solid var(--line); border-radius: var(--radius-card); background: #fff; overflow: hidden; }
.score-card.is-done { border-color: #b7dfc8; }
.score-head { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; width: 100%; min-height: 84px; padding: 16px 17px; border: 0; color: inherit; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.score-head.has-image, .score-card:has(.candidate-photo) .score-head { grid-template-columns: 64px 1fr auto; }
.score-state { padding: 5px 10px; border-radius: 99px; color: var(--muted); background: #e7ecf3; font-size: .76rem; font-weight: 800; white-space: nowrap; }
.score-state.done { color: var(--success); background: #d9f3e8; }
.score-sheet { padding: 4px 17px 18px; border-top: 1px solid var(--line); }
.score-row { margin-top: 16px; }
.score-row label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-weight: 800; }
.score-row label small { color: var(--muted); font-weight: 600; }
.score-input { display: grid; grid-template-columns: 1fr 88px; gap: 14px; align-items: center; }
.score-range { width: 100%; height: 36px; accent-color: var(--accent); }
.score-row.untouched .score-range { opacity: .35; }
.score-number { min-height: 48px !important; text-align: center; font-size: 1.15rem !important; font-weight: 800; font-variant-numeric: tabular-nums; }
.score-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.score-total { font-size: .95rem; color: var(--muted); }
.score-total strong { margin: 0 4px 0 6px; color: var(--ink); font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.score-hint:empty { display: none; }
@media (min-width: 1100px) { .score-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

/* presentation: candidate photos next to names (same images as the mobile ballot) */
.stage-photo { display: block; width: var(--photo, 7vh); height: var(--photo, 7vh); object-fit: cover; border-radius: 1.3vh; background: rgba(255,255,255,.08); }
em.stage-photo.ph { border: 1px dashed rgba(255,255,255,.18); background: transparent; }
.candidate-ticker.has-photos > div { grid-template-columns: var(--photo) 1fr; gap: 1.6vw; min-height: 0; padding-top: .8vh; padding-bottom: .8vh; }
.candidate-ticker.has-photos > div > span { text-align: center; }
.stage-results.has-photos .stage-result-row { grid-template-columns: 45px var(--photo) minmax(120px, .5fr) 1fr 70px; }
.results-title h1 { word-break: keep-all; }

/* English page text inputs (admin) */
.en-input { min-height: 38px !important; border-color: #c4d8fb !important; background: #f3f8ff !important; font-size: .88rem !important; }
.en-input::placeholder { color: #7a93bf; }
.category-head > .cat-name-en { grid-column: 1; }
.category-head > .cat-desc-en { grid-column: 2; }
.cand-row > .cand-name-en { grid-column: 2; }
.cand-row > .cand-desc-en { grid-column: 3; }
.crit-row > .crit-name-en { grid-column: 1; }
.add-row .en-input { min-width: 160px; }
@media (max-width: 960px) { .category-head > .en-input, .cand-row > .en-input, .crit-row > .en-input { grid-column: 1 !important; } }
#optimizeImages { white-space: nowrap; flex: none; }
.section-heading > div:first-child { min-width: 0; flex: 1 1 auto; }

/* presentation: English sub-lines (Korean stays the main text) */
.presentation-stage .en { display: block; margin-top: .3em; color: #8da2c6; font-weight: 600; letter-spacing: 0; line-height: 1.3; text-transform: none; }
.presentation-stage .en.inline { display: inline; margin: 0; font-size: 1em; }
.presentation-stage h1 > .en { margin-top: .55em; font-size: .3em; line-height: 1.25; }
.presentation-stage strong > .en { margin-top: .12em; font-size: .5em; font-weight: 600; }
.presentation-stage p > .en, .presentation-stage .stage-code .en { font-size: .68em; }
.presentation-stage .stage-code > span .en { margin-top: .1em; }
.presentation-stage .stage-note .en { margin-top: .45em; font-size: .85em; }
.presentation-stage .qr-frame p .en { margin-top: .1em; font-size: .78em; color: #58667e; }
.presentation-stage .results-lock .en { font-size: .85em; }
.presentation-stage .hold-slide .en { margin-left: auto; margin-right: auto; }
.candidate-ticker.has-photos > div { min-height: 0; }

/* presentation: breathing room between the progress bar and the note lines */
.vote-stage-copy .stage-progress { margin-top: 4.6vh; }
.vote-stage-copy .stage-note { margin-top: 3.4vh; line-height: 1.5; }
.vote-stage-copy .stage-note .en { margin-top: .7em; line-height: 1.45; }
.presentation-stage .hold-slide .stage-note .en { margin-top: .6em; }
