/**
 * さやポン御池印 フロントエンドCSS
 */
@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700&display=swap');

/* 横揺れ対策 */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    overflow-x: clip;
    position: relative;
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

/* 横揺れ対策 */
.sgk-container,
.sgk-gps-gate,
.sgk-password-gate,
.sgk-creation-form,
.sgk-daily-limit {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    overflow-x: clip;
    position: relative;
    overscroll-behavior-x: contain;
    touch-action: pan-y;
}

/* 横揺れ対策 */
.sgk-container,
.sgk-container *,
.sgk-container *::before,
.sgk-container *::after,
.sgk-viewer-page,
.sgk-viewer-page *,
.sgk-viewer-page *::before,
.sgk-viewer-page *::after {
    box-sizing: border-box;
}

/* 横揺れ対策 */
.sgk-card,
.sgk-form,
.sgk-result,
.sgk-result-actions,
.sgk-preview-container,
.sgk-preview-image,
.sgk-gps-overlay,
.sgk-gps-card,
.sgk-gps-success-stage,
.sgk-gps-success-actions,
.sgk-gps-success-title,
.sgk-gps-next-button,
.sgk-gps-success-image,
.sgk-loading-overlay,
.sgk-loading-image {
    max-width: 100%;
}

/* コンテナ */
.sgk-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

/* カード */
.sgk-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

/* タイトル */
.sgk-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin: 0 0 20px;
}

/* 説明文 */
.sgk-description {
    font-family: 'Zen Maru Gothic', sans-serif;
    color: #32a2da;
    text-align: center;
    margin-bottom: 30px !important;
    line-height: 1.6;
    font-size: 20px;
}

/* フォーム */
.sgk-form {
    margin: 0;
}

.sgk-form-group {
    margin-bottom: 20px;
}

/* ラベル */
.sgk-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.sgk-label-note {
    font-weight: 400;
    color: #666;
    font-size: 12px;
}

/* 入力欄 */
.sgk-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sgk-input:focus {
    outline: none;
    border-color: #5b7ee5;
    box-shadow: 0 0 0 3px rgba(91, 126, 229, 0.15);
}

/* エラー状態の入力欄 */
.sgk-input.sgk-input-error {
    border-color: #C94A4A;
}

.sgk-input.sgk-input-error::placeholder {
    color: #C94A4A;
}

.sgk-input.sgk-input-error::-webkit-input-placeholder {
    color: #C94A4A;
}

.sgk-input.sgk-input-error::-ms-input-placeholder {
    color: #C94A4A;
}

