/* =========================================================
   原稿用紙のためのデザイントークン
   白い紙・墨・網点・朱色の赤入れ。マンガ原稿の語彙で組む。
   ========================================================= */
:root {
  --paper: #ffffff;
  --ink: #111214;
  --ink-70: #4a4e57;
  --ink-45: #868b95;
  --hair: #e4e5e9;
  --tone: #f0f2f5;
  --red: #e0322a;
  --red-soft: #fdeceb;

  --f-display: 'Zen Antique', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --f-body: 'Zen Kaku Gothic New', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --f-util: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --gap: clamp(20px, 4vw, 32px);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background-color: var(--paper);
  /* 紙面の網点（スクリーントーン） */
  background-image: radial-gradient(var(--tone) 1px, transparent 1.1px);
  background-size: 8px 8px;
  background-position: 0 0;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }

/* 汎用ユーティリティラベル（ノンブル・見出し添え字） */
.util {
  font-family: var(--f-util);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-45);
}

.container { max-width: 860px; margin: 0 auto; padding: var(--gap) 20px 96px; }
.container.wide { max-width: 1240px; }

/* ---------- ヘッダー ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 700; }
.x-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: var(--ink); color: #fff;
  font-size: 15px; font-weight: 800; align-self: center;
}
.brand-name { font-size: 15px; letter-spacing: 0.06em; }
.ghost-link {
  font-family: var(--f-util); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-70); text-decoration: none; border-bottom: 1px solid var(--hair); padding-bottom: 2px;
}
.ghost-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- コマ（キャンペーンパネル） ---------- */
.panel {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: clamp(22px, 4vw, 38px);
  margin-bottom: 34px;
  animation: panel-in 0.5s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
/* トンボ（印刷の見当合わせマーク）を四隅に置く */
.panel .marks span {
  position: absolute; width: 12px; height: 12px; pointer-events: none; border: 0 solid var(--ink-45);
}
.panel .marks span:nth-child(1) { top: -9px; left: -9px; border-left-width: 1px; border-top-width: 1px; }
.panel .marks span:nth-child(2) { top: -9px; right: -9px; border-right-width: 1px; border-top-width: 1px; }
.panel .marks span:nth-child(3) { bottom: -9px; left: -9px; border-left-width: 1px; border-bottom-width: 1px; }
.panel .marks span:nth-child(4) { bottom: -9px; right: -9px; border-right-width: 1px; border-bottom-width: 1px; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 22px;
}
.nombre { font-family: var(--f-util); font-size: 11px; letter-spacing: 0.24em; color: var(--ink-45); }

/* 状態スタンプ（校了印） */
.stamp {
  font-family: var(--f-body); font-weight: 700; font-size: 12px; letter-spacing: 0.14em;
  padding: 4px 12px; border: 2px solid var(--ink-45); color: var(--ink-45);
  transform: rotate(-2.5deg);
}
.stamp.open { border-color: var(--red); color: var(--red); }
.stamp.drawn { border-color: var(--ink); color: var(--ink); background: var(--ink); color: var(--paper); }

/* 扉ページのタイトル組み：細罫と太罫で挟んだ大見出し */
.title-block {
  border-top: 1px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: 16px 0 18px;
  margin-bottom: 4px;
}
.title-block h2 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(22px, 5.2vw, 36px);
  line-height: 1.5;
  letter-spacing: 0.01em;
  /* 単語の途中で折り返さない（app.js が <wbr> で改行位置を与える） */
  word-break: keep-all;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.lead { color: var(--ink-70); white-space: pre-wrap; margin: 22px 0 26px; }

/* ---------- セクション（当たるもの / 応募に必要なもの） ---------- */
.section-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 16px;
}
.section-head h3 {
  margin: 0; font-family: var(--f-display); font-weight: 400;
  font-size: clamp(19px, 4.4vw, 23px); line-height: 1.3;
}
.section-head .note {
  margin-left: auto; font-family: var(--f-util); font-size: 12px; letter-spacing: 0.1em;
  color: var(--ink-45); white-space: nowrap;
}

.give {
  background: #fbfbfc; border: 1px solid var(--hair); border-left: 4px solid var(--red);
  padding: 20px clamp(16px, 3vw, 24px) 22px; margin-bottom: 22px;
}
.give .section-head h3 { color: var(--red); }
.give .section-head { border-bottom-color: var(--red); }
.give .section-head .note { color: var(--red); }

.need {
  border: 2px solid var(--ink);
  padding: 20px clamp(16px, 3vw, 24px) 22px; margin-bottom: 26px;
}

/* ---------- 特典 ---------- */
.prizes { margin: 0; padding: 0; list-style: none; }
.prize {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--hair);
}
.prize:first-child { padding-top: 0; }
.prize:last-child { border-bottom: 0; padding-bottom: 0; }
.prize-name { font-weight: 700; font-size: 17px; }
.prize-desc { grid-column: 1 / 2; color: var(--ink-70); font-size: 14px; white-space: pre-wrap; margin: 0; }
.prize-count {
  grid-row: 1 / 3; grid-column: 2 / 3; align-self: center; text-align: right;
  font-family: var(--f-util); font-size: 12px; letter-spacing: 0.1em; color: var(--ink-45); white-space: nowrap;
}
.prize-count b {
  display: block; font-family: var(--f-display); font-size: 34px; line-height: 1; color: var(--ink);
  letter-spacing: 0;
}

