/* ============================================================
   OSAKA REAL SUSTAINABLE FASHION ／ 撮影・掲載 同意フォーム
   iPad Safari 向け（オフラインPWA）。素のCSSのみ。
   ============================================================ */

:root {
  --ink: #1f1f1f;          /* ロゴ正式色のグレー寄り（スミ80%相当） */
  --ink-soft: #4d4d4d;
  --paper: #f4f1ea;        /* 紙っぽいオフホワイト */
  --paper-2: #ffffff;
  --line: #ddd8cd;
  --berry: #e60c60;        /* ベリーレッド（視認性確保用アクセント） */
  --berry-dark: #c4084f;
  --ok: #1f7a4d;
  --err: #c62828;
  --radius: 14px;
  --tap: 60px;             /* 最小タップ高さ（大きめ） */
  --maxw: 720px;
  --pad: clamp(20px, 4vw, 40px);
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.7;
  overscroll-behavior: none;
}

/* 文字の選択・長押しコールアウトを抑える（タブレット手渡し運用のため） */
body { -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

#app { min-height: 100%; }

.is-hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 画面共通 ---------- */
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: max(env(safe-area-inset-top), var(--pad)) var(--pad)
           max(env(safe-area-inset-bottom), var(--pad));
}

/* ---------- ボタン ---------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: var(--tap);
  padding: 0 28px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .08s ease, background-color .15s ease, opacity .15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #000; }
.btn--ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn--danger { background: var(--berry); color: #fff; }
.btn--danger:hover { background: var(--berry-dark); }
.btn--mini { min-height: 44px; padding: 0 16px; font-size: .95rem; }
.btn:focus-visible { outline: 3px solid var(--berry); outline-offset: 3px; }

/* ---------- 1. 表紙（エディトリアル／紙の雑誌イメージ） ---------- */
.screen--cover {
  background: var(--paper);
  color: var(--ink);
  position: relative;
  text-align: left;
}
.cover__grid {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr clamp(220px, 34%, 380px);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}
.cover__text { min-width: 0; }
.cover__issue {
  font-size: .82rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--berry); margin: 0 0 18px; font-weight: 800;
}
/* マストヘッド風の大きな英語タイトル */
.cover__title {
  font-size: clamp(2.4rem, 5.6vw, 4.6rem);
  line-height: .94; margin: 0 0 26px; font-weight: 800;
  letter-spacing: -.01em;
  /* 単語の途中で改行させない（"SUSTAINABL/E" のような割れを防ぐ） */
  overflow-wrap: normal; word-break: keep-all; hyphens: none;
}
.cover__lead { font-size: 1.05rem; color: var(--ink-soft); margin: 0 0 32px; max-width: 30ch; }
.cover__start { min-width: 220px; }
.cover__footer {
  margin-top: clamp(32px, 7vh, 72px);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.cover__logo { height: 30px; width: auto; }
.cover__org { font-size: .85rem; color: var(--ink-soft); margin: 0; }

/* 誌面イメージ（冊子） */
.cover__book {
  margin: 0; position: relative; justify-self: center;
  transform: rotate(1.4deg);
}
.cover__book img {
  display: block; width: 100%; height: auto;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 22px 50px rgba(0,0,0,.22);
}
.admin-dot {
  position: absolute; top: 0; right: 0; width: 64px; height: 64px;
  background: transparent; border: 0; cursor: default;
}

/* 縦長（タブレット縦持ち・スマホ）では1カラムに */
@media (max-width: 820px) {
  .cover__grid { grid-template-columns: 1fr; gap: 28px; }
  .cover__book { order: -1; max-width: 280px; transform: rotate(1.4deg); }
  .cover__title { font-size: clamp(2.8rem, 14vw, 5rem); }
  .cover__lead { max-width: none; }
}

/* ---------- シート（説明・記入・確認の共通枠） ---------- */
.sheet {
  max-width: var(--maxw); width: 100%; margin: 0 auto;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 40px);
  box-shadow: 0 12px 40px rgba(0,0,0,.06);
}
.sheet__head { margin-bottom: 14px; }
.sheet__logo { height: 26px; width: auto; display: block; margin-bottom: 16px; }
.sheet__kicker {
  font-size: .8rem; letter-spacing: .14em; color: var(--berry);
  font-weight: 700; margin: 0 0 6px;
}
.sheet__title {
  font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 8px; font-weight: 800; line-height: 1.3;
}
.sheet__actions {
  display: flex; gap: 14px; margin-top: 28px;
}
.sheet__actions .btn { flex: 1; }
.sheet__actions .btn--primary { flex: 1.6; }

/* ---------- 同意文言 ---------- */
.consent { font-size: 1.02rem; color: var(--ink); }
.consent h3 {
  font-size: .92rem; letter-spacing: .06em; color: var(--berry-dark);
  margin: 22px 0 8px; font-weight: 800;
}
.consent p { margin: 0 0 14px; }
.consent ul { margin: 0 0 14px; padding-left: 1.2em; }
.consent li { margin: 4px 0; }
.consent .consent__meta {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line);
  font-size: .92rem; color: var(--ink-soft);
}
.consent--small { font-size: .9rem; color: var(--ink-soft); }

