﻿html.is-coupon-open,
body.is-coupon-open{
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  scroll-behavior: auto !important;
}

/* ========================================
   ヘッダー用 クーポン件数バッジ
======================================== */
.header-primary__navigation-item-wrapper--coupon{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-primary__navigation-item-wrapper--coupon img{
  display: block;
  width: 45px;
  height: 45px;
}

.coupon-state--count{
  position: absolute;
  top: 0;
  right: 0.25rem;
  z-index: 2;
  display: grid;
  width: var(--count-num-width, 20px);
  aspect-ratio: 1 / 1;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  box-sizing: border-box;

  background-color: var(--color-emphasis, #c94141);
  color: var(--color-white, #fff);
  font-family: var(--font-en, inherit);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}

.coupon-state--count span{
  display: block;
  line-height: 1;
}


/* ========================================
   TOP クーポンBOX 本体
======================================== */
.top-coupon-box{
  position: fixed;
  right: 130px;
  bottom: 12px;
  z-index: 20;
  box-sizing: border-box;
}

.top-coupon-box *{
  box-sizing: border-box;
}


/* ========================================
   BOXトリガーボタン
======================================== */
.top-coupon-box__trigger{
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(183, 138, 58, 0.22);
  background: linear-gradient(
  135deg,
  #faf0e1 0%,
  #fae9d0 40%,
  #eedac2 85%,
  #e0dac7 100%
  );
  /*
  background-color:#fffbc2;
  background: linear-gradient(
  45deg,
  #e0dac7 0%,
  #eedac2 5%,
  #fae9d0 10%,
  #fae9d0 53%,
  #faf0e1 90%,
  #f6e8d5 100%
  );
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.98) 0%,
    rgba(248,245,239,0.98) 100%
  );
  */
  color: #2b2b2b;
  border-radius: 50%;
  /*
  box-shadow:
    0 8px 24px rgba(0,0,0,0.30),
    0 2px 8px rgba(0,0,0,0.08);
  */
  box-shadow:
  0 10px 28px rgba(224,218,199,0.75),
  0 3px 10px rgba(224,218,199,0.35);   
  width: 90px;
  height: 90px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
}

.top-coupon-box__trigger:hover{
  transform: translateY(-2px);
  box-shadow:
    0 14px 30px rgba(0,0,0,0.16),
    0 4px 12px rgba(0,0,0,0.10);
}

.top-coupon-box__trigger:active{
  transform: translateY(0);
}

.top-coupon-box__trigger:focus-visible{
  outline: 2px solid rgba(183, 138, 58, 0.55);
  outline-offset: 3px;
}

.top-coupon-box__icon-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.top-coupon-box__icon{
  display: block;
  width: 90px;
  height: 90px;
  object-fit: contain;
}

/* 一旦文字不要 */
.top-coupon-box__label{
  display: none;
}

.top-coupon-box__badge{
  position: absolute;
  top: 10px;
  right: -1px;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  box-sizing: border-box;

  background: #cf1f2e;
  color: #fff;
  border: 1.5px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);

  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}


/* ========================================
   パネル外枠
   PC：ボタン上の吹き出し
======================================== */
.top-coupon-box__panel{
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);

  width: min(760px, calc(100vw - 24px));
  max-width: none;

  overflow: visible;
  pointer-events: none;

  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(183, 138, 58, 0.22);
  border-radius: 18px;

  box-shadow:
    0 18px 48px rgba(0,0,0,0.18),
    0 4px 14px rgba(0,0,0,0.08);

  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.24s ease,
    visibility 0.24s ease,
    transform 0.24s ease;

  z-index: 10;
}

.top-coupon-box__panel::after{
  content: "";
  position: absolute;
  right: 36px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: rgba(255,255,255,0.98);
  border-right: 1px solid rgba(183, 138, 58, 0.22);
  border-bottom: 1px solid rgba(183, 138, 58, 0.22);
  transform: rotate(45deg);
  z-index: 1;
}

.top-coupon-box.is-open .top-coupon-box__panel{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

@media (min-width: 1024px){
  .top-coupon-box__panel{
    width: min(880px, calc(100vw - 120px));
  }
}


/* ========================================
   パネルヘッダー
======================================== */
.top-coupon-box__panel-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #ece7dc;
  background: linear-gradient(180deg, #fcfaf5 0%, #f7f2e8 100%);
  border-radius: 10px 0 0 0;
}

.top-coupon-box__panel-title{
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: #3a3124;
}

.top-coupon-box__close{
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: #6b5f4c;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.top-coupon-box__close:focus-visible{
  outline: 2px solid rgba(183, 138, 58, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}


/* ========================================
   パネル本文エリア
======================================== */
.top-coupon-box__panel-body{
  padding: 16px 20px 20px;
  max-height: min(78vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}


/* ========================================
   SP
   固定モーダル風で安全表示
======================================== */
@media (max-width: 767px){
  .top-coupon-box{
    right: 10px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    z-index: 20;
  }

  .top-coupon-box__trigger{
    width: 70px;
    height: 70px;
    padding: 0;
  }

  .top-coupon-box__icon{
    width: 77px;
    height:77px;
  }

  .top-coupon-box__label{
    font-size: 13px;
  }
  
  .top-coupon-box__badge{
    min-width: 25px;
    height: 25px;
  }
  .top-coupon-box__panel{
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(96px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;

    border-radius: 16px;
    overflow: hidden;

    max-height: calc(100dvh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .top-coupon-box__panel::after{
    display: none;
  }

  .top-coupon-box__panel-head{
    padding: 14px 16px;
  }

  .top-coupon-box__panel-body{
    padding: 14px 16px 18px;
    max-height: calc(100dvh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}