* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 画像はOSの長押しメニュー/選択/ドラッグを抑止し、タッチを親要素に通す */
img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* PWAらしさ: テキスト長押し選択/OSコールアウトを全体で抑止 */
body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* フォーム入力欄はテキスト選択を許可（コピペ等の操作に必要） */
input,
textarea,
[contenteditable="true"] {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

/* Vercelツールバーを非表示 */
vercel-live-feedback,
[data-vercel-toolbar],
#vercel-live-feedback {
    display: none !important;
}

html {
    background-color: #ffffff;
    touch-action: manipulation;
}

/* ActionBar - iOS PWAステータスバー背景 */
ActionBar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background-color: white;
    z-index: 10000;
    pointer-events: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    background: #cbcbcb66;
    min-height: 100vh;
    padding: 20px;
    /* iOS safe area insets */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    text-align: center;
}

header h1 {
    color: #666;
    font-size: 2.5em;
}

header h1 i {
    margin-right: 10px;
}

.ticket-form, .ticket-list {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

/* バリエーション切替トグル */
.variant-toggle {
    background: white;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.variant-toggle-label {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}
/* iOS風トグルスイッチ */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #ccc;
    border-radius: 30px;
    transition: background 0.2s;
}
.switch-slider::before {
    content: "";
    position: absolute;
    width: 26px;
    height: 26px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.switch input:checked + .switch-slider {
    background: #ff8e35;
}
.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

/* 整理番号券種トグル */
.seat-type-toggles {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.seat-type-btn {
    padding: 8px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}
.seat-type-btn.active {
    background: #ff8e35;
    border-color: #ff8e35;
    color: #fff;
}
.seat-type-error {
    color: #ff4757;
    font-size: 12px;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #ffe5e5;
    border-radius: 5px;
}
.seat-preview {
    color: #ff8e35;
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
    display: block;
}

.ticket-form h2, .ticket-list h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.ticket-form h2 i, .ticket-list h2 i {
    margin-right: 10px;
    color: #4e4e4e;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #efb522;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background: #ff8e35;
    color: white;
}

.btn-primary:hover {
    background: #ff8e35;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.count-badge {
    background: #ff8e35;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    margin-left: 10px;
}

#ticketsContainer {
    display: grid;
    gap: 20px;
}

.ticket-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
    background: #fafafa;
    cursor: pointer;
    position: relative;
}

.ticket-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-color: #ff8e35;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.ticket-title {
    font-size: 1.3em;
    font-weight: 700;
    color: #333;
    flex: 1;
}

.ticket-info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.ticket-info-item {
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
}

.ticket-info-item i {
    margin-right: 8px;
    color: #847f7f;
    width: 16px;
    text-align: center;
}