/* 参拝日時表示 */
.sgk-date-display {
    background: #f5f5f5;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* ヘルプテキスト */
.sgk-help-text {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
}

/* エラーメッセージ */
.sgk-error {
    background: #fff0f0;
    color: #d32f2f;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.sgk-password-block-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000001;
    color: #d32f2f;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 14px 18px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.6;
    max-width: calc(100vw - 40px);
    width: max-content;
    pointer-events: none;
}

/* ボタン */
.sgk-button {
    display: inline-block;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
    box-sizing: border-box;
    background-color: #3fbffe;
    color: #ffffff;
}

.sgk-button:active {
    transform: scale(0.98);
}

.sgk-button-primary {
    background: #4dc3ff;
    color: #fff;
}

.sgk-button-primary:hover {
    background: #33a2da;
    color: #fff;
}

.sgk-button-primary:disabled,
.sgk-button-primary.sgk-button-disabled {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.sgk-button-loading {
    display: none;
}

/* 保存ボタン */
.sgk-button-save {
    background: #4dc3ff;
    color: #fff;
}

.sgk-button-save:hover {
    background: #33a2da;
    color: #fff;
}

.sgk-button-save:disabled,
.sgk-button-save.sgk-button-disabled {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

/* 保存ヒントテキスト */
.sgk-save-hint {
    font-size: 14px;
    color: #F57C00;
    margin-top: 8px;
    text-align: center;
}

/* 共有メニューブロック */
.sgk-share-block {
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
}

.sgk-share-link {
    font-size: 13px;
    color: #666;
    text-decoration: underline;
}

.sgk-share-link:hover {
    color: #333;
}

/* 結果表示 */
.sgk-result {
    text-align: center;
}


.sgk-result-title {
    font-family: 'Zen Maru Gothic', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #32a2da;
    margin-bottom: 20px;
    border-bottom: 1px solid #fefefe;
}

/* プレビュー */
.sgk-preview-container {
    margin-bottom: 24px;
}

.sgk-preview-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 結果アクション */
.sgk-result-actions {
    margin-top: 20px;
}

/* 全画面ビューア */
.sgk-viewer-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    background: #000000;
    max-width: 100%;
    min-height: 100dvh;
    overflow-x: hidden !important;
    overflow-x: clip;
    overflow-y: hidden;
    -webkit-overflow-scrolling: auto;
    overscroll-behavior: none;
    overscroll-behavior-x: none;
    touch-action: pan-y;
}

.sgk-viewer-layout {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden !important;
    overflow-x: clip;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.sgk-viewer-image-area {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 80dvh;
    background: #111111;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.sgk-viewer-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sgk-viewer-action-area {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    min-height: 20dvh;
    background: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    overflow-x: hidden;
}

.sgk-viewer-message {
    margin: 0;
    color: #FFFFFF;
    text-align: center;
    font-size: 18px;
    line-height: 1.4;
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: hidden;
}

.sgk-viewer-message span {
    max-width: 100%;
    white-space: normal;
}

.sgk-viewer-exit-button {
    width: 100%;
    max-width: 360px;
}

/* 大きく表示画面: 終了確認モーダル */
.sayapon-goikein-exit-confirm-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    z-index: 1000000;
    padding: 20px;
}

.sayapon-goikein-exit-confirm-overlay.is-open {
    display: flex;
}

.sayapon-goikein-exit-confirm-dialog {
    width: min(92vw, 420px);
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.sayapon-goikein-exit-confirm-title {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.4;
    color: #333333;
}

.sayapon-goikein-exit-confirm-description {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    font-weight: bold;
    color: #FF3B30;
}

.sayapon-goikein-exit-confirm-actions {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sayapon-goikein-exit-confirm-button {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    background: #3bbeff;
    color: #ffffff;
    transition: background-color 0.2s ease;
}

.sayapon-goikein-exit-confirm-button:hover {
    background: #32a2da;
}

.sgk-help-block {
    margin-top: 16px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
}

.sgk-text-link {
    color: #5b7ee5;
    text-decoration: underline;
}

/* メッセージ */
.sgk-message {
    padding: 24px;
    border-radius: 8px;
    text-align: center;
}

.sgk-message p {
    margin: 8px 0;
    font-size: 18px;
    line-height: 1.6;
}

.sgk-message-info {
    font-family: 'Zen Maru Gothic', sans-serif;
    background: #fff7d8;
    color: #32a2da;
}

/* ローディングオーバーレイ */
.sgk-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: none;
}

.sgk-loading-image {
    position: absolute;
    left: 50%;
    max-width: 80%;
    height: auto;
    transform-origin: bottom center;
    animation: sgk-sway 2.5s infinite ease-in-out;
}

@keyframes sgk-sway {
    0% {
        transform: translateX(-50%) rotate(-10deg);
    }

    50% {
        transform: translateX(-50%) rotate(10deg);
    }

    100% {
        transform: translateX(-50%) rotate(-10deg);
    }
}

.sgk-loading-text {
    position: absolute;
    left: 0;
    width: 100%;
    text-align: center;
    color: #ffffff;
    margin: 0;
    padding: 0 20px;
    box-sizing: border-box;
}

/* 待機モーダル */
.sgk-wait-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 9999;
    display: none;
}

.sgk-wait-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.sgk-wait-image {
    width: min(70vw, 320px);
    max-width: 100%;
    height: auto;
    transform-origin: bottom center;
    animation: sgk-wait-swing 2.8s ease-in-out infinite;
}

.sgk-wait-message {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 640px;
    margin: 0;
    color: #ffffff;
    text-align: center;
    line-height: 1.7;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.sgk-wait-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: sgk-wait-spin 0.9s linear infinite;
}

@keyframes sgk-wait-swing {
    0% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }

    100% {
        transform: rotate(-10deg);
    }
}

@keyframes sgk-wait-spin {
    to {
        transform: rotate(360deg);
    }
}

/* レスポンシブ */

/* GPS制限（擬似チェックイン） */
.sgk-gps-step {
    display: none;
}

.sgk-gps-step-1 {
    display: block;
}

.sgk-gps-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.sgk-gps-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.sgk-gps-step-1 .sgk-gps-overlay {
    padding: 20px 20px 140px;
    padding: 20px 20px calc(140px + constant(safe-area-inset-bottom));
    padding: 20px 20px calc(140px + env(safe-area-inset-bottom));
}

.sgk-gps-step-1 .sgk-gps-card {
    position: relative;
    z-index: 3;
    max-height: calc(100vh - 220px);
    max-height: calc(100dvh - 220px);
    max-height: calc(100vh - 220px - constant(safe-area-inset-bottom));
    max-height: calc(100dvh - 220px - constant(safe-area-inset-bottom));
    max-height: calc(100vh - 220px - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 220px - env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sgk-gps-title {
    font-size: 24px;
    margin: 0 0 12px 0;
}

.sgk-gps-text {
    margin: 0 0 16px 0;
    line-height: 1.6;
    font-size: 16px;
}

.sgk-gps-step1-footer {
    /* 親要素が transform を持つ場合でも画面基準に寄せるための固定配置 */
    position: fixed !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    bottom: 20px;
    bottom: calc(20px + constant(safe-area-inset-bottom));
    bottom: calc(20px + env(safe-area-inset-bottom));
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    z-index: 2147483647 !important;
    color: #ffffff !important;
    pointer-events: none;
}

.sgk-gps-step1-footer-link {
    pointer-events: auto;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-size: 14px;
    line-height: 1.0;
    text-decoration: none;
}

.sgk-gps-step1-footer-link:visited {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.sgk-gps-step1-footer-link:hover,
.sgk-gps-step1-footer-link:active {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.sgk-gps-step1-footer-copy {
    margin: 4px 0 0;
    color: #ffffff !important;
    font-size: 12px;
    line-height: 1.5;
}

@media (max-height: 700px) {
    .sgk-gps-step-1 .sgk-gps-overlay {
        padding-bottom: 160px;
        padding-bottom: calc(160px + constant(safe-area-inset-bottom));
        padding-bottom: calc(160px + env(safe-area-inset-bottom));
    }

    .sgk-gps-step-1 .sgk-gps-card {
        max-height: calc(100vh - 250px);
        max-height: calc(100dvh - 250px);
        max-height: calc(100vh - 250px - constant(safe-area-inset-bottom));
        max-height: calc(100dvh - 250px - constant(safe-area-inset-bottom));
        max-height: calc(100vh - 250px - env(safe-area-inset-bottom));
        max-height: calc(100dvh - 250px - env(safe-area-inset-bottom));
    }

    .sgk-gps-step1-footer {
        bottom: 16px;
        bottom: calc(16px + constant(safe-area-inset-bottom));
        bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

.sgk-gps-checkin-button {
    display: inline-block;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
    box-sizing: border-box;
    background-color: #3fbffe;
    color: #ffffff;
    max-width: 320px;
}

.sgk-gps-checkin-button:active {
    transform: scale(0.98);
}

.sgk-gps-checkin-button:hover {
    background: #32a2da;
    color: #fff;
}

.sgk-gps-checkin-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.sgk-gps-loading-card {
    padding: 30px 24px;
}

.loading-wave {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #32a2da;
    letter-spacing: 2px;
}

.loading-wave span {
    display: inline-block;
    animation: wave 1s infinite;
}

.loading-wave span:nth-child(1) { animation-delay: 0.1s; }
.loading-wave span:nth-child(2) { animation-delay: 0.2s; }
.loading-wave span:nth-child(3) { animation-delay: 0.3s; }
.loading-wave span:nth-child(4) { animation-delay: 0.4s; }
.loading-wave span:nth-child(5) { animation-delay: 0.5s; }
.loading-wave span:nth-child(6) { animation-delay: 0.6s; }
.loading-wave span:nth-child(7) { animation-delay: 0.7s; }
.loading-wave span:nth-child(8) { animation-delay: 0.8s; }
.loading-wave span:nth-child(9) { animation-delay: 0.9s; }
.loading-wave span:nth-child(10) { animation-delay: 1s; }
.loading-wave span:nth-child(11) { animation-delay: 1.1s; }
.loading-wave span:nth-child(12) { animation-delay: 1.2s; }
.loading-wave span:nth-child(13) { animation-delay: 1.3s; }
.loading-wave span:nth-child(14) { animation-delay: 1.4s; }

@keyframes wave {
    0%, 40%, 100% { transform: translateY(0); }
    20% { transform: translateY(-10px); }
}

@keyframes sgk-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-12px); }
}

.sgk-gps-success-stage {
    position: relative;
    width: 100%;
    height: 100%;
}

.sgk-gps-success-image {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    height: auto;
    animation: sgk-bounce 1.6s ease-in-out infinite;
}

.sgk-gps-success-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Zen Maru Gothic', sans-serif;
    color: #ffffff;
    font-weight: 700;
    text-align: center;
    max-width: 90%;
    line-height: 1.6;
}

.sgk-gps-success-actions {
    position: static;
    width: 100%;
    text-align: center;
}

.sgk-gps-success-title {
    position: absolute;
    left: 50%;
    top: 100px;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 520px;
    font-size: 24px;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.sgk-gps-next-button {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    display: inline-block;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
    box-sizing: border-box;
    background-color: #3fbffe;
    color: #ffffff;
    max-width: 320px;
}

.sgk-gps-next-button:active {
    transform: translateX(-50%) scale(0.98);
}

.sgk-gps-next-button:hover {
    background: #32a2da;
    color: #fff;
}

.sgk-gps-next-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
@media (max-width: 480px) {
    .sgk-container {
        padding: 16px;
    }

    .sgk-card {
        padding: 20px;
    }

    .sgk-title {
        font-size: 20px;
    }

    .sgk-gps-card {
        padding: 20px;
    }

    .sgk-gps-title {
        font-size: 24px;
    }

    .sgk-gps-checkin-button {
        font-size: 18px;
    }
}

