/* ============================================================
   참가자 사이트 — 모바일 우선
   · 기준 폭은 휴대폰. 큰 화면에서는 가운데 한 칸으로만 넓어진다.
   · 강조색(--ac)은 행사별로 바뀌므로 색을 직접 쓰지 말고 변수만 쓴다.
   ============================================================ */

:root {
    --ac:        #6C5F97;          /* 행사별 강조색 — 레이아웃에서 덮어씀 */
    --ac-soft:   #6C5F9718;
    --bg:        #F4F3F7;
    --surface:   #FFFFFF;
    --line:      #E8E7EE;
    --text:      #23212B;
    --sub:       #7A7889;
    --danger:    #C4635C;
    --ok:        #4E8A6C;
    --radius:    14px;
    --nav-h:     58px;
    --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
            'Malgun Gothic', '맑은 고딕', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    /* 하단 네비 + 아이폰 홈 인디케이터 */
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

img { max-width: 100%; display: block; }
a   { color: inherit; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 14px; }

/* ── 최상단 타이틀 이미지 ─────────────────────
   행사코드·행사명·일시를 늘어놓던 머리말(.top)은 없앴다.
   화면 맨 위에는 관리자가 올린 타이틀 이미지 한 장만 둔다.
   모양은 홈 화면 배너(.banner)와 같다 — 같은 이미지가 화면마다 다른 꼴로 보이면 안 된다. */

/* ── 카드 ───────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 12px;
    box-shadow: 0 1px 3px rgba(35, 33, 43, .05);
}
.card.center { text-align: center; }
.card h2 {
    font-size: 15px; font-weight: 800; margin: 0 0 10px;
    display: flex; align-items: center; gap: 7px;
}
.card h2 .cnt { font-size: 12px; font-weight: 700; color: var(--ac); }

.big   { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.muted { color: var(--sub); font-size: 13px; }
.hint  { color: var(--sub); font-size: 12.5px; line-height: 1.55; margin-top: 8px; }

/* ════════════════════════════════════════════
   메인 화면 — 카운트다운 · 배너 · CTA · 메뉴
   ════════════════════════════════════════════ */

/* 남은 시간 */
.cd {
    background: linear-gradient(150deg, #171526 0%, var(--ac) 100%);
    border-radius: var(--radius);
    margin-top: 14px; padding: 14px 16px;
}
.cd-row { display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.cd-u   { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cd-n {
    font-size: clamp(1.7rem, 8vw, 2.4rem); font-weight: 900; line-height: 1; color: #fff;
    font-variant-numeric: tabular-nums; letter-spacing: -1.5px;
    background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.18);
    border-radius: 14px;
    width: clamp(54px, 14vw, 66px); height: clamp(54px, 14vw, 66px);
    display: flex; align-items: center; justify-content: center;
}
.cd-l { font-size: 11px; color: rgba(255,255,255,.6); font-weight: 600; }
.cd-s { font-size: 1.7rem; font-weight: 800; color: rgba(255,255,255,.35); padding-bottom: 24px; line-height: 1; }

/* 배너 (타이틀 이미지) */
.banner {
    display: block;   /* 최상단 타이틀 이미지는 <a> 로 감싼다 (누르면 홈) */
    margin-top: 14px; border-radius: var(--radius); overflow: hidden; line-height: 0;
    box-shadow: 0 1px 8px rgba(35, 33, 43, .09);
}
/* 높이는 너비에 맞춰 비율대로 따라온다.
   max-height + object-fit:cover 로 잘라내지 않는다 — 가로로 넓은 타이틀 이미지를
   올려도 잘리지 않고 그대로 보여야 한다. 보이는 높이는 올리는 이미지 비율로 정한다. */
.banner img { display: block; width: 100%; height: auto; }

/* 행사 정보 */
.ev-box   { padding: 18px; }
.ev-tags  { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ev-tag {
    font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 6px;
    background: var(--ac-soft); color: var(--ac);
}
.ev-title {
    font-size: clamp(1.1rem, 4.5vw, 1.4rem); font-weight: 800;
    line-height: 1.35; letter-spacing: -.3px; margin-bottom: 12px;
}
.ev-meta { display: flex; flex-direction: column; gap: 5px; }
.ev-line { display: flex; gap: 10px; font-size: 13px; color: var(--sub); }
/* 아이콘 대신 항목 이름을 글자로 — 폭을 고정해 값이 세로로 정렬된다 */
.ev-k    { flex-shrink: 0; width: 40px; color: #A6A4B4; }

/* 사전등록 큰 버튼 */
.cta {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 14px; padding: 17px 20px; min-height: 56px;
    background: linear-gradient(150deg, #171526 0%, var(--ac) 100%);
    color: #fff; text-decoration: none;
    border-radius: var(--radius);
    font-size: 17px; font-weight: 700; letter-spacing: -.1px;
    box-shadow: 0 2px 16px var(--ac-soft);
    transition: filter .15s, transform .12s;
}
.cta:hover  { filter: brightness(1.12); }
.cta:active { transform: scale(.98); }

/* 메뉴 카드 */
.menu {
    background: var(--surface); border-radius: var(--radius);
    margin-top: 12px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(35, 33, 43, .05);
}
/* 아이콘 없이 글자만으로 읽히게 — 제목은 굵게, 설명은 한 단계 낮춰 위계를 만든다 */
.mi {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 16px 18px; min-height: 64px;
    background: none; border: none; border-bottom: 1px solid var(--line);
    text-align: left; text-decoration: none; color: inherit;
    font-family: inherit; cursor: pointer;
    transition: background .12s;
}
.mi:last-child { border-bottom: none; }
.mi:active     { background: var(--bg); }
.mi-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mi-t   { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.mi-s   { font-size: 12.5px; color: var(--sub); line-height: 1.35; }
.mi-arr { color: #C8C6D2; font-size: 19px; flex-shrink: 0; line-height: 1; }

/* 모달 */
.ov {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(23, 21, 38, .55);
    align-items: center; justify-content: center; padding: 16px;
}
.ov.open { display: flex; }
.mo {
    background: var(--surface); border-radius: 18px;
    width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto;
    animation: moIn .2s cubic-bezier(.32, .72, 0, 1);
}
@keyframes moIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.mo-h {
    display: flex; align-items: center; justify-content: space-between;
    padding: 17px 18px 13px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: var(--surface);
    border-radius: 18px 18px 0 0; font-size: 16px;
}
.mo-x {
    background: var(--bg); border: none; border-radius: 50%;
    width: 34px; height: 34px; font-size: 15px; color: var(--sub);
    cursor: pointer; flex-shrink: 0;
}
.mo-b    { padding: 18px 18px 26px; }
.mo-img  { width: 100%; border-radius: 12px; }
.mo-text { font-size: 14px; line-height: 1.85; white-space: pre-wrap; }

/* 연사 */
.spk { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.spk:last-child { border-bottom: none; }
.spk-av {
    flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%;
    background: var(--ac); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 800;
}
.spk-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spk-n { font-size: 15px; font-weight: 700; }
.spk-o { font-size: 12.5px; color: var(--sub); }
.spk-t { font-size: 12px; color: var(--ac); }

/* ── 기능 타일 (다른 화면에서 사용) ─────────── */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tile {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 14px;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(35, 33, 43, .05);
    display: flex; flex-direction: column; gap: 4px;
    transition: transform .12s, box-shadow .12s;
}
.tile:active { transform: scale(.97); }
.tile .ti  { font-size: 22px; line-height: 1; }
.tile .tt  { font-size: 14.5px; font-weight: 700; margin-top: 6px; }
.tile .td  { font-size: 12px; color: var(--sub); line-height: 1.45; }
.tile.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; }
.tile.wide .ti { font-size: 20px; }
.tile.wide .tt { margin-top: 0; }

/* ── 폼 ─────────────────────────────────────── */
.field { margin-bottom: 13px; }
.field > label {
    display: block; font-size: 12.5px; font-weight: 700;
    color: var(--sub); margin-bottom: 5px;
}
.field .req { color: var(--danger); }

input[type=text], input[type=tel], input[type=email],
input[type=date], input[type=number], select, textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;            /* 16px 미만이면 iOS 에서 화면이 확대된다 */
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--ac); box-shadow: 0 0 0 3px var(--ac-soft);
}

/* 선택지 — 손가락으로 누르기 쉽게 줄 전체를 버튼처럼 */
.opts { display: flex; flex-direction: column; gap: 7px; }
.opt {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 14.5px;
    cursor: pointer;
}
.opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--ac); flex-shrink: 0; }
.opt.on { border-color: var(--ac); background: var(--ac-soft); font-weight: 600; }

/* 척도 1~10 */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale label {
    text-align: center; padding: 11px 0;
    border: 1px solid var(--line); border-radius: 9px;
    font-size: 14px; font-weight: 700; background: #fff; cursor: pointer;
}
.scale label.on { border-color: var(--ac); background: var(--ac); color: #fff; }
.scale input { display: none; }
.scale-ends {
    display: flex; justify-content: space-between;
    font-size: 11.5px; color: var(--sub); margin-top: 6px;
}

/* ── 버튼 ───────────────────────────────────── */
.btn {
    display: block; width: 100%;
    padding: 14px;
    background: var(--ac); color: #fff;
    border: none; border-radius: 11px;
    font-family: inherit; font-size: 15.5px; font-weight: 700;
    cursor: pointer; text-align: center; text-decoration: none;
    transition: transform .12s, opacity .12s;
}
.btn:active   { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.ghost    { background: transparent; color: var(--ac); border: 1px solid var(--ac); }
.btn.line     { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-wrap     { margin-top: 16px; }

/* ── 알림 ───────────────────────────────────── */
.alert {
    padding: 12px 14px; border-radius: 11px;
    font-size: 13.5px; margin-top: 12px; line-height: 1.55;
}
.alert.err  { background: #FAEEED; color: #A6534C; }
.alert.ok   { background: #EDF6F1; color: #3F7458; }
.alert.info { background: #EFF1F8; color: #55597A; }

/* ── 목록 ───────────────────────────────────── */
.row {
    padding: 13px 0; border-bottom: 1px solid var(--line);
    display: flex; gap: 11px; align-items: flex-start;
}
.row:last-child { border-bottom: none; }
.row .rb { flex: 1; min-width: 0; }
.row .rt { font-size: 14.5px; font-weight: 600; }
.row .rs { font-size: 12px; color: var(--sub); margin-top: 3px; }

.tag {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 700; background: var(--ac-soft); color: var(--ac);
}
.tag.done { background: #EDF6F1; color: var(--ok); }
.tag.off  { background: #F1F0F5; color: var(--sub); }

.empty { text-align: center; color: var(--sub); font-size: 13.5px; padding: 26px 10px; }

/* ════════════════════════════════════════════
   실시간 투표 (/vote)
   진행 여부를 한눈에 알려 주는 배지 + 결과 막대
   ════════════════════════════════════════════ */

.vt-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 99px;
    font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
    margin-bottom: 10px;
}
.vt-badge.live { background: #FAEEED; color: #C0605A; }
.vt-badge.live::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; animation: vtPulse 1.1s ease-in-out infinite;
}
.vt-badge.done  { background: #F1F0F5; color: var(--sub); }
.vt-badge.voted { background: #EDF6F1; color: var(--ok); }
@keyframes vtPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* 질문 */
.vt-q { font-size: 17.5px; font-weight: 800; line-height: 1.45; margin-bottom: 14px; }

/* 결과 막대 */
.vt-res + .vt-res { margin-top: 12px; }
.vt-top {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    font-size: 13.5px; margin-bottom: 5px;
}
.vt-label { flex: 1; min-width: 0; font-weight: 600; line-height: 1.35; }
.vt-num   { flex-shrink: 0; font-weight: 700; color: var(--sub); font-variant-numeric: tabular-nums; }
.vt-num b { color: var(--ac); }
.vt-track { height: 11px; border-radius: 99px; background: #F1F0F5; overflow: hidden; }
.vt-fill  {
    height: 100%; border-radius: 99px; background: var(--ac-soft);
    transition: width .5s cubic-bezier(.4, 0, .2, 1), background .3s;
}
/* 1위만 진하게 — 결과를 한눈에 */
.vt-res.win .vt-fill { background: var(--ac); }

.vt-total {
    margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line);
    text-align: center; font-size: 12.5px; color: var(--sub);
    font-variant-numeric: tabular-nums;
}
.vt-total b { color: var(--text); font-weight: 800; }

/* ── 하단 네비 ──────────────────────────────── */
.nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    display: flex; align-items: stretch;
}
.nav a, .nav button {
    flex: 1; text-decoration: none; color: var(--sub);
    display: flex; align-items: center; justify-content: center;
    font-size: 13.5px; font-weight: 600;
    background: none; border: none; font-family: inherit; cursor: pointer;
}
.nav a.on { color: var(--ac); font-weight: 700; }
/* 가운데 홈만 양옆과 구분되게 */
.nav a[href="/"] { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

.foot { text-align: center; color: #B7B5C2; font-size: 11.5px; padding: 22px 0 8px; }

/* 큰 화면에서도 모바일 레이아웃을 유지하되 여백만 넉넉하게 */
@media (min-width: 640px) {
    body { padding-bottom: 40px; }
    .nav { position: static; max-width: 560px; margin: 18px auto 0; border-radius: var(--radius); border: 1px solid var(--line); }
}

/* 하단 네비 — 기호 전용 (글자를 없앤 대신 누르기 좋게 크게) */
.nav-ico button { font-size: 24px; font-weight: 400; padding-bottom: 3px; }
.nav-ico a svg  { display: block; }
