:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #2a2622;
  --muted: #6b635a;
  --line: #e6e0d6;
  --accent: #0f6b5c;
  --accent-dark: #0b5346;
  --accent-soft: #e3f1ee;
  --amber: #8f4f0c;
  --amber-soft: #fbf0df;
  --gray: #5f5f5f;
  --gray-soft: #eeeeec;
  --danger: #b3261e;
  --danger-dark: #8f1d17;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; font-size: 16px; line-height: 1.75; }
h1, h2, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1180px; }
main.wrap { padding-top: 28px; padding-bottom: 64px; min-height: 60vh; }
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { padding-top: 14px; padding-bottom: 14px; }
.site-name { font-size: 18px; font-weight: 700; text-decoration: none; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head-user { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-foot .wrap { padding-top: 18px; padding-bottom: 18px; }

.page-title { font-size: 26px; line-height: 1.4; margin-bottom: 8px; }
.lead { color: var(--muted); margin-bottom: 24px; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.back { margin-bottom: 16px; font-size: 15px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--danger); font-weight: 500; }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
.notice { background: var(--amber-soft); color: #5e3408; border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 32px 0; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.pill { display: inline-block; font-size: 13px; font-weight: 700; line-height: 1.5; padding: 3px 10px; border-radius: 999px; }
.pill-open { background: var(--accent-soft); color: var(--accent-dark); }
.pill-waitlist { background: var(--amber-soft); color: var(--amber); }
.pill-closed { background: var(--gray-soft); color: var(--gray); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.thumb { aspect-ratio: 16 / 9; background: #ece6db; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.card-date { color: var(--accent-dark); font-weight: 700; font-size: 15px; }
.card-title { font-size: 19px; line-height: 1.45; margin: 4px 0 8px; }
.card-meta { color: var(--muted); font-size: 14px; line-height: 1.6; }
.card-foot { margin-top: auto; padding-top: 12px; }

.detail { max-width: 760px; margin: 0 auto; }
.detail > .thumb { border-radius: var(--radius); margin-bottom: 20px; }
.detail-state { margin-bottom: 6px; }
.detail-title { font-size: 28px; line-height: 1.4; margin-bottom: 18px; }
.facts { display: grid; grid-template-columns: 7em 1fr; gap: 10px 14px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.facts dt { color: var(--muted); font-size: 15px; }
.facts dd { overflow-wrap: anywhere; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 26px; }
.policy { background: #f3efe7; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 26px; }
.policy h2 { font-size: 16px; margin-bottom: 4px; }
.policy p + p { margin-top: 8px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel > p + p { margin-top: 10px; }
.form-title { font-size: 20px; line-height: 1.45; margin-bottom: 16px; }
.field { margin-bottom: 18px; }
.label { display: block; font-weight: 700; margin-bottom: 6px; padding: 0; }
.req { display: inline-block; font-size: 12px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 4px; padding: 0 6px; margin-left: 4px; line-height: 1.6; vertical-align: 1px; }
input[type="text"], input[type="email"], input[type="date"], input[type="time"], input[type="number"], select, textarea { width: 100%; font: inherit; font-size: 16px; color: inherit; background: #fff; border: 1px solid #bdb5a9; border-radius: 8px; padding: 10px 12px; min-height: 46px; }
textarea { resize: vertical; line-height: 1.6; }
input[type="file"] { font: inherit; max-width: 100%; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 10px; border: 1px solid #bdb5a9; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }

.btn { display: inline-block; font: inherit; font-weight: 700; color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 8px; padding: 11px 28px; min-height: 46px; cursor: pointer; }
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: #bdb5a9; }
.btn-ghost:hover { background: #f4f1ea; border-color: #bdb5a9; }
.btn-small { padding: 4px 14px; min-height: 36px; font-size: 14px; }
.btn-text { font: inherit; font-size: 14px; background: none; border: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 2px 4px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
#applyForm .btn { width: 100%; }

.done { max-width: 620px; margin: 0 auto; }
.done-title { font-size: 23px; line-height: 1.45; margin-bottom: 12px; }
.done-event { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; font-weight: 500; }

/* 管理者ページ */
.login { max-width: 460px; margin: 40px auto 0; }
.login #gbtn { margin-top: 16px; }
.login .error { margin-top: 12px; }
.guide { background: var(--amber-soft); border: 1px solid #ecd6b2; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; }
.guide summary { font-weight: 700; font-size: 17px; cursor: pointer; }
.guide p { margin-top: 8px; }
.guide-sender { background: #fff; border-radius: 8px; padding: 8px 12px; overflow-wrap: anywhere; }
.guide ol { margin: 12px 0 4px; padding-left: 1.6em; }
.guide li { margin-bottom: 8px; }
.guide-who { display: inline-block; font-size: 13px; font-weight: 700; background: #fff; border-radius: 4px; padding: 0 8px; margin-right: 8px; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { font: inherit; font-weight: 700; color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; cursor: pointer; }
.tab.on { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tab-link { margin-left: auto; font-size: 14px; color: var(--accent); padding: 10px 4px; }
.event-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 24px; }
.pick { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.pick:hover { border-color: var(--accent); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pick-date { font-size: 13px; color: var(--muted); }
.pick-title { font-weight: 700; line-height: 1.45; }
.pick-count { font-size: 14px; margin-top: 4px; }
.pick-count b { font-size: 17px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.list-head h2 { font-size: 19px; line-height: 1.45; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; background: #f6f3ec; padding: 10px 12px; white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table small { display: block; font-size: 12px; color: var(--muted); }
.table small.error { color: var(--danger); font-weight: 700; }
.status { font-weight: 700; white-space: nowrap; }
.row-join .status { color: var(--accent-dark); }
.row-wait .status { color: var(--amber); }
.row-cancel td { color: var(--gray); background: #fafaf8; }
.form-panel { max-width: 820px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.image-preview img { max-height: 200px; border-radius: 8px; margin-bottom: 8px; }
.q-row { display: grid; grid-template-columns: 1fr 110px auto auto; gap: 8px; align-items: center; background: #f8f6f1; border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.q-options { grid-column: 1 / -1; }
.q-req { display: flex; align-items: center; gap: 4px; font-size: 14px; white-space: nowrap; }

@media (max-width: 640px) {
  .page-title { font-size: 23px; }
  .detail-title { font-size: 24px; }
  .facts { grid-template-columns: 5.5em 1fr; }
  .panel { padding: 18px 16px; }
  .q-row { grid-template-columns: 1fr auto; }
  .q-label, .q-options { grid-column: 1 / -1; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-top: 1px solid var(--line); padding: 8px 0; }
  .table tr:first-child { border-top: 0; }
  .table td { border: 0; padding: 4px 12px; display: grid; grid-template-columns: 6.5em 1fr; gap: 8px; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .table td:not([data-label])::before { content: ""; }
  .tab-link { margin-left: 0; }
}
