@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Google+Sans+Flex:opsz,wght@6..144,1..1000&family=Noto+Color+Emoji&family=Noto+Sans+JP:wght@100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

/* ベース設定 */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    overflow: hidden;
    touch-action: none;
    font-family: "Google Sans Flex", "Noto Sans JP", "Noto Color Emoji", sans-serif;
}

#container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* カメラ映像 */
video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* --- UIレイヤー --- */

/* 中央の読み取り枠（ガイドボックス） */
#guide-box {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 85%;
    height: 25%;
    transform: translate(-50%, -50%);
    z-index: 10;

    /* 枠線（初期状態：スキャン中）少し太くしました */
    border: 4px dashed rgba(255, 255, 255, 0.7);
    border-radius: 12px;

    /* 枠の外側を暗くする（スポットライト効果） */
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);

    transition: border-color 0.2s, box-shadow 0.2s, border-width 0.2s;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* 上寄せ */
}

/* スキャン中のバー */
#scan-line {
    position: absolute;
    width: 100%;
    height: 4px;
    /* バーも少し太く */
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
    top: 0;
    left: 0;
    animation: scan 2s infinite linear;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.2s;
}

@keyframes scan {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

/* 結果表示パネル */
#result-panel {
    position: absolute;
    bottom: 100%;
    /* 枠の上に配置 */
    left: 0;
    width: 100%;
    margin-bottom: 16px;
    /* 枠との距離を少し広げました */

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;

    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

/* 判定ラベル (OK / NG) */
.status-badge {
    font-size: 24px;
    font-weight: bold;
    color: white;
    padding: 10px 28px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* 日付表示 */
.date-label {
    font-size: 18px;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 500;
}

/* --- 状態別のスタイル (枠線を太く変更) --- */

/* 期限内 (Safe) */
#guide-box.state-safe {
    border: 8px solid #00E676;
    /* 太さを8pxに増強 */
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 230, 118, 0.3);
}

#guide-box.state-safe #scan-line {
    opacity: 0;
}

#guide-box.state-safe #result-panel {
    opacity: 1;
    transform: translateY(0);
}

#guide-box.state-safe .status-badge {
    background: #00C853;
}

/* 期限切れ (Expired) */
#guide-box.state-expired {
    border: 8px solid #FF1744;
    /* 太さを8pxに増強 */
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 23, 68, 0.3);
}

#guide-box.state-expired #scan-line {
    opacity: 0;
}

#guide-box.state-expired #result-panel {
    opacity: 1;
    transform: translateY(0);
}

#guide-box.state-expired .status-badge {
    background: #D50000;
}

/* 下部のステータスバー (背景を追加) */
#status {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 20;
    color: white;
    font-size: 15px;
    background: rgba(0, 0, 0, 0.7);
    /* 半透明の黒背景を追加 */
    padding: 15px 0;
    /* 上下に余白を追加して読みやすく */
    backdrop-filter: blur(2px);
    /* すりガラス効果 */
}

/* ボタンコンテナの位置決め */
#info-container {
    position: fixed;
    top: 20px;
    /* 画面の上端から20pxの位置 */
    right: 20px;
    /* 画面の右端から20pxの位置 */
    z-index: 201;
    /* 他の要素より手前に表示 */
}

/* リンクの下線を消す */
#info-container a {
    text-decoration: none;

    /* ▼▼ 以下を追加 ▼▼ */
    display: flex;
    /* テキストとアイコンを横並びにする */
    align-items: center;
    /* 上下中央揃えにする */
    flex-direction: row;
    /* HTMLの記述順（テキスト→アイコン）を反転させ、アイコンが右に来るようにする */
    color: white;
    /* リンク内のテキスト（アンケート）を白にする */
    font-weight: bold;
    gap: 4px;
    /* テキストとアイコンの間に少し隙間を空ける */

    /* アイコンに合わせてテキストにも影をつけ、視認性を高めます（任意） */
    text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5);
}

/* アイコンのスタイル */
#info-container .material-symbols-outlined {
    color: white;
    font-size: 24px;
    /* アイコンの大きさを指定 */
    /* カメラ映像が明るい場合でも見やすいように、少しだけ影をつける（任意） */
    text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5);
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24 !important;
}

/* マウスホバー時に少し透明にする（任意） */
#info-container a:hover {
    opacity: 0.8;
}