* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif; background: #f4f6f4; color: #222; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.site-header { background: #2e7d32; color: #fff; padding: 12px 0; margin-bottom: 20px; }
.logo { font-weight: bold; font-size: 20px; }
.badge { background: #fff; color: #2e7d32; border-radius: 4px; padding: 1px 8px; font-size: 12px; vertical-align: middle; }
.card { background: #fff; border-radius: 10px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.memo { white-space: pre-wrap; }
.muted { color: #666; font-size: 13px; }
.req { color: #c62828; font-size: 12px; }
.error { color: #c62828; }
.ok { color: #2e7d32; }
.countdown { font-weight: bold; color: #2e7d32; }
.notice { background: #fff8e1; border: 1px solid #ffe082; border-radius: 6px; padding: 10px; }
label { display: block; margin: 12px 0; font-size: 14px; }
label.inline { display: inline-block; margin-right: 16px; }
input[type="text"], input[type="datetime-local"], textarea, select {
  display: block; width: 100%; margin-top: 4px; padding: 9px; font-size: 15px;
  border: 1px solid #bbb; border-radius: 6px; background: #fff;
}
fieldset { border: 1px solid #ddd; border-radius: 6px; margin: 12px 0; }
.btn { border: 1px solid #999; background: #fff; border-radius: 6px; padding: 8px 16px; font-size: 14px; cursor: pointer; }
.btn.primary { background: #2e7d32; border-color: #2e7d32; color: #fff; font-weight: bold; }
.btn.danger { background: #c62828; border-color: #c62828; color: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.link-row { display: flex; gap: 8px; margin: 6px 0 14px; }
.link-row input { flex: 1; }
.danger-zone { border: 1px solid #ef9a9a; }

/* 日程の ○△× 選択 */
.date-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eee; flex-wrap: wrap; }
.date-row .date-label { flex: 1; min-width: 140px; font-weight: bold; }
.mark-group { display: flex; gap: 6px; }
.mark-btn { width: 44px; height: 44px; font-size: 22px; border: 2px solid #bbb; border-radius: 50%; background: #fff; cursor: pointer; line-height: 1; }
.mark-btn.selected-maru { border-color: #2e7d32; background: #e8f5e9; color: #2e7d32; font-weight: bold; }
.mark-btn.selected-sankaku { border-color: #ef6c00; background: #fff3e0; color: #ef6c00; font-weight: bold; }
.mark-btn.selected-batsu { border-color: #c62828; background: #ffebee; color: #c62828; font-weight: bold; }
.clear-btn { border: none; background: none; color: #888; font-size: 12px; cursor: pointer; text-decoration: underline; }

/* お店カード */
.shop-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.shop-card input[type="checkbox"] { width: 22px; height: 22px; margin-top: 2px; }
.shop-card .shop-name { font-weight: bold; }
.shop-card .shop-note { color: #555; font-size: 13px; }
.shop-card a { font-size: 13px; }

/* 結果テーブル */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid #ccc; padding: 6px 8px; text-align: center; white-space: nowrap; }
th { background: #eef4ee; }
td.date-cell, th.date-cell { text-align: left; font-weight: bold; }
tr.best-date td { background: #fff8e1; }
.best-badge { background: #ef6c00; color: #fff; border-radius: 4px; padding: 0 6px; font-size: 12px; margin-left: 6px; }
.counts-cell { color: #555; font-size: 13px; }
.mark-maru { color: #2e7d32; font-weight: bold; font-size: 17px; }
.mark-sankaku { color: #ef6c00; font-weight: bold; font-size: 17px; }
.mark-batsu { color: #c62828; font-weight: bold; font-size: 17px; }
button.name-link { border: none; background: none; color: #1565c0; text-decoration: underline; cursor: pointer; font-size: 14px; padding: 0; }
.details-item { border-top: 1px solid #eee; padding: 10px 0; font-size: 14px; }
.details-item .d-name { font-weight: bold; }
#shop-ranking li { margin: 6px 0; font-size: 15px; }
.vote-count { background: #2e7d32; color: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; margin-left: 6px; }

/* 管理画面の行編集 */
.edit-row { display: flex; gap: 6px; margin: 6px 0; }
.edit-row input { flex: 1; }
.edit-row .del-row { flex: 0 0 auto; }
.admin-response { border: 1px solid #ddd; border-radius: 8px; padding: 12px; margin: 10px 0; font-size: 14px; }
.admin-response .row-head { display: flex; justify-content: space-between; align-items: center; }
@media (max-width: 600px) { .mark-btn { width: 40px; height: 40px; } }

/* --- UX改善: 初見の参加者がスマホで迷わず回答するための導線 --- */
.event-page main { padding-bottom: 104px; }
.summary-card { border-left: 6px solid #2e7d32; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.summary-item { background: #f1f8f1; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 3px; }
.summary-label { color: #2e7d32; font-size: 12px; font-weight: bold; }
.summary-item strong { font-size: 17px; }

.step-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0 0 6px; padding: 10px 12px; background: #eef4ee; border-radius: 8px; font-size: 13px; font-weight: bold; }
.form-step { border-top: 1px solid #e5e5e5; margin-top: 18px; padding-top: 4px; }
.form-step:first-of-type { border-top: none; margin-top: 6px; }
.step-title { display: flex; align-items: center; gap: 8px; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #2e7d32; color: #fff; font-size: 14px; flex: 0 0 auto; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.step-head .step-title { margin-bottom: 8px; }
.progress-text { color: #2e7d32; font-size: 13px; font-weight: bold; white-space: nowrap; }
.progress-track { height: 8px; background: #e0e0e0; border-radius: 999px; overflow: hidden; margin: 4px 0 12px; }
.progress-bar { height: 100%; width: 0; background: #2e7d32; border-radius: 999px; transition: width .2s ease; }
.bulk-btn { min-height: 40px; }
.btn:disabled { opacity: .55; cursor: wait; }
.step-lead { margin: 4px 0 8px; color: #555; font-size: 14px; }

details.form-step { border: 1px solid #ddd; border-radius: 8px; padding: 0; overflow: hidden; }
details.form-step > summary { display: flex; align-items: center; gap: 8px; padding: 14px; cursor: pointer; font-weight: bold; list-style: none; background: #fafafa; }
details.form-step > summary::-webkit-details-marker { display: none; }
details.form-step > summary::after { content: "開く"; margin-left: auto; color: #2e7d32; font-size: 13px; }
details.form-step[open] > summary::after { content: "閉じる"; }
.summary-hint { color: #666; font-size: 12px; font-weight: normal; }
.extras-body { padding: 2px 14px 14px; }

.editing-notice { border-color: #a5d6a7; background: #e8f5e9; }
.completion-summary { border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
.completion-row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 12px; padding: 9px 12px; border-bottom: 1px solid #eee; font-size: 14px; }
.completion-row:last-child { border-bottom: none; }
.completion-row span { color: #666; }
.completion-extras { margin: 0; padding: 10px 12px; background: #fafafa; font-size: 14px; }

.sticky-submit { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 20; width: min(860px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid #cfd8cf; box-shadow: 0 -3px 14px rgba(0,0,0,.14); }
.sticky-submit[hidden] { display: none !important; }
.submit-status { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.submit-status span { color: #666; font-size: 12px; }
.submit-main { min-width: 132px; min-height: 48px; font-size: 16px; }
.form-tools { min-height: 0; }

.shop-card { width: 100%; cursor: pointer; }
.shop-card.selected { border-color: #2e7d32; background: #e8f5e9; }
.shop-info { flex: 1; min-width: 0; }
.shop-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }

.own-badge { display: inline-block; background: #2e7d32; color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 6px; vertical-align: middle; }
th.own-column, td.own-column { background: #e8f5e9 !important; }
.date-cards { display: none; }
.date-card { border: 1px solid #ddd; border-radius: 8px; padding: 14px; }
.date-card.best-date-card { border-color: #ef6c00; background: #fff8e1; }
.date-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.date-card-head h3 { margin: 0; }
.date-card-counts { color: #555; font-weight: bold; margin: 8px 0; }
.date-card-group { border-top: 1px solid #eee; padding: 8px 0 2px; }
.date-card-group h4 { margin: 0 0 4px; font-size: 14px; }
.date-card-group p { margin: 0; color: #444; font-size: 14px; overflow-wrap: anywhere; }
.ranking-main { display: flex; align-items: center; flex-wrap: wrap; }
.voter-names { margin-top: 2px; overflow-wrap: anywhere; }
.link-label { font-weight: bold; margin: 12px 0 4px; }
.link-label:first-of-type { margin-top: 0; }

@media (max-width: 700px) {
  .summary-grid { grid-template-columns: 1fr; }
  .table-scroll { display: none; }
  .date-cards { display: grid; gap: 12px; margin-top: 12px; }
  .sticky-submit { padding-left: 12px; padding-right: 12px; }
  .submit-main { min-width: 112px; }
  .completion-row { grid-template-columns: 96px 1fr; }
  .step-nav { font-size: 12px; }
}

/* 参加者によるお店追加 */
.add-shop { margin-top: 16px; border-top: 1px dashed #cbd5e1; padding-top: 12px; }
.add-shop-row { display: flex; flex-wrap: wrap; gap: 8px; }
.add-shop-row input { flex: 1 1 170px; }