.ticket-status-display {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.status-indicator {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.status-indicator.open {
    background: #e0e0e0;
    color: #555;
}

.status-indicator.in-progress {
    background: #e0e0e0e6;
    color: white;
}

.status-indicator.completed {
    background: #c1c5c3;
    color: white;
}

.status-indicator i {
    margin-right: 8px;
}

.ticket-actions {
    display: flex;
    gap: 10px;
}

.btn-delete {
    background: #e76d6de8;
    color: white;
    padding: 8px 32px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    margin-top: 10px;
}

.btn-delete:hover {
    background: #e76d6de8;
    transform: translateY(-2px);
}

.btn-delete i {
    margin-right: 5px;
}

.no-tickets {
    text-align: center;
    padding: 60px 20px;
    color: #767676;
}

.no-tickets i {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-tickets p {
    font-size: 1.2em;
}

/* チケット詳細画面（全画面固定） */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.modal-bg-gif {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

.modal.show {
    display: block;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .ticket-header {
        flex-direction: column;
    }
}

/* ================================================
   Ticket Detail Modal
   ================================================ */

/* Modal Container */
.modal-container {
    max-width: 414px;
    margin: 0 auto;
    background-color: transparent;
    height: 100%;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Modal Navigation Bar */
.modal-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    padding-top: max(18px, env(safe-area-inset-top));
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    animation: slideDown 0.5s ease-out 0.1s both;
    position: relative;
}

.nav-bar {
    background-color: #424242;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    transform: translateY(5px);
}

.modal-nav-back {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    color: #000;
}

.modal-nav-back .back-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-top: 10px;
}

.modal-nav-back:active {
    transform: scale(0.9);
    opacity: 0.7;
}

.modal-nav-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin-top: 18px;
}

.modal-nav-spacer {
    width: 24px;
}

/* Stamp Animation */
.stamp-container {
    position: absolute;
    top: 50px;
    right: 25px;
    transform: scale(3);
    transform-origin: center center;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.stamp-container.is-stamped {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}

.stamp-image {
    width: 160px;
    height: 160px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

/* Modal Ticket Section */
.modal-ticket-section {
    padding: 16px;
    padding-top: 20px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
    position: relative;
    font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "HiraKakuPro-W3", "Hiragino Kaku Gothic ProN", "Hiragino Sans", -apple-system, BlinkMacSystemFont, Meiryo, sans-serif;
}

.modal-ticket-card {
    background-image: url('iphone_4inch.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.6s ease-out 0.2s both;
    margin-top: -8px;
    margin-left: -6px;
    margin-right: -5px;
    position: relative;
    will-change: transform, opacity;
    transition: transform 0.3s ease;
    overflow: hidden;
    aspect-ratio: 702 / 1016;
}

/* チケットカードの上部セクション */
.modal-ticket-card-top {
    padding: 20px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 57%;
    overflow: hidden;
    z-index: 11;
}

/* チケットカードの下部セクション */
.modal-ticket-card-bottom {
    /* Name/Seat それぞれ独立した上下位置調整用（正の値で下、負の値で上） */
    --name-offset-y: -30px;
    --seat-offset-y: -43px;
    padding: 20px;
    padding-top: 50px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 43%;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
    z-index: 11;
}

/* Name を独立して上下移動（label + value 一緒に） */
/* 注: .modal-ticket-info.visible の transform と競合するため、詳細度をクラス3個に上げて確実に上書き */
.modal-ticket-card-bottom .modal-ticket-info.modal-ticket-name {
    transform: translateY(var(--name-offset-y));
}

/* Seat を独立して上下移動（label + value 一緒に） */
.modal-ticket-card-bottom .modal-ticket-info.modal-ticket-seat {
    transform: translateY(var(--seat-offset-y));
}

/* 顔写真（下部セクションの右側）
   カード自体が aspect-ratio 固定なので、位置・サイズも % で指定して
   画面幅が変わっても本家と同じ比率を保つ */
.modal-face-image {
    position: absolute;
    top: 10%;
    right: 5%;
    width: 24%;
    aspect-ratio: 39 / 50;
    object-fit: cover;
    border-radius: 4px;
    z-index: 12;
}

/* hidden 属性が効くよう、display を持つ指定より優先させる */
.modal-face-image[hidden] {
    display: none;
}

/* Artist位置調整 */
.modal-ticket-info.modal-ticket-artist {
    margin-bottom: 10px;
}

/* Venue位置調整 */
.modal-ticket-info.modal-ticket-venue {
    margin-bottom: 10px;
}

/* Date位置調整 */
.modal-ticket-info.modal-ticket-date {
    margin-bottom: 10px;
}

/* Time行位置調整 */
.modal-time-row.modal-ticket-time {
    margin-bottom: 10px;
}

/* Name位置調整 */
.modal-ticket-info.modal-ticket-name {
    margin-bottom: 10px;
}

/* Seat位置調整 */
.modal-ticket-info.modal-ticket-seat {
    margin-bottom: 10px;
}
.modal-event-title {
    font-size: 17px;
    font-weight: 900;
    line-height: 1.0;
    margin-bottom: 24px;
    margin-top: 4px;
    color: #000;
    animation: fadeIn 0.6s ease-out 0.3s both;
}

.modal-ticket-info {
    margin-bottom: 18px;
    animation: fadeIn 0.5s ease-out both;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.modal-ticket-info.visible {
    opacity: 1;
    transform: translateY(0);
}

.modal-info-label {
    font-size: 11px;
    color: #FFFFFF;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-info-value {
    font-size: 10px;
    color: #000;
    line-height: 1.4;
    font-weight: 600;
    margin-top: -4px;
}

/* Artist */
.modal-ticket-artist .modal-info-value {
    font-size: 15px;
}

/* Venue */
.modal-ticket-venue .modal-info-value {
    font-size: 14.5px;
}

/* Date */
.modal-ticket-date .modal-info-value {
    font-size: 15px;
}

/* Name - 大きく通常ウェイト */
.modal-ticket-name .modal-info-value {
    font-size: 16px;
    font-weight: 600;
}

/* Seat - やや大きくミディアム */
.modal-ticket-seat .modal-info-value {
    font-size: 16px;
    font-weight: 600;
}

.modal-time-row {
    display: flex;
    gap: 32px;
    margin-bottom: 18px;
    animation: fadeIn 0.5s ease-out 0.7s both;
}

.modal-time-item {
    flex: 1;
}

.modal-time-item.modal-time-start {
    margin-left: -230px;
}

.modal-time-value {
    font-size: 15px;
    font-weight: 600;
    color: #000;
    margin-top: -8px;
}

/* Page Indicator */
.page-indicator {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.page-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transform: translateY(-70px);
}

.page-count {
    position: absolute;
    right: -60px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    left: 160px;
    transform: translateY(-70px);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

/* Status Actions */
.modal-status-actions {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    display: flex;
    padding-bottom: calc(1px + env(safe-area-inset-bottom));
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.modal-status-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #767676;
}

.modal-status-btn:hover {
    color: #ff6b35;
}

.modal-status-btn:active {
    transform: scale(0.95);
}

.modal-status-btn.active {
    color: #ff6b35;
}

.modal-status-btn.active .nav-label {
    color: #000;
}

.modal-status-btn i {
    font-size: 24px;
    margin: 0;
}

.modal-status-btn .nav-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.modal-status-btn:nth-child(1) .nav-icon,
.modal-status-btn:nth-child(3) .nav-icon {
    width: 20px;
    height: 20px;
}

.modal-status-btn .nav-label {
    font-size: 10px;
    font-weight: 400;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 414px) {
    .modal-container {
        width: 100%;
    }
}

/* ================================================
   Entrance Check Modal
   ================================================ */

/* 入場チェックモーダル */
.entrance-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
}

.entrance-modal.show {
    display: block;
    animation: slideInRight 0.3s ease-out;
}

.entrance-modal.closing {
    animation: slideOutRight 0.3s ease-out;
}

.entrance-container {
    max-width: 414px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

/* ヘッダー */
.entrance-header {
    /* タイトル/サブタイトル/閉じるボタン/閉じるアイコンそれぞれ独立した上下位置調整用（正の値で下、負の値で上） */
    --entrance-title-offset-y: 10px;
    --entrance-subtitle-offset-y: 15px;
    --entrance-close-offset-y: 10px;
    --close-icon-offset-y: 0px;
    background: linear-gradient(135deg, #ff6b35 0%, #ff6b35 100%);
    padding: 20px 16px;
    padding-top: max(20px, env(safe-area-inset-top));
    color: white;
}

.entrance-header-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.entrance-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    text-align: center;
    transform: translateY(var(--entrance-title-offset-y));
}

.entrance-close {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    transform: translateY(var(--entrance-close-offset-y));
}

.entrance-close .close-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transform: translateY(var(--close-icon-offset-y));
}

/* :activeでも--entrance-close-offset-yを維持しつつscaleを適用 */
.entrance-close:active {
    transform: translateY(var(--entrance-close-offset-y)) scale(0.9);
}

.entrance-subtitle {
    font-size: 13px;
    margin: 0;
    opacity: 0.95;
    text-align: center;
    transform: translateY(var(--entrance-subtitle-offset-y));
}

/* メインコンテンツ */
.entrance-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 本家は名前の左端が16px、ヘッダーから名前までが約67px。
       左右は対称のままにしないとサークルの中央寄せがずれる。 */
    padding: 58px 13px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.entrance-user-info {
    text-align: left;
    /* 本家の「席の下端 → リング上端」の間隔に合わせる */
    margin-bottom: 77px;
    align-self: stretch;
}

/* 顔写真（本家 sample.jpeg と同じ配置：プログレスサークルの右下に重ねる）
   親は .entrance-progress(300x300)。% は 300px 基準なので、
   414px 幅のとき 162x180px・画面右から 14px になる値を指定している。
   絶対配置なので他の要素の位置には影響しない。 */
.entrance-face-image {
    position: absolute;
    /* 本家は画面幅の 39.1%。コンテナ上限が 414px なので 162px で頭打ちにする */
    width: min(39.1vw, 162px);
    /* 本家の実測 472x607（白い服が背景と同化して以前は下端を取り違えていた） */
    aspect-ratio: 472 / 607;
    /* 右端をコンテナ右端から 14px の位置に置く。
       サークル(239px)の右端はコンテナ中心+119.5px なので、
       ずらす量 = コンテナ幅の半分 - 119.5px - 14px */
    right: calc(133.5px - min(50vw, 207px));
    /* 本家の写真上端はヘッダーから468px。ボックス下端から43px上げると一致する。 */
    top: calc(100% - 43px);
    object-fit: cover;
    border-radius: 6px;
    /* サークルはタップでスタンプを押す領域なので、写真がタップを奪わないようにする */
    pointer-events: none;
}

.entrance-face-image[hidden] {
    display: none;
}

.entrance-name {
    font-size: 30px;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: #333;
}

.entrance-seat {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    /* 本家の名前↔席の行間は約19px。実機は11pxで詰まっていたので広げる */
    margin-top: -7px;
    color: #333;
}

/* プログレスサークル */
.entrance-progress {
    position: relative;
    /* 本家のリング位置(上端261.7 / 下端474.3)に合うサイズ */
    width: 239px;
    height: 239px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 入場チェック画面のGIFインジケーター */
.entrance-progress-gif {
    position: absolute;
    /* GIF の描画サイズは 300px のまま中央寄せする。
       縮めるとリングまで小さくなるため、サイズは変えずに外周を切る。 */
    top: 50%;
    left: 50%;
    /* GIFフレーム(590x458)内のリングは y=46..345（直径299）。
       object-fit:cover では縦が 458 -> G に写るので、
       描画リング直径 = 299/458 x G = 0.6528G。
       本家の直径 212.7px にするには G = 326px。 */
    width: 326px;
    height: 326px;
    transform: translate(-50%, -50%);
    object-fit: cover;
    /* リング中心はフレーム中心より上（195.5/458 = 42.7%）にある。
       クリップ円をボックス中心に置くとリング上部が切れてしまうため、
       リング中心に合わせる。
       半径は全フレームでの描画上の外周 108.0px（オレンジ弧を含む）に
       1pxだけ余白を足した最小値。 */
    clip-path: circle(109px at 50% 42.7%);
    /* GIF の地色は全フレーム (254,252,253) で背景の純白から僅かに外れている。
       最小チャンネル 252 を 255 に持ち上げて背景と同化させる（255/252≒1.012）。
       点線リングは (160,158,161) 程度なので、この倍率では見た目が変わらない。 */
    filter: brightness(1.012);
    z-index: 1;
}

/* 入場チェック画面のスタンプ */
.entrance-stamp-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

/* プレビュー状態: 押し込み中の振動モーション */
.entrance-stamp-container.stamp-preview {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0.3;
    animation: stampVibrate 0.1s linear infinite;
}

/* 確定状態: スタンプ押下完了 */
.entrance-stamp-container.is-stamped {
    transform: translate(-50%, -50%) scale(1) rotate(-15deg);
    opacity: 1;
    animation: none;
}

@keyframes stampVibrate {
    0%   { transform: translate(-50%, -50%) scale(1.15) rotate(0deg); }
    25%  { transform: translate(-49%, -51%) scale(1.15) rotate(2deg); }
    50%  { transform: translate(-51%, -49%) scale(1.15) rotate(-1deg); }
    75%  { transform: translate(-50%, -51%) scale(1.15) rotate(1deg); }
    100% { transform: translate(-50%, -50%) scale(1.15) rotate(-2deg); }
}

.entrance-stamp-image {
    width: 160px;
    height: 160px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

/* 入場チェック画面 オレンジ帯バリエーション（デフォルトは非表示） */
.entrance-orange-band {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom) + 150px);
    height: 90px;
    background: #F59E0B;
    z-index: 9;
}
/* トグルONでオレンジ帯を表示 */
body.variant-orange-band .entrance-orange-band {
    display: block;
}

/* 入場チェック画面 Page Dot */
.entrance-page-dot {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 80px);
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: black;
    border-radius: 50%;
    z-index: 99;
}

/* ロックアイコン */
/* ===== 注意書き（特定チケット / 無断有償譲渡禁止）=====
   本家の実測値（論理px）
     詳細画面   chugaki1.jpeg (393x852): 左14.0 / 幅335.5 / 高38.0 / 下端から86.8
                背景は透明、枠線とテキストは白 α0.75
     入場チェック chugaki2.heic (402x874): 左17.0 / 幅331.3 / 高39.0 / 下端から45.0
                背景は白、枠線 #959394 相当、テキスト #8c8a8d
     共通: 字送り9.6px / 行間6px / 区切りは枠内32.5%の縦破線 */
.ticket-notice {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    z-index: 98;
    /* 表示のみ。下の要素の操作を妨げない */
    pointer-events: none;
}

.ticket-notice-box {
    display: flex;
    border: 1px solid;
}

.ticket-notice-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 9.6px;
    line-height: 1;
    white-space: nowrap;
}

.ticket-notice-left {
    flex: 0 0 32.5%;
    border-right: 1px dashed;
}

.ticket-notice-right {
    flex: 1;
}

/* チケット詳細画面: 暗い背景に重なるため、背景は透明で白い枠線・文字 */
.ticket-notice-detail {
    /* ボトムナビ(高さ57px)の上。本家より上に見えたため10px下げてナビとの間隔14px */
    bottom: calc(env(safe-area-inset-bottom) + 71px);
    padding: 0 44px 0 14px;
}

.ticket-notice-detail .ticket-notice-box {
    height: 38px;
    border-color: rgba(255, 255, 255, 0.75);
    background: transparent;
}

.ticket-notice-detail .ticket-notice-col {
    color: rgba(255, 255, 255, 0.75);
}

.ticket-notice-detail .ticket-notice-left {
    border-right-color: rgba(255, 255, 255, 0.75);
}

/* 入場チェック画面: 白背景。右余白はロックアイコンを避けるため広め */
.ticket-notice-entrance {
    /* 本家は safe + 11px。10px下げて safe area の直上まで寄せている */
    bottom: calc(env(safe-area-inset-bottom) + 1px);
    padding: 0 54px 0 17px;
}

.ticket-notice-entrance .ticket-notice-box {
    height: 39px;
    border-color: #959394;
    background: #fff;
}

.ticket-notice-entrance .ticket-notice-col {
    /* 文字画素の明度分布で、完全被覆(=真の色)が集中する 150〜159 を採用 */
    color: #9b999c;
}

.ticket-notice-entrance .ticket-notice-left {
    border-right-color: #a9a7aa;
}

.entrance-lock-icon {
    position: fixed;
    /* 本家は鍵の中心が注意書きの帯の中心と揃っている。
       帯は bottom:safe+1px / 高さ39px なので中心は safe+20.5px。
       この箱は40px高でアイコンを中央に置くため、箱の下端は中心-20px。 */
    bottom: calc(env(safe-area-inset-bottom) + 0.5px);
    right: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #767676;
    z-index: 10;
}

.entrance-lock-icon .lock-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

/* ================================================
   MyPage Modal
   ================================================ */

.mypage-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    z-index: 2500;
}

.mypage-modal.show {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.mypage-modal.closing {
    display: block;
    animation: fadeOut 0.15s ease-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.mypage-container {
    max-width: 414px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
}

.mypage-header {
    background: #eee;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
}

.mypage-header-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.mypage-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* Plus member ID */
.mypage-id-card {
    display: flex;
    align-items: stretch;
    background: #d9d9d9;
    border-radius: 50px;
    padding: 0;
    margin-bottom: 16px;
}

.mypage-id-label {
    background: #333;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    border-radius: 50px;
    margin-right: 12px;
    white-space: nowrap;
}

.mypage-id-value {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.5px;
    padding: 10px 0;
}

.mypage-id-copy {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 16px 4px 4px;
    margin-left: -8px;
}

/* カード */
.mypage-card {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

/* ユーザー情報 */
.mypage-user-info {
    padding: 16px;
}

.mypage-user-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.mypage-user-email {
    font-size: 14px;
    color: #999;
}

/* メニューアイテム */
.mypage-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
}

.mypage-menu-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mypage-menu-border-top {
    border-top: 1px solid #f0f0f0;
}

.mypage-menu-icon-img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.mypage-external-icon {
    font-size: 12px;
    color: #999;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0 3px;
    line-height: 1.4;
}

.mypage-chevron {
    color: #ccc;
    font-size: 22px;
    font-weight: 300;
}

/* サブ情報（承認済バッジ等） */
.mypage-menu-sub {
    padding: 0 16px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mypage-badge-approved {
    font-size: 12px;
    color: #ff6b35;
    border: 1px solid #ff6b35;
    border-radius: 50px;
    padding: 2px 10px;
}

.mypage-expiry {
    font-size: 12px;
    color: #999;
}

/* セクションタイトル */
.mypage-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

/* ボトムナビ */
.mypage-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    display: flex;
    padding-bottom: calc(1px + env(safe-area-inset-bottom));
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.mypage-nav-btn,
.home-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #767676;
}

.mypage-nav-btn.active,
.home-nav-btn.active {
    color: #ff6b35;
}

.mypage-nav-btn.active .nav-label,
.home-nav-btn.active .nav-label {
    color: #000;
}

.mypage-nav-btn .nav-icon,
.home-nav-btn .nav-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.mypage-nav-btn:nth-child(1) .nav-icon,
.mypage-nav-btn:nth-child(3) .nav-icon,
.home-nav-btn:nth-child(1) .nav-icon,
.home-nav-btn:nth-child(3) .nav-icon {
    width: 20px;
    height: 20px;
}

.mypage-nav-btn .nav-label,
.home-nav-btn .nav-label {
    font-size: 10px;
    font-weight: 400;
}

/* ホーム画面（チケプラ埋め込み） */
.home-view {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    /* ActionBar(ステータスバー背景, z-index:10000)に iframe の上端が隠れるため、
       他画面と同様にセーフエリア分だけ下げる */
    padding-top: env(safe-area-inset-top);
    /* チケット詳細(2000)・入場チェック(2000)・マイページ(2500)より前面に出す */
    z-index: 3000;
    /* display:none だとブラウザによって iframe が再読み込みされ、
       ページ状態が失われるため visibility で隠す */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.home-view.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.home-frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: none;
    background-color: #fff;
}

.home-bottom-nav {
    flex-shrink: 0;
    display: flex;
    width: 100%;
    padding-bottom: calc(1px + env(safe-area-inset-bottom));
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

/* Focus visible styles - 非表示 */
:focus-visible {
    outline: none;
}

button:focus-visible {
    outline: none;
}

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

    .modal-bg-gif,
    .entrance-progress-gif {
        animation: none;
    }
}
