:root {
    /* 色定義 (グレーと白のみ) */
    --color-gray: #34495e;
    --color-light-gray: #ecf0f1;

    /* タイマー状態変数 (JSから 'hsl(H, S, L)' 形式で直接設定) */
    --timer-color: var(--color-gray);
    --timer-color-alpha: rgba(52, 73, 94, 0.5);
}

/* * 1. 基本レイアウトとリセット 
 */
html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #222; /* デフォルトの背景色 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--color-light-gray);
    
    /* タイマーの視覚領域 (box-shadowで実装) */
    box-sizing: border-box; /* box-shadowが内側に入るように */
    box-shadow: inset 0 0 0 0 var(--timer-color-alpha);
    transition: box-shadow 0.3s ease-out;
}

/* * 2. アニメーション定義 
 */

/* 呼吸アニメーション (タイマー実行中) */
@keyframes breathing {
    0% { box-shadow: inset 0 0 10px 5px var(--timer-color-alpha); }
    50% { box-shadow: inset 0 0 25px 20px var(--timer-color-alpha); }
    100% { box-shadow: inset 0 0 10px 5px var(--timer-color-alpha); }
}

/* 高速な明滅 (flashing) */
@keyframes flashing {
    0%   { box-shadow: inset 0 0  5px  2px var(--timer-color-alpha); }
    50%  { box-shadow: inset 0 0 30px 25px var(--timer-color-alpha); }
    100% { box-shadow: inset 0 0  5px  2px var(--timer-color-alpha); }
}

/* * 3. タイマー状態クラス (bodyに付与) 
 */
body.timer-running {
    animation: breathing 2s infinite ease-in-out;
}
body.timer-paused {
    animation-play-state: paused;
}

body.timer-over {
    animation: flashing 0.2s infinite ease-in-out;
}


/* * 4. PDFビューア (中央配置・マージン狭め)
 */
#pdf-viewer-container {
    position: relative; /* ★ ドロッププロンプトの配置基準 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 98vw;
    height: 98vh;
    max-width: calc(98vh * (16 / 9));
    max-height: calc(98vw * (9 / 16));
    
    aspect-ratio: 16 / 9;
    background: #000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

#pdf-canvas {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* * 5. UIコントロール 
 */

/* ファイル入力 (非表示) */
#fileInput {
    display: none;
}

/* デジタルタイマー表示 */
#timerDisplay {
    position: absolute;
    top: 15px;
    right: 25px;
    z-index: 100;
    font-size: 36px;
    font-weight: 200;
    font-family: "SF Mono", "Consolas", monospace;
    color: var(--color-light-gray);
    opacity: 0.4;
    text-shadow: 0 0 10px #000;
}

/* ローディングスピナー */
#loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--color-gray);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 200;
    display: none;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* * 6. ドラッグ＆ドロップ オーバーレイ
 */

#drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    
    display: none; 
    opacity: 0;
    transition: opacity 0.2s ease-in-out;

    align-items: center;
    justify-content: center;
}

/* ▼ 修正: 日英併記（上下）用にスタイル変更 ▼ */
#drag-overlay-text {
    font-size: 24px;
    color: white;
    padding: 20px 40px;
    border: 3px dashed var(--color-light-gray);
    border-radius: 8px;
    text-align: center;
    line-height: 1.4;
}
.drag-overlay-subtext {
    display: block;
    font-size: 18px;
    margin-top: 5px;
    color: #ccc; /* 明るいグレー */
}
/* ▲ 修正ここまで ▲ */


body.dragging #drag-overlay {
    display: flex;
    opacity: 1;
}

/*
 * * 7. 3秒カウントダウン
 */

#countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 900; 
    
    display: none; 
    opacity: 0;
    
    align-items: center;
    justify-content: center;
    
    font-size: 40vh;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: white;
    text-shadow: 0 0 50px rgba(0, 0, 0, 0.7);

    transition: opacity 0.1s ease-in-out; 
}

@keyframes countdown-glow {
    0%   { box-shadow: inset 0 0 10px 5px rgba(236, 240, 241, 0.2); }
    50%  { box-shadow: inset 0 0 30px 25px rgba(236, 240, 241, 0.7); }
    100% { box-shadow: inset 0 0 10px 5px rgba(236, 240, 241, 0.2); }
}
body.timer-countdown {
    animation: countdown-glow 1s infinite ease-in-out;
}

/*
 * * 8. 設定パネル
 */

#config-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000; 
    
    background-color: rgba(30, 30, 30, 0.95);
    border: 1px solid var(--color-gray);
    border-radius: 8px;
    padding: 20px;
    width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    color: var(--color-light-gray);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

body.show-settings #config-panel {
    display: block;
    opacity: 1;
}

#config-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-gray);
    padding-bottom: 10px;
    line-height: 1.4;
}

/* ▼ 修正: 設定パネル内の英語表記（上下） */
.en-text-config {
    display: block; /* 上下に変更 */
    color: #ccc; /* 明るいグレー */
    font-size: 14px;
    font-weight: normal;
    margin-top: 4px; /* 日本語との間隔 */
}
.en-text-config-label {
    display: block;
    font-size: 12px;
    color: #ccc; /* 明るいグレー */
    margin-top: 2px;
}
/* ▲ 修正ここまで ▲ */


.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.config-row label {
    font-size: 14px;
    line-height: 1.4;
}
.config-row input {
    font-size: 14px;
    width: 60px;
}
.config-row input[type="checkbox"] {
    width: auto;
    height: 18px;
    width: 18px;
}

/*
 * * 9. ドロッププロンプト (PDF未ロード時)
 */
#drop-prompt {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50; 
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #111;
    border-radius: 4px;
    opacity: 1;
    transition: opacity 0.3s ease-out;
    pointer-events: none;
}

/* ▼ 修正: 日英併記（上下）用にレイアウト変更 ▼ */
#drop-prompt-text {
    width: 550px; 
    box-sizing: border-box;
    font-size: 16px;
    color: var(--color-gray); /* (背景色) */
    text-align: left;
    line-height: 1.6;
    border: 3px dashed var(--color-gray);
    padding: 20px 30px 25px 30px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.2);
}

body.pdf-loaded #drop-prompt {
    opacity: 0;
    pointer-events: none;
}

.prompt-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 5px;
    color: var(--color-light-gray);
}
.prompt-subtitle {
    display: block;
    font-size: 16px;
    font-weight: normal;
    color: #ccc; /* 明るいグレー */
    text-align: center;
    margin-bottom: 20px; /* リストとの間隔 */
}

.prompt-controls {
    list-style: none;
    padding: 0;
    margin: 0;
}

.prompt-controls li {
    margin-bottom: 8px;
    color: var(--color-light-gray);
    display: flex;
    align-items: center;
    /* justify-content: space-between;  */
}
.prompt-controls li:last-child {
    margin-bottom: 0;
}

.prompt-controls .key {
    display: inline-block;
    background-color: #333;
    color: var(--color-light-gray);
    border: 1px solid #555;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 14px;
    min-width: 140px; 
    text-align: center;
    margin-right: 15px; /* 説明文とのマージン */
    flex-shrink: 0;
}

.desc {
    text-align: left;
    font-size: 15px;
    line-height: 1.3; /* 行間を詰める */
}

.en-text {
    display: block; /* 上下に変更 */
    font-size: 14px;
    color: #ccc; /* 明るいグレー */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin-top: 2px; /* 日本語との間隔 */
}
/* ▲ 修正ここまで ▲ */