@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Zen Maru Gothic', serif;
    margin: 0;
    padding: 0;
    background: #f0f0f0;
    text-align: center;
    overflow-x: hidden;
}

/* メインコンテナ: 幅を固定して中央寄せ */
.main-container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    /* 少し影をつけて浮き上がらせる */
}

/* 在庫終了通知 */
.stock-notice-container {
    width: 100%;
    background: linear-gradient(135deg, #fff5f5, #ffe8e8);
    border-top: 3px solid #e74c3c;
    padding: 0;
}

.stock-notice-item {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 18px;
    color: #c0392b;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid rgba(231, 76, 60, 0.2);
}

.stock-notice-item:last-child {
    border-bottom: none;
}

.stock-notice-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stock-notice-text {
    line-height: 1.6;
}

.character-section {
    width: 100%;
    line-height: 0;
    position: relative;
    /* 画像下の隙間を消す */
}

/* 右上アイコンボタン */
.top-links-wrapper {
    position: absolute;
    top: 8px;
    right: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    z-index: 110;
}

.top-buttons-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.top-button {
    min-width: 82px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #578b4f;
    color: white;
    font-size: 0.72rem;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(87, 139, 79, 0.45);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.top-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(87, 139, 79, 0.55);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.character-img {
    width: 100%;
    height: auto;
    display: block;
}

.stamp-section {
    width: 100%;
    background: #fce3a8;
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 0;
    margin: 0;
    position: relative;
}

.footer-bar {
    width: 100%;
    background: #0068b7;
    padding: 4px 12px;
    box-sizing: border-box;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.footer-text {
    color: white;
    font-size: 0.70rem;
    font-weight: 400;
}

.container {
    text-align: center;
    width: 100%;
    padding: 0;
    margin: 0;
}

h1 {
    color: #333;
    margin: 20px 0;
    font-size: clamp(2rem, 4vw, 2.4rem);
    text-shadow: none;
}

.document {
    background: transparent;
    padding: 0;
    box-shadow: none;
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.document-text {
    font-size: 1.2rem;
    line-height: 2;
    color: #333;
    margin-bottom: 40px;
}

/* 3x2スタンプ表 */
.stamp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 85%;
    margin: 0 auto;
    border: none;
    padding: 5px;
    background: transparent;
    position: relative;
    overflow: visible;
    z-index: 1;
    box-shadow: none;
}

.stamp-cell {
    background: transparent;
    border-radius: 50%;
    padding: 0;
    position: relative;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    max-width: 100%;
}

/* 正方形にするためのpadding-topハック（Safari対応） */
.stamp-cell::before {
    content: '';
    display: block;
    padding-top: 100%;
}

.stamp-cell.has-stamp {
    z-index: 10;
}


.stamp-cell.has-stamp .stamp-slot {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stamp-slot {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* 装飾は非表示 */
.stamp-slot::before,
.stamp-slot::after {
    display: none;
}

.slot-number {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0;
    color: rgba(100, 80, 50, 0.7);
    z-index: 1;
    white-space: nowrap;
}


.stamp-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10%;
}

.stamp {
    width: 75%;
    height: 75%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transform: scale(0) rotate(-180deg);
    opacity: 0;
    filter: drop-shadow(0 0 0 transparent);
    z-index: 2;
}

/* 中央押印用の大きなスタンプ（スタンプ表全体を覆う） */
.stamp.stamp-center {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    margin-left: -300px;
    margin-top: -300px;
    transform-origin: center;
    transform: scale(0) rotate(-180deg);
    opacity: 0;
    pointer-events: none;
    z-index: 10000 !important;
}

@media (max-width: 768px) {
    .stamp.stamp-center {
        width: 340px;
        height: 340px;
        margin-left: -170px;
        margin-top: -170px;
    }
}


.stamp.stamp-center.animate {
    animation:
        stampPressCenter 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        stampGlowCenter 0.5s ease-in-out 0.8s;
}

@keyframes stampPressCenter {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
        filter: drop-shadow(0 0 0 transparent) blur(18px);
    }

    40% {
        transform: scale(1.4) rotate(-15deg);
        opacity: 0.85;
        filter: drop-shadow(0 35px 90px rgba(231, 76, 60, 1)) blur(6px);
    }

    60% {
        transform: scale(0.95) rotate(8deg);
        opacity: 1;
        filter: drop-shadow(0 45px 110px rgba(231, 76, 60, 1)) blur(2px);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: drop-shadow(0 35px 90px rgba(231, 76, 60, 0.85)) blur(0px);
    }
}

@keyframes stampGlowCenter {

    0%,
    100% {
        filter: drop-shadow(0 30px 80px rgba(231, 76, 60, 0.8)) brightness(1);
    }

    50% {
        filter: drop-shadow(0 30px 100px rgba(231, 76, 60, 1)) brightness(1.3);
    }
}

.stamp img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stamp.animate {
    animation: stampPress 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.stamp.slide-in {
    animation: slideFromCenter 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
}

@keyframes slideFromCenter {
    0% {
        transform: scale(3) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* 中央から左上へ移動するCSSはJS側のtransitionで制御 */

@keyframes stampPress {
    0% {
        transform: scale(0) rotate(-180deg) translateY(-100px);
        opacity: 0;
    }

    40% {
        transform: scale(1.5) rotate(-20deg) translateY(-10px);
        opacity: 0.7;
    }

    60% {
        transform: scale(0.8) rotate(10deg) translateY(5px);
        opacity: 1;
    }

    75% {
        transform: scale(1.1) rotate(-5deg) translateY(0);
    }

    100% {
        transform: scale(1) rotate(0deg) translateY(0);
        opacity: 1;
    }
}

@keyframes stampGlow {

    0%,
    100% {
        filter: drop-shadow(0 10px 30px rgba(231, 76, 60, 0.6)) brightness(1);
    }

    50% {
        filter: drop-shadow(0 10px 50px rgba(231, 76, 60, 1)) brightness(1.2);
    }
}

@keyframes stampFloat {

    0%,
    100% {
        transform: scale(1) rotate(0deg) translateY(0);
    }

    50% {
        transform: scale(1.02) rotate(2deg) translateY(-5px);
    }
}

.stamp-text {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e74c3c;
    writing-mode: horizontal-tb;
    letter-spacing: 2px;
}

/* インク飛び散りエフェクト */
.ink-splatter {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.ink-dot {
    position: absolute;
    background: #e74c3c;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
}

.stamp.animate .ink-dot {
    animation: splatter 0.8s ease-out forwards;
}

@keyframes splatter {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
        box-shadow: 0 0 20px rgba(231, 76, 60, 1);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 30px rgba(231, 76, 60, 0.8);
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0) rotate(360deg);
        opacity: 0;
        box-shadow: 0 0 0 transparent;
    }
}

/* 衝撃波エフェクト */
.shockwave {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid #e74c3c;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
}

.stamp.animate .shockwave {
    animation: shockwaveExpand 0.6s ease-out forwards;
}

@keyframes shockwaveExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
        border-width: 5px;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
        border-width: 0px;
    }
}

/* パーティクル爆発 */
.particle {
    position: absolute;
    background: linear-gradient(45deg, #e74c3c, #f39c12);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.stamp.animate .particle {
    animation: particleExplode 1s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(calc(-50% + var(--px)), calc(-50% + var(--py))) scale(0);
        opacity: 0;
    }
}

/* 光の輝き */
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 10px white;
}

.stamp.animate .sparkle {
    animation: sparkleShine 0.8s ease-out forwards;
}

@keyframes sparkleShine {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }

    30% {
        opacity: 1;
        transform: translate(var(--sx), var(--sy)) scale(1.5);
    }

    100% {
        transform: translate(calc(var(--sx) * 2), calc(var(--sy) * 2)) scale(0);
        opacity: 0;
    }
}

/* ===== 共通ボタンスタイル ===== */
.btn {
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ボタンカラーバリエーション */
.btn--purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn--purple:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn--gray {
    background: #95a5a6;
    padding: 12px 30px;
    font-size: 1rem;
    box-shadow: none;
}

.btn--gray:hover {
    background: #7f8c8d;
    transform: none;
}

.btn-stamp {
    margin-left: 0;
}

.btn-reset {
    margin-left: 10px;
}

.qr-button-area {
    text-align: center;
    padding: 8px 0 10px 0;
}

.map-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    transition: transform 0.2s;
}

.map-icon-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.btn--blue {
    background: linear-gradient(135deg, #3498db, #2980b9);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.btn--blue:hover {
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.btn--red {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.btn--red:hover {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

.btn--red:disabled {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

/* ボタンサイズバリエーション */
.btn--wide {
    min-width: 260px;
    justify-content: center;
}

.btn--icon {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* 個別ボタン追加スタイル */
/* .btn-qr: QRボタン固有スタイル */
.btn-qr {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    min-width: 200px;
    padding: 10px 20px;
    border-radius: 999px;
    background: #6aa863;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 0 0 3px white, 0 0 0 5px rgba(106, 168, 99, 0.55);
    transition: all 0.25s ease;
}

.btn-qr:hover {
    background: #5b9956;
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px white, 0 0 0 5px rgba(91, 153, 86, 0.6);
}

.btn-qr:active {
    transform: translateY(0);
    box-shadow: 0 0 0 3px white, 0 0 0 5px rgba(106, 168, 99, 0.45);
}

.btn-qr-icon {
    width: 20px;
    height: 20px;
    margin-left: 10px;
    object-fit: contain;
    flex-shrink: 0;
}

.btn-qr-text {
    flex: 1;
    text-align: center;
}

.btn-qr-arrow {
    font-size: 1.4rem;
    font-weight: bold;
    line-height: 1;
    opacity: 0.9;
}

/* 引き換えボタン */
.redeem-area {
    text-align: center;
    padding: 10px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#title-area {
    text-align: center;
    padding: 0 15px 8px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

/* 承認スタンプバリエーション */
.stamp.approved .ink-dot,
.stamp.approved .particle {
    background: #27ae60;
}

.stamp.approved .shockwave {
    border-color: #27ae60;
}

/* 却下スタンプバリエーション */
.stamp.rejected .ink-dot,
.stamp.rejected .particle {
    background: #c0392b;
}

.stamp.rejected .shockwave {
    border-color: #c0392b;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    body {
        padding: 0;
        min-height: auto;
    }

    .main-container {
        max-width: 100%;
    }

    .stamp-section {
        min-height: auto;
        padding: 10px;
        margin: 0;
        width: 100%;
        gap: 10px;
        align-items: center;
    }

    #title-area {
        text-align: center;
        padding: 0 15px 8px;
        margin-top: 4px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }

    /* .btn-redeem: 引き換えボタン固有スタイルがあれば追加 */

    .btn-redeem.redeemed {
        background: linear-gradient(135deg, #d5d8dc, #b0b3b8);
        color: #555;
        cursor: default;
        box-shadow: none;
    }

    .btn-title {
        display: none;
        margin-top: 10px;
    }

    /* 承認スタンプバリエーション */
    .stamp.approved .ink-dot,
    .stamp.approved .particle {
        background: #27ae60;
    }

    .stamp.approved .shockwave {
        border-color: #27ae60;
    }

    /* 却下スタンプバリエーション */
    .stamp.rejected .ink-dot,
    .stamp.rejected .particle {
        background: #c0392b;
    }

    .stamp.rejected .shockwave {
        border-color: #c0392b;
    }

    .button-group {
        display: flex;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .stamp-grid {
        gap: 8px;
        padding: 5px;
    }

    .stamp-cell {
        padding: 0;
    }

    /* モバイル用：正方形を維持 */
    .stamp-cell::before {
        padding-top: 100%;
    }

    .stamp-slot {
        border: none;
    }

    /* ===== モバイル軽量化 ===== */

    /* filterのみ無効化（重い処理）、アニメーションは維持 */
    .stamp,
    .stamp.animate,
    .stamp.stamp-center,
    .stamp.stamp-center.animate {
        filter: none !important;
        will-change: transform, opacity;
    }

    /* ループアニメーション（発光・浮遊）のみ無効化 */
    .stamp.animate {
        animation: stampPress 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    /* パーティクルのbox-shadowを無効化（軽量化） */
    .ink-dot,
    .particle,
    .sparkle {
        box-shadow: none !important;
    }
}

/* ポップアップアニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}