/* ============================================================
   ことりベーカリー WEBクーポン - スタイル
   ============================================================ */

:root {
  --color-flour: #FBF4E6;   /* 背景：粉のような温かいクリーム色 */
  --color-card:  #FFFCF5;   /* カード背景 */
  --color-crust: #3D2418;   /* パンの皮：濃い茶（メインテキスト） */
  --color-rye:   #8A5A3C;   /* ライ麦色：サブテキスト */
  --color-butter:#E8A23D;   /* バター色：アクセント */
  --color-berry: #C1432B;   /* ジャム色：強調・スタンプ */
  --shadow-soft: 0 10px 28px -12px rgba(61, 36, 24, 0.28);
  --radius-card: 22px;
  --font-display: 'Shippori Antique B1', serif;
  --font-body: 'Zen Maru Gothic', sans-serif;
}

* { box-sizing: border-box; }

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

body {
  background-color: var(--color-flour);
  background-image: radial-gradient(circle at 1px 1px, rgba(61,36,24,0.06) 1px, transparent 0);
  background-size: 22px 22px;
  color: var(--color-crust);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 48px;
}

@media (min-width: 600px) {
  body { padding: 32px 0; }
  .page {
    background: var(--color-flour);
    border-radius: 28px;
    box-shadow: 0 24px 60px -20px rgba(61,36,24,0.35);
    overflow: hidden;
  }
}

/* ---------- header ---------- */

header {
            background-color: #beddb8;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 1000;
        }

.header-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 1rem 2rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .logo {
            height: 45px;
        }

.logo-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-card);
  border: 2px solid var(--color-butter);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-fallback { width: 100%; height: 100%; }

.logo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-en {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--color-rye);
}

.brand-name {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--color-crust);
}

.brand-tagline {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--color-rye);
}

/* ---------- hero ---------- */

.hero {
  margin: 14px 16px 0;
}

.hero-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(160deg, #f4d9a8, #e8a23d 55%, #c1432b 130%);
  /* 紙を破ったような縁取り（写真の下端） */
  clip-path: polygon(
    0% 0%, 100% 0%, 100% 90%,
    96% 94%, 92% 88%, 88% 95%, 84% 89%, 80% 96%, 76% 88%, 72% 95%, 68% 89%,
    64% 96%, 60% 88%, 56% 95%, 52% 89%, 48% 96%, 44% 88%, 40% 95%, 36% 89%,
    32% 96%, 28% 88%, 24% 95%, 20% 89%, 16% 96%, 12% 88%, 8% 95%, 4% 89%, 0% 94%
  );
}

.hero-illustration,
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--color-berry);
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  padding: 10px 14px;
  border-radius: 999px 999px 999px 4px;
  box-shadow: var(--shadow-soft);
  transform: rotate(4deg);
}

/* ---------- main / instructions ---------- */

main { padding-top: 4px; }

.instructions {
  margin: 22px 18px 18px;
  text-align: center;
  font-size: 14px;
  color: var(--color-rye);
}

/* ---------- coupons ---------- */

.coupons {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0 18px;
}

.coupon {
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.coupons.has-presenting .coupon:not(.is-presenting) {
  opacity: 0.35;
  filter: grayscale(0.5);
  pointer-events: none;
}

.coupon-ticket {
  position: relative;
  background: var(--color-card);
  border-radius: var(--radius-card);
  border: 1.5px solid rgba(61, 36, 24, 0.08);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.25s ease, transform 0.6s cubic-bezier(0.65, 0, 0.35, 1);
  transform-origin: 50% 50%;
}

.coupon.is-presenting .coupon-ticket {
  box-shadow: 0 0 0 3px var(--color-butter), var(--shadow-soft);
}

/* 店員側に画面を向けるための上下反転 */
.coupon.is-flipped .coupon-ticket {
  transform: rotate(180deg);
}

.coupon-main {
  padding: 24px 24px 18px;
  text-align: center;
}

.coupon-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.tag {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--color-butter);
  background: rgba(232, 162, 61, 0.14);
  color: var(--color-rye);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.coupon-eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.25em;
  font-weight: 700;
  color: var(--color-butter);
}

.coupon-condition {
  margin: 6px 0 12px;
  font-size: 14px;
  color: var(--color-rye);
}

.coupon-amount {
  margin: 0;
  font-family: var(--font-display);
  color: var(--color-berry);
}

.coupon-amount .num { font-size: 56px; line-height: 1; }
.coupon-amount .unit { font-size: 20px; margin-left: 4px; }

.coupon-period {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--color-rye);
  opacity: 0.85;
}

/* ---------- roulette (ルーレット) ---------- */

.roulette-lead {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--color-crust);
}

/* 数字が流れて止まるスロット風ルーレット */

.roulette-slot-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 6px auto 16px;
}

