/* Cooking Challenges — list page, challenge page and home card.
   Tokens match home-v2.css: brand red #e74c3c, navy #1f2f3d, muted #6b7680/#97a3ad,
   borders #eeece8, soft card fills #f4f3f1/#faf9f7, 14px radius, pill buttons. */

.ch-page { max-width: 1180px; margin: 0 auto; padding: 24px 24px 56px; box-sizing: border-box; color: #1f2f3d; }
.ch-page h1, .ch-page h2, .ch-page h3 { color: #1f2f3d; margin: 0; }

.ch-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 18px; border-radius: 999px; border: 1px solid #eeece8; background: #fff; color: #1f2f3d; font-size: 14px; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, transform .15s; }
.ch-btn:hover { background: #faf9f7; border-color: #ddd9d3; color: #1f2f3d; }
.ch-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.ch-btn-primary { background: #e74c3c; border-color: #e74c3c; color: #fff; box-shadow: 0 6px 18px rgba(231,76,60,.28); }
.ch-btn-primary:hover { background: #d8432f; border-color: #d8432f; color: #fff; transform: translateY(-1px); }
.ch-btn[disabled] { opacity: .6; cursor: default; transform: none; }

.ch-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: #f4f3f1; color: #1f2f3d; }
.ch-pill svg { width: 14px; height: 14px; }
.ch-pill-live { background: #fdeceb; color: #c0392b; }
.ch-pill-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #e74c3c; }
.ch-pill-gold { background: #fff4d6; color: #8a5a00; }

/* ---------- hero (current challenge) ---------- */
.ch-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: #fff; border: 1px solid #eeece8; border-radius: 18px; overflow: hidden; box-shadow: 0 1px 3px rgba(45,62,79,.06); }
.ch-hero-media { position: relative; min-height: 280px; background: #f4f3f1 center / cover no-repeat; }
.ch-hero-media .ch-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 64px; }
.ch-hero-body { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 32px; }
.ch-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #e74c3c; }
.ch-hero h1 { font-size: 32px; line-height: 1.15; font-weight: 800; text-wrap: balance; }
.ch-hero p { margin: 0; color: #6b7680; font-size: 15px; line-height: 1.55; white-space: pre-line; }
.ch-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- section headings ---------- */
.ch-section { margin-top: 36px; }
.ch-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ch-section-head h2 { font-size: 20px; font-weight: 800; }
.ch-section-head span { color: #97a3ad; font-size: 13.5px; }

/* ---------- past / upcoming cards ---------- */
.ch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.ch-card { display: flex; flex-direction: column; background: #fff; border: 1px solid #eeece8; border-radius: 14px; overflow: hidden; text-decoration: none; color: #1f2f3d; transition: box-shadow .15s, transform .15s; }
.ch-card:hover { box-shadow: 0 6px 18px rgba(45,62,79,.1); transform: translateY(-2px); color: #1f2f3d; }
.ch-card-media { aspect-ratio: 16 / 10; background: #f4f3f1 center / cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.ch-card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.ch-card-body h3 { font-size: 16px; font-weight: 800; line-height: 1.3; }
.ch-card-sub { font-size: 13px; color: #97a3ad; }
.ch-winner-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #1f2f3d; }
.ch-winner-line img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }

.ch-empty { padding: 40px 20px; text-align: center; color: #6b7680; background: #fff; border: 1px dashed #ddd9d3; border-radius: 14px; }
.ch-empty strong { display: block; margin-bottom: 6px; font-size: 17px; color: #1f2f3d; }

/* ---------- challenge page ---------- */
.ch-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: #6b7680; font-size: 13.5px; font-weight: 700; text-decoration: none; }
.ch-back:hover { color: #e74c3c; }
.ch-back svg { width: 14px; height: 14px; }

.ch-notice { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 12px 16px; border-radius: 12px; background: #faf9f7; border: 1px solid #eeece8; font-size: 14px; color: #1f2f3d; }
.ch-notice svg { width: 18px; height: 18px; color: #e74c3c; flex-shrink: 0; }

.ch-winner { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: center; margin-top: 24px; padding: 18px; background: linear-gradient(135deg, #fff8e6, #fff); border: 1px solid #f3dfa6; border-radius: 16px; }
.ch-winner-photo { aspect-ratio: 1; border-radius: 12px; background: #f4f3f1 center / cover no-repeat; }
.ch-winner h2 { font-size: 22px; font-weight: 800; margin-top: 6px; }
.ch-winner p { margin: 6px 0 0; color: #6b7680; }
.ch-winner-who { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: #1f2f3d; text-decoration: none; font-weight: 700; }
.ch-winner-who img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

.ch-tabs { display: inline-flex; gap: 4px; padding: 4px; background: #f4f3f1; border-radius: 999px; }
.ch-tab { padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: #6b7680; text-decoration: none; }
.ch-tab:hover { color: #1f2f3d; }
.ch-tab.is-active { background: #fff; color: #1f2f3d; box-shadow: 0 1px 3px rgba(45,62,79,.1); }

.ch-entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.ch-entry { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid #eeece8; border-radius: 14px; overflow: hidden; }
.ch-entry.is-mine { border-color: #f3c2bc; }
.ch-entry.is-winner { border-color: #f0c64a; box-shadow: 0 0 0 2px #f6dc8a; }
.ch-entry-photo { display: block; aspect-ratio: 1; background: #f4f3f1; overflow: hidden; }
.ch-entry-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.ch-entry:hover .ch-entry-photo img { transform: scale(1.03); }
.ch-entry-rank { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(31,47,61,.82); color: #fff; font-size: 12px; font-weight: 800; }
.ch-entry-rank.is-gold { background: #f0b429; color: #3d2a00; }
.ch-entry-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.ch-entry-caption { margin: 0; font-size: 14px; line-height: 1.4; color: #1f2f3d; word-break: break-word; }
.ch-entry-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ch-author { display: flex; align-items: center; gap: 8px; min-width: 0; color: #1f2f3d; font-size: 13px; font-weight: 700; text-decoration: none; }
.ch-author img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.ch-author span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-author:hover { color: #e74c3c; }

.ch-vote { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid #eeece8; background: #fff; color: #1f2f3d; font-size: 13px; font-weight: 800; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.ch-vote svg { width: 16px; height: 16px; }
.ch-vote:hover:not([disabled]) { border-color: #e74c3c; color: #e74c3c; }
.ch-vote.is-voted { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.ch-vote.is-voted svg { fill: currentColor; }
.ch-vote[disabled] { cursor: default; opacity: .75; }
.ch-entry-remove { border: 0; background: none; padding: 0; color: #97a3ad; font-size: 12.5px; font-weight: 700; cursor: pointer; text-align: left; }
.ch-entry-remove:hover { color: #c0392b; }

/* ---------- entry dialog ---------- */
.ch-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(31,47,61,.55); }
.ch-modal[hidden] { display: none; }
.ch-dialog { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 20px 60px rgba(31,47,61,.3); box-sizing: border-box; }
.ch-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.ch-dialog-head h3 { font-size: 19px; font-weight: 800; }
.ch-dialog-head p { margin: 4px 0 0; font-size: 13.5px; color: #6b7680; }
.ch-close { border: 0; background: #f4f3f1; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; color: #1f2f3d; cursor: pointer; flex-shrink: 0; }
.ch-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; aspect-ratio: 4 / 3; border: 2px dashed #ddd9d3; border-radius: 14px; background: #faf9f7 center / cover no-repeat; color: #6b7680; font-size: 14px; font-weight: 700; cursor: pointer; text-align: center; padding: 12px; transition: border-color .15s; }
.ch-drop:hover, .ch-drop.is-over { border-color: #e74c3c; }
.ch-drop svg { width: 32px; height: 32px; color: #e74c3c; }
.ch-drop.has-image { border-style: solid; color: transparent; }
.ch-drop.has-image svg { display: none; }
.ch-drop input { display: none; }
.ch-field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.ch-field label { font-size: 13px; font-weight: 700; color: #1f2f3d; }
.ch-field textarea { width: 100%; box-sizing: border-box; min-height: 74px; padding: 10px 12px; border: 1px solid #eeece8; border-radius: 12px; font: inherit; font-size: 14px; resize: vertical; outline: none; }
.ch-field textarea:focus { border-color: #e74c3c; }
.ch-count { align-self: flex-end; font-size: 12px; color: #97a3ad; font-variant-numeric: tabular-nums; }
.ch-check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; color: #1f2f3d; cursor: pointer; }
/* main.css hides native checkboxes site-wide (for its custom-skinned ones) */
.ch-check input[type="checkbox"] { display: block; -webkit-appearance: checkbox; appearance: auto; width: 18px; height: 18px; margin: 0; accent-color: #e74c3c; cursor: pointer; }
.ch-error { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #fdeceb; color: #c0392b; font-size: 13.5px; font-weight: 600; }
.ch-error[hidden] { display: none; }
.ch-dialog .ch-btn-primary { width: 100%; margin-top: 18px; padding: 12px 18px; }

.ch-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: #1f2f3d; color: #fff; font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 10001; }
.ch-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- home page card ---------- */
.ch-home { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; align-items: center; gap: 20px; margin: 0 0 22px; padding: 14px; background: #fff; border: 1px solid #eeece8; border-radius: 16px; box-shadow: 0 1px 3px rgba(45,62,79,.06); color: #1f2f3d; }
.ch-home-media { aspect-ratio: 16 / 10; border-radius: 12px; background: #f4f3f1 center / cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.ch-home-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ch-home-body h3 { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; color: #1f2f3d; }
.ch-home-body p { margin: 0; font-size: 13.5px; color: #6b7680; }
.ch-home-winner .ch-home-media { aspect-ratio: 1; max-width: 120px; }
.ch-home-winner { grid-template-columns: 120px minmax(0, 1fr) auto; }

@media (prefers-reduced-motion: reduce) {
	.ch-btn, .ch-card, .ch-entry-photo img, .ch-toast { transition: none; }
}

@media (max-width: 860px) {
	.ch-hero { grid-template-columns: 1fr; }
	.ch-hero-media { min-height: 200px; aspect-ratio: 16 / 9; }
	.ch-hero-body { padding: 22px; }
	.ch-hero h1 { font-size: 26px; }
	.ch-winner { grid-template-columns: 1fr; }
	.ch-winner-photo { max-width: 320px; }
	.ch-home { grid-template-columns: 1fr; }
	.ch-home-winner { grid-template-columns: 96px minmax(0, 1fr); }
	.ch-home-winner .ch-btn { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
	.ch-page { padding: 16px 16px 40px; }
	.ch-entries { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.ch-entry-foot { flex-direction: column; align-items: stretch; }
	.ch-vote { justify-content: center; }
}
