/*
 * 基本スタイル：リセット、レイアウト（l-）、共通部品（c-）、補助（u-）
 * 画面固有のスタイルは css/pages/、部品の追加は css/components/ に分ける（CODING_RULES 9-1）
 * スマホを基準に書き、PC は @media (min-width: 768px) で上書きする。
 */

/* ---------- リセット（タグセレクタはここだけ） ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
a:hover { color: var(--shu-deep); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 3px solid var(--shu); outline-offset: 2px; }

/* ---------- レイアウト ---------- */
.l-body { min-height: 100vh; display: flex; flex-direction: column; }
.l-main { flex: 1 0 auto; width: 100%; max-width: var(--content-max); margin: 0 auto; padding-bottom: var(--space-5); }
.l-main--center { display: flex; align-items: center; justify-content: center; }
.l-section { padding: var(--space-4) var(--gutter) 0; display: flex; flex-direction: column; gap: var(--space-2); }

.l-header {
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: var(--border);
}
.l-header__logo { display: flex; align-items: center; gap: var(--space-1); text-decoration: none; color: var(--ink); }
.l-header__name { font-family: var(--font-display); font-size: 22px; }
.l-header__link { min-height: var(--tap-min); display: flex; align-items: center; font-size: 14px; font-weight: 700; text-decoration: none; }

.l-footer { margin-top: auto; padding: 16px var(--gutter) 24px; border-top: var(--border); display: flex; flex-direction: column; gap: var(--space-1); }
.l-footer__nav { display: flex; flex-wrap: wrap; column-gap: 16px; font-size: 12.5px; }
.l-footer__nav a { min-height: 40px; display: flex; align-items: center; text-decoration: none; }
.l-footer__copy { font-size: 12px; color: var(--ink-muted); }

@media (min-width: 768px) {
  .l-header, .l-footer { width: 100%; max-width: var(--content-max); margin-left: auto; margin-right: auto; padding-left: 0; padding-right: 0; }
  .l-footer { margin-top: auto; }
}

/* ---------- 共通部品 ---------- */
.c-logo { width: 30px; height: 30px; flex-shrink: 0; }

.c-heading { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1.42; }
.c-heading--xl { font-size: 34px; line-height: 1.32; }
.c-heading--sm { font-size: 22px; }

.c-button {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--button-h); padding: 0 16px;
  border: var(--border); border-radius: var(--radius-button);
  background: var(--card); color: var(--ink);
  font-size: 16.5px; font-weight: 900; text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-press);
}
.c-button:hover { color: var(--ink); }
.c-button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.c-button--primary { background: var(--shu); color: var(--white); }
.c-button--primary:hover { color: var(--white); background: var(--shu-deep); }
.c-button--x { background: var(--ink); color: var(--white); box-shadow: 0 4px 0 var(--shu); }
.c-button--x:hover { color: var(--white); }
.c-button--secondary { height: 52px; font-size: 15px; }
.c-button--ghost { height: 50px; border: 0; box-shadow: none; background: transparent; font-size: 15px; font-weight: 700; }
.c-button--ghost:active { transform: none; }
.c-button--accent { background: var(--kin); }
.c-button:disabled, .c-button.is-disabled { opacity: .5; cursor: not-allowed; transform: none; }

.c-tag {
  display: inline-flex; align-items: center;
  background: var(--kin); border: var(--border); border-radius: var(--radius-pill);
  padding: 4px 12px; font-size: 12px; font-weight: 900; line-height: 1.4;
}
.c-tag--ink { background: var(--ink); color: var(--white); border-color: var(--ink); }
.c-tag--sand { background: var(--sand); }
.c-tag--small { padding: 0 6px; font-size: 12px; border-radius: 4px; }
.c-tag--outline { background: transparent; border: 1.5px dashed var(--kin); color: var(--kin); border-radius: 6px; padding: 1px 8px; font-size: 11px; }

.c-badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--shu); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900;
}