.roulette-slot-window {
  position: relative;
  height: 270px;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(232,162,61,0.10), transparent 70%),
    var(--color-flour);
  border: 2px solid var(--color-crust);
  box-shadow:
    inset 0 3px 10px rgba(61,36,24,0.22),
    inset 0 -3px 10px rgba(61,36,24,0.22),
    var(--shadow-soft);
  transition: box-shadow 0.25s ease;
}

.roulette-slot-window.is-revealing {
  animation: slot-flash 0.7s ease;
}

@keyframes slot-flash {
  0%   { box-shadow: inset 0 3px 10px rgba(61,36,24,0.22), inset 0 -3px 10px rgba(61,36,24,0.22), var(--shadow-soft), 0 0 0 0 rgba(193,67,43,0); }
  35%  { box-shadow: inset 0 3px 10px rgba(61,36,24,0.22), inset 0 -3px 10px rgba(61,36,24,0.22), var(--shadow-soft), 0 0 0 10px rgba(193,67,43,0.20); }
  100% { box-shadow: inset 0 3px 10px rgba(61,36,24,0.22), inset 0 -3px 10px rgba(61,36,24,0.22), var(--shadow-soft), 0 0 0 0 rgba(193,67,43,0); }
}

/* 窓の上下をふわっとフェードさせ、数字が奥から流れてくる質感を出す */
.roulette-slot-window::before,
.roulette-slot-window::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 54px;
  z-index: 2;
  pointer-events: none;
}
.roulette-slot-window::before {
  top: 0;
  background: linear-gradient(180deg, var(--color-flour) 15%, transparent);
}
.roulette-slot-window::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--color-flour) 15%, transparent);
}

.roulette-slot-center-line {
  position: absolute;
  top: 50%;
  left: 8px;
  right: 8px;
  height: 0;
  border-top: 1.5px dashed rgba(193, 67, 43, 0.35);
  transform: translateY(-50%);
  z-index: 1;
}

.roulette-slot-reel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(81px); /* centers the default single item in the 270px window */
  will-change: transform;
}

.roulette-slot-item {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.roulette-slot-item .num {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
  color: var(--color-crust);
  opacity: 0.55;
  display: inline-block;
  transition: color 0.3s ease, opacity 0.3s ease;
}

.roulette-slot-item .unit {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-rye);
  opacity: 0.55;
  transition: color 0.3s ease, opacity 0.3s ease;
}

/* 止まった瞬間：色が変わり、数字が拡大される */
.roulette-slot-item.is-winner .num {
  color: var(--color-berry);
  opacity: 1;
  animation: winner-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  text-shadow: 0 6px 18px rgba(193, 67, 43, 0.35);
}
.roulette-slot-item.is-winner .unit {
  color: var(--color-berry);
  opacity: 1;
}

@keyframes winner-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.5); }
  70%  { transform: scale(1.18); }
  100% { transform: scale(1.32); }
}

.roulette-slot-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  line-height: 1;
  color: var(--color-berry);
  z-index: 3;
}
.roulette-slot-arrow.left  { left: -3px; }
.roulette-slot-arrow.right { right: -3px; }

.roulette-legend {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-rye);
}

.roulette-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.roulette-legend b {
  color: var(--color-crust);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.roulette-result-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--color-rye);
}

.btn-roulette {
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: 14px;
  background: var(--color-berry);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-roulette:hover { background: #a5361f; }
.btn-roulette:active { transform: scale(0.97); }
.btn-roulette:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-roulette:focus-visible { outline: 3px solid var(--color-butter); outline-offset: 2px; }

.btn-roulette-stop {
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: 14px;
  background: var(--color-crust);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  animation: stop-btn-pulse 1s ease-in-out infinite;
}
.btn-roulette-stop:hover { background: #2a1810; }
.btn-roulette-stop:active { transform: scale(0.97); }
.btn-roulette-stop:disabled { opacity: 0.6; cursor: not-allowed; animation: none; }
.btn-roulette-stop:focus-visible { outline: 3px solid var(--color-butter); outline-offset: 2px; }

@keyframes stop-btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 36, 24, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(61, 36, 24, 0); }
}

.load-error {
  text-align: center;
  color: var(--color-rye);
  font-size: 14px;
  padding: 24px 12px;
}

/* 切符のミシン目 */
.coupon-perforation {
  position: relative;
  border-top: 2px dashed rgba(61, 36, 24, 0.2);
}

.coupon-perforation::before,
.coupon-perforation::after {
  content: '';
  position: absolute;
  top: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-flour);
}
.coupon-perforation::before { left: -11px; }
.coupon-perforation::after  { right: -11px; }

@media (min-width: 600px) {
  .coupon-perforation::before,
  .coupon-perforation::after { background: var(--color-flour); }
}