/* ---------- 仕上がりサンプル ---------- */
.sample {
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--ink); padding: 14px 18px; margin: 18px 0 0;
  text-decoration: none; color: var(--ink); background: var(--paper);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.sample:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.sample-cover {
  width: 84px; height: auto; display: block; flex: none;
  border: 1px solid var(--ink); background: var(--paper);
  transform: rotate(-1.5deg); transition: transform 0.16s ease;
}
.sample:hover .sample-cover { transform: rotate(0deg); }
.sample-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sample-title { font-family: var(--f-display); font-size: 19px; line-height: 1.4; }
.sample-cta { font-size: 13px; font-weight: 700; color: var(--red); }
.sample-cta::after { content: ' →'; }



/* ---------- 応募条件になる Kindle 本 ---------- */
.book { display: flex; align-items: center; gap: 22px; }
.book-cover {
  width: 104px; height: auto; display: block; flex: none;
  border: 1px solid var(--ink); background: var(--paper);
  box-shadow: 4px 4px 0 var(--tone);
}
.book-body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.book-title {
  margin: 0; font-family: var(--f-display); font-size: 20px; line-height: 1.45;
  word-break: keep-all; overflow-wrap: break-word;
}
.book-cta {
  display: inline-block; margin-top: 4px;
  border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
  text-decoration: none; font-size: 14px; font-weight: 700; letter-spacing: 0.04em;
  padding: 9px 18px;
  transition: background 0.15s ease, color 0.15s ease;
}
.book-cta:hover { background: var(--red); border-color: var(--red); color: var(--paper); }

/* ---------- 当選連絡の案内 ---------- */
.dm-note {
  margin: 18px 0 0; font-size: 14.5px; font-weight: 500; color: var(--ink);
  padding: 10px 14px; border-left: 3px solid var(--red); background: #fdf5f4;
}

/* ---------- 締切 ---------- */
.deadline {
  border: 2px solid var(--ink); padding: 14px clamp(14px, 3vw, 20px) 16px;
  margin-bottom: 26px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px;
}
.deadline .util { flex: none; }
.deadline .date {
  font-size: clamp(16px, 4vw, 18px); font-weight: 700; letter-spacing: 0.01em;
}
.clock {
  display: flex; align-items: baseline; gap: 2px; margin-left: auto;
  font-family: var(--f-util); font-weight: 500;
}
.clock b {
  font-size: clamp(26px, 7vw, 32px); font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em; line-height: 1.1;
}
.clock span { font-size: 12px; color: var(--ink-45); margin: 0 10px 0 3px; }

