/* よんでん文化振興財団 電子チケット — 申込者向け */
:root {
  /* よんでん文化振興財団サイト（ycf.or.jp）の配色に合わせる */
  --bg: #fffaeb;            /* クリーム（トップページの背景） */
  --surface: #ffffff;
  --ink: #363535;
  --ink-2: #707070;
  --line: #e8e2d0;
  --brand: #4dc6e5;         /* 水色（ボタン） */
  --brand-2: #1b8fae;       /* 水色の濃色（リンク・強調文字） */
  --accent: #ffa500;        /* オレンジ（ヘッダー上線・見出し） */
  --accent-2: #ffc34c;
  --accent-soft: #fff1cf;
  --ok: #088a26;
  --ok-soft: #e6f5ea;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --warn-soft: #fff6e0;
  --info-soft: #e8f7fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 50, 20, .06), 0 6px 20px rgba(60, 50, 20, .07);
  --font: "メイリオ", Meiryo, "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "Hiragino Sans", "Noto Sans JP", Osaka, sans-serif;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.75;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-2); }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 20px; padding-bottom: 40px; }

/* header / footer（ycf.or.jp に合わせる） */
.site-header { background: #fff; border-top: 10px solid var(--accent); box-shadow: 0 3px 3px 0 rgba(0,0,0,.18); position: relative; z-index: 20; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 80px; }
.logo { display: block; padding: 6px 4px; }
.logo img { width: 230px; height: auto; }
.logo:hover { opacity: .5; }
.gnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.gnav a { display: block; padding: 8px 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 14px; line-height: 1.4; }
.gnav a:hover { opacity: .5; }
.nav-toggle { display: none; width: 48px; height: 48px; border: 0; background: var(--accent); cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.nav-toggle span { display: block; width: 26px; height: 3px; background: #fff; transition: transform .2s, opacity .2s; }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
@media (max-width: 960px) {
  .nav-toggle { display: flex; }
  .gnav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 8px 12px rgba(0,0,0,.12); }
  .gnav.is-open { display: block; }
  .gnav ul { flex-direction: column; gap: 0; }
  .gnav a { padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 15px; }
}
@media (max-width: 480px) { .logo img { width: 190px; } }

.page-band { background: var(--accent-soft); border-bottom: 1px solid var(--accent-2); }
.page-band .wrap { padding-top: 8px; padding-bottom: 8px; font-family: var(--serif); font-size: 14px; letter-spacing: .08em; }
.page-band a { color: var(--ink); text-decoration: none; padding-left: 12px; border-left: 4px solid var(--accent); }

.site-footer { margin-top: 24px; color: #707070; background: #f6f6f6; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 40px 20px 24px; display: flex; gap: 32px; flex-wrap: wrap; justify-content: space-between; }
.footer-area { flex: 1 1 320px; }
.footer-area .logo { padding: 0 0 12px; }
.footer-area p { margin: 0; font-size: 13px; line-height: 1.9; }
.footer-area a { color: inherit; }
.footer-nav { flex: 1 1 280px; list-style: none; margin: 0; padding: 0; columns: 2; font-size: 13px; }
.footer-nav li { break-inside: avoid; padding: 3px 0; }
.footer-nav a { color: #707070; text-decoration: none; font-family: var(--serif); }
.footer-nav a::before { content: "＞ "; }
.footer-nav a:hover { opacity: .5; }
.copyright { margin: 0; padding: 14px 20px 20px; text-align: center; font-size: 12px; color: #fff; background: var(--accent); }

/* typography helpers */
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.eyebrow { margin: 0 0 4px; font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: .1em; display: flex; align-items: center; gap: 8px; }

/* event hero */
.event-hero {
  background: #fff; color: var(--ink); border-radius: var(--radius); padding: 26px 22px 22px; margin-bottom: 16px;
  position: relative; overflow: hidden; box-shadow: var(--shadow); border-top: 6px solid var(--accent);
}
.event-hero::after {
  content: "♪"; position: absolute; right: -6px; bottom: -40px; font-size: 160px; color: var(--accent); opacity: .1;
}
.event-sub { margin: 0; font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: .08em; }
.event-title { margin: 4px 0 14px; font-family: var(--serif); font-size: 26px; line-height: 1.4; letter-spacing: .04em; font-weight: 400; }
.event-meta { margin: 0; display: grid; gap: 6px; }
.event-meta div { display: flex; gap: 12px; }
.event-meta dt { flex: 0 0 auto; font-size: 12px; color: var(--accent); border: 1px solid var(--accent); border-radius: 100vh; padding: 0 12px; height: 1.9em; line-height: 1.85em; margin-top: 2px; }
.event-meta dd { margin: 0; }
.event-meta .muted { color: var(--ink-2); }

.flyer { margin: 0 0 16px; background: var(--surface); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.flyer img { margin: 0 auto; border-radius: 6px; max-height: 560px; width: auto; }
.flyer figcaption { text-align: center; font-size: 12px; color: var(--ink-2); margin-top: 6px; }

/* cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 22px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { margin: 0 0 12px; font-family: var(--serif); font-size: 19px; line-height: 1.5; font-weight: 400; padding-left: 12px; border-left: 4px solid var(--accent); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h3 { font-size: 16px; margin: 1.2em 0 .4em; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }

/* alerts */
.alert { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font-size: 15px; }
.alert p { margin: 0 0 8px; } .alert p:last-child { margin-bottom: 0; }
.alert-error { background: var(--danger-soft); color: #8e1c1c; border: 1px solid #f3c2bd; }
.alert-warn { background: var(--warn-soft); border: 1px solid #f0d9a0; }
.alert-info { background: var(--info-soft); border: 1px solid #cddcf2; }
.alert-success { background: var(--ok-soft); border: 1px solid #bfe2cc; color: #1d5a37; }

/* form */
.apply-form { display: grid; gap: 20px; }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 700; margin-bottom: 6px; padding: 0; }
.field legend small { font-weight: 400; color: var(--ink-2); }
.req, .opt { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 1px 6px; line-height: 1.6; }
.req { background: var(--danger); color: #fff; }
.opt { background: #e7e9ee; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1.5px solid #cfd3db; border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(77,198,229,.25); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1.5px solid #cfd3db; border-radius: 999px; cursor: pointer; background: #fff; font-weight: 400; }
.choice input { accent-color: var(--brand-2); width: 18px; height: 18px; margin: 0; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--info-soft); }
.choice-agree { border-radius: 10px; }
.input-other { margin-top: 10px; }
.privacy { font-size: 13px; background: #faf8f4; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: 200px; overflow: auto; }

/* 必須項目未入力時の赤色表示（仕様 4.1） */
.field.has-error > label, .field.has-error > legend { color: var(--danger); }
.field.has-error input[type=text], .field.has-error input[type=email], .field.has-error select { border-color: var(--danger); background: #fffafa; }
.field.has-error .choice { border-color: #ef9a9a; }
.field.has-error .choices { outline: 2px solid var(--danger); outline-offset: 6px; border-radius: 10px; }
.field-error { color: var(--danger); font-size: 14px; font-weight: 700; margin: 6px 0 0; }
.field-error::before { content: "！ "; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; padding: 12px 22px; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; min-height: 48px; transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); text-shadow: 0 1px 1px rgba(0,0,0,.12); }
.btn-primary:hover { background: #fff; color: var(--brand-2); text-shadow: none; }
.btn-ghost { background: #fff; color: var(--brand-2); border-color: var(--brand); }
.btn-ghost:hover { background: var(--info-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: 14px; background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-block { width: 100%; }
.actions { margin: 18px 0 0; display: flex; gap: 12px; flex-wrap: wrap; }
.actions-split > * { flex: 1 1 0; }

/* confirm table */
.confirm-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.confirm-table th, .confirm-table td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.confirm-table th { width: 34%; color: var(--ink-2); font-weight: 400; font-size: 14px; white-space: nowrap; }
@media (max-width: 420px) {
  .confirm-table th { white-space: normal; width: 38%; }
}

.complete-card { text-align: center; }
.complete-card .card-title { border: 0; padding: 0; font-size: 22px; }
.complete-card .confirm-table, .complete-card .alert { text-align: left; }
.complete-card .actions { justify-content: center; }
.complete-mark { width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 34px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; line-height: 1.6; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-cancel { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #eceef2; color: var(--ink-2); }
.badge-test { background: #fff0c2; color: #8a5a00; }
.badge-line { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.notes { padding-left: 1.2em; font-size: 14px; }
.notes li { margin-bottom: 4px; }

.dialog { border: 0; border-radius: var(--radius); padding: 22px; max-width: min(92vw, 420px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(15, 20, 30, .55); }
.dialog h3 { margin-top: 0; }

.event-list { list-style: none; padding: 0; margin: 0; }
.event-list a { display: grid; gap: 2px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.event-list-title { font-weight: 700; font-size: 17px; }
.event-list .badge { justify-self: start; }

/* ---------- ticket waiting ---------- */
.ticket-wait { text-align: center; }
.ticket-wait .card-title { border: 0; padding: 0; font-family: var(--serif); font-size: 22px; }
.ticket-wait .eyebrow { justify-content: center; }
.wait-box { background: var(--accent-soft); border-radius: 12px; padding: 18px; margin: 16px 0; }
.wait-box p { margin: 0; }
.wait-time { font-size: 22px; font-weight: 700; color: var(--brand-2); margin: 6px 0 !important; }
.countdown { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- ticket ---------- */
.page-ticket { background: #1b2233; overflow-x: hidden; }
.ticket-page { overflow-x: clip; }
.page-ticket .page-band { background: #232b3f; border-color: #3a4560; }
.page-ticket .page-band a { color: #fff; }
.page-ticket .ticket-wait, .page-ticket .message-card { color: var(--ink); }
.ticket-page { color: #fff; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ticket-head .eyebrow { color: #e7c88c; }
.live-clock { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; background: rgba(255,255,255,.08); padding: 4px 12px; border-radius: 999px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.ticket-guide { background: rgba(255,255,255,.08); border-radius: 10px; padding: 10px 14px; margin: 8px 0 18px; font-size: 15px; }

.ticket {
  --tear: 0;
  position: relative; display: flex; margin-bottom: 22px; color: var(--ink);
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.35));
}
.ticket-main {
  flex: 1 1 auto; min-width: 0; position: relative;
  background:
    radial-gradient(circle at 100% 0, transparent 12px, #fffdf8 12.5px) top right / 100% 51% no-repeat,
    radial-gradient(circle at 100% 100%, transparent 12px, #fffdf8 12.5px) bottom right / 100% 51% no-repeat;
  border-radius: 14px 0 0 14px; padding: 0 16px 16px; overflow: hidden;
}
/* 動くシマー（スクリーンショット対策の動的要素） */
.ticket-main::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(184,137,59,.13) 45%, transparent 60%);
  background-size: 250% 100%; animation: shimmer 3.2s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.ticket-band { margin: 0 -16px 10px; padding: 8px 16px; background: var(--accent); color: #fff; display: flex; justify-content: space-between; font-size: 12px; letter-spacing: .08em; }
.ticket-count { font-weight: 700; }
.ticket-title { margin: 0 0 8px; font-family: var(--serif); font-size: 20px; line-height: 1.4; }
.ticket-info { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; }
.ticket-info dt { color: var(--ink-2); font-size: 11px; }
.ticket-info dd { margin: 0; font-weight: 700; line-height: 1.45; }
.ticket-seat { font-size: 12px; color: var(--accent); font-weight: 700; margin: 8px 0 12px; }

.ticket-stub {
  flex: 0 0 82px; position: relative;
  background:
    radial-gradient(circle at 0 0, transparent 12px, #f4ead7 12.5px) top left / 100% 51% no-repeat,
    radial-gradient(circle at 0 100%, transparent 12px, #f4ead7 12.5px) bottom left / 100% 51% no-repeat;
  border-radius: 0 14px 14px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  writing-mode: vertical-rl; text-orientation: mixed; color: #8a5a00;
  transform-origin: 0 100%; transition: transform .35s ease;
}
/* ミシン目 */
.ticket-stub::before {
  content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 2px;
  background: repeating-linear-gradient(to bottom, #b9ad96 0 6px, transparent 6px 12px);
  writing-mode: horizontal-tb;
}
.stub-label { font-weight: 700; letter-spacing: .3em; font-family: var(--serif); font-size: 18px; }
.stub-code { font-size: 12px; }
.stub-note { font-size: 10px; color: var(--ink-2); letter-spacing: .3em; }

/* スワイプ */
.swipe-track {
  position: relative; height: 58px; border-radius: 999px; background: #eef1f6; overflow: hidden;
  border: 1.5px dashed #b8c1d1; user-select: none; -webkit-user-select: none;
}
.swipe-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 58px; background: linear-gradient(90deg, #dfe8f6, #c6d6ee); border-radius: 999px; transition: width .3s ease; }
.swipe-label { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 40px; font-size: 14px; font-weight: 700; color: var(--brand-2); letter-spacing: .04em; animation: hint 1.8s ease-in-out infinite; pointer-events: none; }
@keyframes hint { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.swipe-handle {
  position: absolute; left: 4px; top: 4px; width: 50px; height: 50px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; font-size: 24px; cursor: grab; touch-action: none;
  box-shadow: 0 3px 10px rgba(184,137,59,.5); transition: transform .3s ease;
}
.is-dragging .swipe-handle { cursor: grabbing; }
.is-dragging .swipe-label { animation: none; opacity: .4; }

/* もぎり演出：半券がちぎれて落ちる */
.ticket.is-tearing .ticket-stub,
.ticket.is-torn .ticket-stub {
  animation: tear-off .9s cubic-bezier(.5, 0, .75, .35) forwards;
}
@keyframes tear-off {
  0%   { transform: rotate(6deg) translateX(6px); opacity: 1; }
  25%  { transform: rotate(14deg) translate(14px, -6px); opacity: 1; }
  100% { transform: rotate(38deg) translate(70px, 280px); opacity: 0; }
}
.ticket.is-entered:not(.is-torn) .ticket-stub { visibility: hidden; }
.ticket.is-entered .ticket-main::before { animation: none; display: none; }
.ticket.is-entered .ticket-main { background: radial-gradient(circle at 100% 0, transparent 12px, #f1efe9 12.5px) top right / 100% 51% no-repeat, radial-gradient(circle at 100% 100%, transparent 12px, #f1efe9 12.5px) bottom right / 100% 51% no-repeat; }

.stamp { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.stamp-ring {
  display: inline-grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  border: 4px double var(--danger); color: var(--danger); font-weight: 900; font-size: 20px; letter-spacing: .08em;
  transform: rotate(-14deg); animation: stamp-in .35s cubic-bezier(.2, 1.6, .4, 1) both;
}
.stamp-time { font-weight: 700; color: var(--danger); font-variant-numeric: tabular-nums; }
@keyframes stamp-in { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } to { transform: rotate(-14deg) scale(1); opacity: 1; } }
.ticket-msg { margin: 10px 0 0; background: var(--danger-soft); color: #8e1c1c; border-radius: 8px; padding: 8px 10px; font-size: 14px; font-weight: 700; }
.ticket-page .muted { color: #aab1c0; }

@media (max-width: 360px) {
  .ticket-stub { flex-basis: 64px; }
  .ticket-info { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .ticket-main::before, .swipe-label, .live-dot { animation: none; }
}