.coupon-action {
  padding: 18px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-show {
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: 14px;
  background: var(--color-crust);
  color: var(--color-flour);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn-show:hover { background: #2a1810; }
.btn-show:active { transform: scale(0.97); }
.btn-show:focus-visible { outline: 3px solid var(--color-butter); outline-offset: 2px; }
.btn-show[disabled] { opacity: 0.4; cursor: not-allowed; }

/* 提示モード */
.presentation-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: pop-in 0.35s ease;
}

.presentation-note {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--color-rye);
}

.presentation-amount {
  margin: 4px 0;
  font-family: var(--font-display);
  font-size: 60px;
  line-height: 1;
  color: var(--color-berry);
}
.presentation-amount small { font-size: 22px; margin-left: 4px; }

.presentation-hint {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--color-rye);
}

/* 長押しスタンプボタン */
.btn-stamp {
  position: relative;
  width: 100%;
  padding: 17px 18px;
  border-radius: 14px;
  border: 2px solid var(--color-berry);
  background: var(--color-card);
  color: var(--color-berry);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.btn-stamp-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--color-berry);
  z-index: 0;
}

.btn-stamp-label {
  position: relative;
  z-index: 1;
  transition: color 0.15s ease;
}

.btn-stamp.is-holding .btn-stamp-label { color: #fff; }
.btn-stamp:focus-visible { outline: 3px solid var(--color-butter); outline-offset: 2px; }

.btn-back {
  background: none;
  border: none;
  color: var(--color-rye);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}
.btn-back:focus-visible { outline: 2px solid var(--color-butter); outline-offset: 2px; }

/* 使用済み／期間外ラベル（共通） */
.status-label { text-align: center; }
.status-label p:first-child {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--color-rye);
}
.status-detail {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--color-rye);
  opacity: 0.8;
}

/* 期間外／時間外ロック状態（鍵のアイコン） */
.status-label.is-locked-state p:first-child::before {
  content: '🔒';
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
  filter: grayscale(1) opacity(0.7);
}

.coupon.is-locked .coupon-ticket { filter: grayscale(0.4) brightness(0.99); }
.coupon.is-locked .coupon-main,
.coupon.is-locked .coupon-perforation,
.coupon.is-locked .coupon-tags { opacity: 0.55; }

/* 使用済みスタンプ（ハンコ） */
.coupon-stamp {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg) scale(1.4);
  border: 4px solid var(--color-berry);
  color: var(--color-berry);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.25;
  text-align: center;
  padding: 8px 20px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.coupon.is-used .coupon-ticket { filter: saturate(0.55) brightness(0.98); }
.coupon.is-used .coupon-main,
.coupon.is-used .coupon-perforation,
.coupon.is-used .coupon-tags { opacity: 0.55; }
.coupon.is-used .coupon-stamp {
  opacity: 0.85;
  animation: stamp-hit 0.35s ease;
  transform: translate(-50%, -50%) rotate(-14deg) scale(1);
}

@keyframes stamp-hit {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(1.7); }
  to   { opacity: 0.85; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- footnote / footer ---------- */

.footnote {
  margin: 10px 18px 0;
  font-size: 11px;
  color: var(--color-rye);
  opacity: 0.8;
  text-align: center;
}

.site-footer {
  margin-top: 30px;
  padding: 0 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-footer p {
  margin: 0;
  font-size: 11px;
  color: var(--color-rye);
  opacity: 0.7;
}

.reset-link {
  margin-top: 6px;
  background: none;
  border: none;
  font-size: 11px;
  color: var(--color-rye);
  opacity: 0.5;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: -80px;
  transform: translateX(-50%);
  background: var(--color-crust);
  color: var(--color-flour);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-soft);
  transition: bottom 0.35s ease;
  z-index: 50;
  max-width: 90%;
  text-align: center;
}

.toast.is-visible { bottom: 22px; }

/* ---------- staff passcode modal ---------- */

.passcode-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 36, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: pop-in 0.2s ease;
}

.passcode-overlay[hidden] { display: none; }

.passcode-box {
  width: 100%;
  max-width: 320px;
  background: var(--color-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 26px 22px 22px;
  text-align: center;
}

.passcode-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--color-crust);
}

.passcode-desc {
  margin: 8px 0 16px;
  font-size: 12px;
  color: var(--color-rye);
}

.passcode-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(61, 36, 24, 0.18);
  background: var(--color-flour);
  color: var(--color-crust);
  font-size: 20px;
  letter-spacing: 0.3em;
  text-align: center;
  box-sizing: border-box;
}
.passcode-input:focus-visible {
  outline: 3px solid var(--color-butter);
  outline-offset: 2px;
}

.passcode-error {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--color-berry);
}

.passcode-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-passcode-cancel,
.btn-passcode-submit {
  flex: 1;
  padding: 12px 10px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border: none;
}

.btn-passcode-cancel {
  background: var(--color-flour);
  color: var(--color-rye);
  border: 1.5px solid rgba(61, 36, 24, 0.15);
}

.btn-passcode-submit {
  background: var(--color-crust);
  color: var(--color-flour);
}
.btn-passcode-submit:active,
.btn-passcode-cancel:active { transform: scale(0.97); }

/* ---------- accessibility ---------- */

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