.c-card { background: var(--card); border: var(--border); border-radius: var(--radius-card); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.c-card--raised { box-shadow: var(--shadow-press); }
.c-card--odai { position: relative; padding-top: 30px; }
.c-card__tab { position: absolute; top: -13px; left: 16px; background: var(--kin); border: var(--border); border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 900; line-height: 1.5; }
.c-card__tab--sand { background: var(--sand); }
.c-card__divider { border-top: var(--border-dashed); }

.c-field { display: flex; flex-direction: column; gap: var(--space-1); }
.c-field__head { display: flex; justify-content: space-between; align-items: baseline; }
.c-field__label { font-weight: 900; font-size: 15px; }
.c-field__count { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.c-field__help { font-size: 12.5px; line-height: 1.6; color: var(--ink-sub); }
.c-field__error { font-size: 13px; font-weight: 700; color: var(--shu-deep); }
.c-hosted { display: flex; flex-direction: column; gap: var(--space-1); }
.c-hosted[hidden] { display: none; } /* 一覧がないときは JS が出さない（.c-hosted の display より強くする） */
.c-hosted__title { font-size: 16px; font-weight: 900; }
.c-hosted__list { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1); }
.c-hosted__item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: var(--border); border-radius: var(--radius-input); background: var(--card); color: var(--ink); text-decoration: none; }
.c-hosted__odai { font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.c-hosted__meta { font-size: 12px; color: var(--ink-sub); }
/* ほかのお題（募集中の大喜利の一覧。U-01・U-06。ADR 0022） */
.c-odais__title { font-size: 16px; font-weight: 900; }
.c-odais__list { display: flex; flex-direction: column; gap: var(--space-1); }
.c-odais__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; min-height: var(--tap-min); padding: 12px 14px; border: var(--border); border-radius: var(--radius-input); background: var(--card); color: var(--ink); text-decoration: none; }
.c-odais__item:hover { color: var(--ink); background: var(--kin-pale); }
.c-odais__odai { font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.c-odais__meta { grid-column: 1; font-size: 12px; color: var(--ink-sub); }
.c-odais__go { grid-column: 2; grid-row: 1 / span 2; font-size: 13px; font-weight: 900; color: var(--shu-deep); white-space: nowrap; }
.c-relay { display: flex; flex-direction: column; gap: var(--space-2); }
.c-relay__native[hidden] { display: none; } /* 共有シートが使えない端末では出さない（.c-button の display より強くする） */
.c-segment { display: inline-flex; padding: 3px; border: var(--border); border-radius: 999px; background: var(--card); }
.c-segment__item { min-height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-sub); text-decoration: none; }
.c-segment__item.is-current { background: var(--ink); color: var(--white); }
.c-req { margin-left: 8px; padding: 0 6px; border-radius: 4px; background: var(--shu); color: var(--white); font-size: 12px; font-weight: 900; vertical-align: 2px; } /* 入力欄の「必須」（U-01・U-18） */
.c-field__reveal { min-height: 44px; min-width: 44px; padding: 0 6px; border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--ink-sub); text-decoration: underline; cursor: pointer; }
.c-input, .c-textarea, .c-select {
  width: 100%; border: var(--border); border-radius: var(--radius-input);
  background: var(--white); padding: 0 14px; font-size: 16px; color: var(--ink);
}
.c-input { height: var(--input-h); }
.c-textarea { padding: 12px 14px; resize: none; font-size: 17px; font-weight: 700; line-height: 1.5; }
.c-input.is-invalid, .c-textarea.is-invalid { border-color: var(--shu-deep); }

.c-progress { display: block; width: 100%; height: 12px; border: var(--border); border-radius: var(--radius-pill); background: var(--white); overflow: hidden; appearance: none; -webkit-appearance: none; }
.c-progress::-webkit-progress-bar { background: var(--white); }
.c-progress::-webkit-progress-value { background: var(--shu); border-radius: 0; }
.c-progress::-moz-progress-bar { background: var(--shu); }

.c-ad { padding: var(--space-2) var(--gutter) 0; display: flex; justify-content: center; }
.c-ad--bottom { padding-top: 28px; }
.c-ad__link { position: relative; display: block; width: 320px; height: 50px; border-radius: 6px; overflow: hidden; }
.c-ad__pr { position: absolute; top: 2px; left: 2px; border: 1px solid var(--ink-muted); border-radius: 3px; padding: 0 4px; font-size: 10px; font-weight: 700; background: var(--card); line-height: 1.4; }
.c-ad__image { width: 320px; height: 50px; object-fit: cover; }
/* 「広告募集」バナー（広告のない下部の枠。ADR 0018） */
.c-ad__recruit {
  display: flex; align-items: center; gap: 8px; width: 320px; max-width: 100%; min-height: 50px; padding: 6px 12px;
  border: 1.5px dashed var(--ink-muted); border-radius: 6px; background: var(--card); color: var(--ink); text-decoration: none;
}
.c-ad__recruit:hover, .c-ad__recruit:focus-visible { border-style: solid; border-color: var(--ink); }
.c-ad__recruit-label { flex: none; border: 1px solid var(--ink-muted); border-radius: 3px; padding: 0 5px; font-size: 12px; font-weight: 700; line-height: 1.5; }
.c-ad__recruit-text { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; line-height: 1.35; }
.c-ad__recruit-cta { flex: none; font-size: 12px; font-weight: 700; text-decoration: underline; }

.c-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--white); border-radius: var(--radius-pill);
  padding: 10px 18px; font-size: 13.5px; font-weight: 700; z-index: 100;
}
.c-toast[hidden] { display: none; }

.c-error { align-items: center; text-align: center; padding: var(--space-5) var(--gutter); }
.c-error__code { font-family: var(--font-display); font-size: 56px; color: var(--shu); line-height: 1; }

/* ---------- 補助 ---------- */
.u-sub { color: var(--ink-sub); font-size: 13.5px; }
.u-mono { font-family: var(--font-mono); }
.u-center { text-align: center !important; }
.u-hidden { display: none !important; }
.u-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.u-mt-1 { margin-top: var(--space-1) !important; }
.u-mt-2 { margin-top: var(--space-2) !important; }
.u-mt-3 { margin-top: var(--space-3) !important; }
.u-mt-4 { margin-top: var(--space-4) !important; }
.u-mt-5 { margin-top: var(--space-5) !important; }

/* 開催者画面への入口（U-04・U-11） */
.c-host-entry { text-align: center; font-size: 12.5px; }
.c-host-entry a { display: inline-block; padding: 12px 0; color: var(--ink-sub); } /* 1行だけのリンクなので、押せる高さを 44px にする */

.c-ad[hidden] { display: none; }