/* ---------- フォーム項目 ---------- */
.field { margin: 22px 0; }
.field > label {
  display: block; font-weight: 700; font-size: 1.02rem; margin-bottom: 8px;
}
.req { color: #fff; background: var(--berry); font-size: .7rem; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.opt { color: var(--ink-soft); background: #ece8df; font-size: .7rem; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }

input[type="text"], input[type="password"], textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 14px 16px;
  font-size: 1.1rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
input[type="text"]:focus-visible, input[type="password"]:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--berry); outline-offset: 1px; border-color: var(--berry);
}
.hint { font-size: .85rem; color: var(--ink-soft); margin: 8px 0 0; }

.error-msg {
  display: none; color: var(--err); font-size: .9rem; margin: 8px 0 0; font-weight: 700;
}
.error-msg span { display: inline-block; width: 1.2em; height: 1.2em; line-height: 1.2em;
  text-align: center; background: var(--err); color: #fff; border-radius: 50%; margin-right: 4px; font-size: .8rem; }

/* 入力後にだけ赤くする */
input:user-invalid { border-color: var(--err); background: #fdecec; }
input:user-invalid ~ .error-msg { display: block; }
/* チェック群のエラーはJSで .show を付与 */
.error-msg.show { display: block; }

/* ---------- チェックボックス（大きめタップ） ---------- */
.checks { border: 0; padding: 0; margin: 26px 0; }
.check {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; border: 2px solid var(--line); border-radius: 12px;
  margin-bottom: 12px; cursor: pointer; background: #fff;
  transition: border-color .12s ease, background-color .12s ease;
}
.check:has(input:checked) { border-color: var(--ink); background: #faf8f3; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
  flex: 0 0 auto; width: 30px; height: 30px; border: 2px solid var(--ink-soft);
  border-radius: 8px; display: grid; place-items: center; margin-top: 1px;
}
.check input:checked + .check__box {
  background: var(--ink); border-color: var(--ink);
}
.check input:checked + .check__box::after {
  content: "✓"; color: #fff; font-size: 1.2rem; font-weight: 900;
}
.check input:focus-visible + .check__box { outline: 3px solid var(--berry); outline-offset: 2px; }
.check__label { font-size: 1.05rem; font-weight: 700; line-height: 1.45; }

/* ---------- サインパッド ---------- */
.sign-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sign-head label { font-weight: 700; font-size: 1.02rem; }
.sign-wrap {
  position: relative; border: 2px dashed var(--line); border-radius: 12px;
  background: #fff; overflow: hidden;
}
.sign-pad { display: block; width: 100%; height: 220px; touch-action: none; }
.sign-hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #bdb8ab; font-size: 1.1rem; pointer-events: none;
}
.sign-hint.is-hidden { display: none; }

/* ---------- 確認画面 ---------- */
.review { margin: 8px 0 0; }
.review__row {
  display: grid; grid-template-columns: 130px 1fr; gap: 12px;
  padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start;
}
.review__row dt { font-weight: 700; color: var(--ink-soft); margin: 0; }
.review__row dd { margin: 0; font-size: 1.08rem; word-break: break-word; }
#rv-sign img { max-width: 240px; border: 1px solid var(--line); border-radius: 8px; background:#fff; }
.review__consent { margin-top: 18px; }
.review__consent summary { cursor: pointer; font-weight: 700; color: var(--berry-dark); padding: 8px 0; }

/* ---------- 完了 ---------- */
.screen--done { text-align: center; }
.done__inner { max-width: 520px; margin: 0 auto; }
.done__mark {
  width: 96px; height: 96px; margin: 0 auto 24px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 3rem; display: grid; place-items: center;
}
.done__title { font-size: clamp(1.8rem, 5vw, 2.4rem); margin: 0 0 12px; font-weight: 800; }
.done__lead { font-size: 1.15rem; color: var(--ink-soft); margin: 0 0 8px; }
.done__count { font-size: .9rem; color: var(--ink-soft); margin: 4px 0 32px; }
.done__inner .btn { min-width: 220px; }

/* ---------- 管理画面 ---------- */
.admin { max-width: var(--maxw); width: 100%; margin: 0 auto; }
.admin__lock, .admin__panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(22px, 4vw, 36px);
}
.admin__lock h2, .admin__panel h2 { margin: 0 0 4px; font-size: 1.4rem; }
.admin__pin { letter-spacing: .4em; text-align: center; font-size: 1.5rem; margin: 16px 0 0; }
.admin__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.badge { background: var(--ink); color: #fff; font-size: .9rem; border-radius: 999px; padding: 2px 12px; margin-left: 8px; }
.admin__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.admin__actions .btn { flex: 1; min-width: 160px; }
.admin__list {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  max-height: 46vh; overflow-y: auto;
}
.rec {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center;
}
.rec:last-child { border-bottom: 0; }
.rec__name { font-weight: 700; }
.rec__meta { font-size: .82rem; color: var(--ink-soft); }
.rec__time { font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
.rec--empty { padding: 28px 16px; text-align: center; color: var(--ink-soft); }
.admin__consent-edit { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.admin__consent-edit summary { cursor: pointer; font-weight: 700; }
.consent-edit { margin: 12px 0; font-size: .95rem; line-height: 1.6; }

/* ---------- 処理中オーバーレイ ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20,20,20,.45);
  display: grid; place-items: center; z-index: 50;
}
.spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 5px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .btn, .check { transition: none; }
  .spinner { animation-duration: 1.6s; }
}