/* 残り24時間を切ったら赤で知らせる */
.deadline.urgent { border-color: var(--red); background: #fdf5f4; }
.deadline.urgent .date, .deadline.urgent .clock b { color: var(--red); }
.deadline.urgent .util { color: var(--red); }
.deadline.ended { border-color: var(--red); background: #fdf5f4; }
.deadline.ended .clock b, .deadline.ended .clock span, .deadline.ended .date { color: var(--red); }

/* ---------- 応募方法 ---------- */
.howto { border-left: 3px solid var(--ink); padding: 4px 0 4px 20px; margin-bottom: 30px; }
.howto .util { display: block; margin-bottom: 8px; }
.howto-body {
  white-space: pre-wrap; margin: 0;
  font-size: clamp(16px, 4.2vw, 17.5px); line-height: 2.05; font-weight: 500;
}
.post-link {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 14px;
  border: 2px solid var(--ink); padding: 8px 16px 8px 10px; text-decoration: none;
  font-weight: 700; font-size: 14px; color: var(--ink); background: var(--paper);
  transition: background 0.15s ease, color 0.15s ease;
}
.post-link:hover { background: var(--ink); color: var(--paper); }
.post-link .x-logo { width: 22px; height: 22px; font-size: 12px; }
.post-link:hover .x-logo { background: var(--paper); color: var(--ink); }

/* ---------- 応募フォーム（記入欄） ---------- */
.apply { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; }
.handle-field { flex: 1 1 240px; }
.handle-field .util { display: block; margin-bottom: 2px; }
.handle-input {
  display: flex; align-items: baseline; gap: 6px;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px;
}
.handle-input .at { font-family: var(--f-display); font-size: 22px; line-height: 1; color: var(--ink-45); }
.handle-input input {
  flex: 1; border: 0; outline: none; background: transparent; padding: 0;
  font-family: var(--f-body); font-size: 20px; font-weight: 500; color: var(--ink);
  min-width: 0;
}
.handle-input input::placeholder { color: #c3c6cc; font-weight: 400; }
.handle-input:focus-within { border-color: var(--red); }

/* ---------- ボタン ---------- */
button {
  font-family: var(--f-body); font-size: 14px; font-weight: 700; letter-spacing: 0.06em;
  cursor: pointer; border: 2px solid var(--ink); border-radius: 0;
  padding: 13px 26px; background: var(--ink); color: var(--paper);
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
button:hover:not(:disabled) { background: var(--red); border-color: var(--red); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.secondary { background: var(--paper); color: var(--ink); }
button.secondary:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
button.danger { background: var(--paper); color: var(--red); border-color: var(--red); }
button.danger:hover:not(:disabled) { background: var(--red); color: var(--paper); }
button.small { padding: 8px 14px; font-size: 12px; }
button.lottery { letter-spacing: 0.1em; padding: 15px 30px; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- メッセージ ---------- */
.msg { margin-top: 16px; padding: 12px 16px; font-size: 14px; display: none; border-left: 3px solid; }
.msg.show { display: block; }
.msg.ok { border-color: var(--ink); background: var(--tone); }
.msg.err { border-color: var(--red); background: var(--red-soft); color: #a5231d; }

.stat { color: var(--ink-45); font-family: var(--f-util); font-size: 11px; letter-spacing: 0.12em; }
.closed-note { color: var(--ink-70); font-size: 14px; margin: 0; }

/* ---------- 当選発表 ---------- */
.result { margin-top: 30px; padding-top: 26px; border-top: 2px solid var(--ink); }
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.result-head h3 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 22px; }
.winner-group { margin-bottom: 22px; }
.winner-group .util { display: block; margin-bottom: 8px; }
.winner-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.winner {
  display: flex; align-items: center; gap: 14px;
  border: 2px solid var(--ink); padding: 12px 18px; background: var(--paper);
}
.winner-no { font-family: var(--f-util); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-45); }
.winner-handle { font-family: var(--f-body); font-weight: 700; font-size: 18px; letter-spacing: 0.01em; }
.winner-handle a { text-decoration: none; }
.winner-handle a:hover { color: var(--red); }

.loading, .empty { color: var(--ink-45); text-align: center; padding: 80px 0; font-family: var(--f-util); font-size: 12px; letter-spacing: 0.16em; }



@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


/* ---------- 初回アクセス時のお礼 ---------- */
.greeting {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: var(--paper); padding: 24px; cursor: pointer;
  opacity: 0; transition: opacity 0.5s ease;
}
.greeting.show { opacity: 1; }
.greeting.leaving { opacity: 0; }
.greeting-lines {
  position: absolute; inset: -20%; pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%, var(--ink) 0deg 0.5deg, transparent 0.5deg 3.6deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 34%, #000 72%);
  mask-image: radial-gradient(circle at 50% 50%, transparent 34%, #000 72%);
}
.greeting.show .greeting-lines { animation: greeting-burst 2.4s ease-out forwards; }
@keyframes greeting-burst {
  0% { opacity: 0; transform: scale(1.2); }
  18% { opacity: 0.16; }
  100% { opacity: 0; transform: scale(1); }
}
.greeting-inner { position: relative; text-align: center; max-width: 560px; }
.greeting-inner .util { display: block; margin-bottom: 14px; }
.greeting-main {
  margin: 0 0 14px;
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(22px, 5.6vw, 34px); line-height: 1.7;
  animation: greeting-rise 0.7s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
.greeting-sub {
  margin: 0; color: var(--ink-70); font-size: 14px;
  animation: greeting-rise 0.7s cubic-bezier(0.2, 0.8, 0.25, 1) 0.18s both;
}
@keyframes greeting-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 720px) {
  .container { padding: 18px 14px 72px; }
  .panel { padding: 20px 16px; }
  .prize-count b { font-size: 28px; }
}

@media (max-width: 560px) {
  .site-header { padding: 12px 14px; gap: 10px; }
  .brand-name { font-size: 14px; }

  /* 見出しの「抽選で3名様」を右端に押し込まず、下に落とす */
  .section-head { gap: 4px 10px; }
  .section-head .note { margin-left: 0; flex-basis: 100%; }

  /* 特典名と人数を縦に並べる */
  .prize { grid-template-columns: 1fr; gap: 2px; }
  .prize-count { grid-row: auto; grid-column: 1 / -1; text-align: left; }
  .prize-count b { display: inline; font-size: 26px; margin-right: 4px; }

  /* サンプルと本のカードは表紙を小さく */
  .sample { gap: 14px; padding: 12px 14px; }
  .sample-cover { width: 62px; }
  .sample-title { font-size: 16px; }
  .book { gap: 16px; align-items: flex-start; }
  .book-cover { width: 88px; }
  .book-title { font-size: 17px; }
  .book-cta { width: 100%; text-align: center; padding: 12px 14px; }

  /* 締切は日付の下に残り時間を置く */
  .deadline { gap: 8px 14px; }
  .deadline .util { flex-basis: 100%; }
  .clock { margin-left: 0; flex-basis: 100%; }

  /* 応募ボタンは横幅いっぱいに */
  .apply { gap: 16px; }
  .apply button { width: 100%; }
  .handle-field { flex-basis: 100%; }

  .howto { padding-left: 16px; }
}

@media (max-width: 380px) {
  .panel { padding: 18px 13px; }
  .book-cover { width: 74px; }
}
