/* @font-face でローカルフォントを登録する */
/* style.css からの相対パスで fonts フォルダを指定する */
@font-face {
    font-family: 'Upheaval';          /* CSS内で使う名前を定義する */
    src: url('fonts/upheavtt.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* 全体レイアウト */
body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f5;
    font-family: 'Ultra', sans-serif;
}

/* スタート画面 全体 */
#start {
    display: flex;
    flex-direction: column;
    width: 1000px;
    height: 80vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* スタート画面 上部タイトルエリア */
#start-top {
    background: #1e1e10;
    padding: 2.5rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* タイトル文字 */
#start-title {
    font-size: 28px;
    font-weight: bold;
    color: #d4a020;
    letter-spacing: 6px;
    font-family: 'Orbitron', sans-serif;
}

/* サブタイトル文字 */
#start-sub {
    font-size: 11px;
    color: #7a7a40;
    letter-spacing: 3px;
    font-family: 'Roboto Mono', monospace;
}

/* スタート画面 中部イラストエリア */
#start-illust-area {
    flex: 1;
    background: #111827;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* スタート画面 イラスト画像 */
#start-illust { width: 100%; height: 100%; object-fit: cover; }
/* スタート画面 下部ボタンエリア */
#start-bottom {
    background: #1e1e10;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* STARTボタン */
#start-btn {
    width: 100%;
    padding: 16px;
    background: #d4a020;
    color: #1e1e10;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 3px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

#start-btn:hover { background: #b08010; }
#start-btn:active { transform: scale(0.97); }

/* ヒントテキスト */
#start-hint {
    font-size: 11px;
    color: #7a7a40;
    font-family: 'Roboto Mono', monospace;
    letter-spacing: 1px;
}

/* ゲーム画面 / 結果画面 */
#game,
#result {
    display: none;
    flex-direction: column;
    text-align: center;
    background: #ffffff;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    width: 900px;
    transition: all 0.3s ease;
    height: 80vh;
    overflow: hidden;
}

/* イラストエリア */
#illust-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

#illust { width: 100%; height: 100%; object-fit: cover; }

#input-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#reading {
    font-family: 'DotGothic16', sans-serif;
    font-size: 24px;
    margin-bottom: 10px;
    color: #ff9800;
}

#words { font-size: 18px; color: #666; margin-bottom: 20px; }

#word {
    font-family: 'Upheaval', cursive;
    font-size: 72px;
    letter-spacing: 3px;
    margin-bottom: 20px;
}

#input {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

p {
    margin: 8px 0;
    font-family: 'Noto Sans JP', sans-serif;
}

#time { font-family: 'Roboto Mono', monospace; font-weight: 700; }
#miss { font-family: 'Roboto Mono', monospace; font-weight: 700; }

/* 結果画面 イラストエリア */
#result-illust-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

#result-illust {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 結果画面 コンテンツエリア */
#result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #fffdf7;
    /* コースター img を絶対配置するための基準にする */
    position: relative;
}

/* コースター画像 */
/* result-content の中央に絶対配置して重ねる */
#coaster {
    width: 200px;                              /* 表示サイズ 100px */
    height: 200px;
    object-fit: contain;                       /* 縦横比を保ちながら収める */
    position: absolute;                        /* result-content を基準に配置する */
    top: 50%;                                  /* 縦中央に配置する */
    left: 30%;                                 /* 横中央に配置する */
    /* 初期状態: 中央寄せ + scale(0) で非表示にする */
    /* rotateを追加して斜めに表示                  */
    transform: translate(-50%, -50%) rotate(-25deg) scale(0);
    opacity: 0;
    z-index: 10;                               /* カップより手前に表示する */
    pointer-events: none;                      /* クリックイベントを無効にする */
}

/* スタンプ押し込みアニメーション */
/* scale(3) で大きい状態から scale(1) に縮みながら押し付けられるイメージ */
@keyframes stampDown {
    0%   { transform: translate(-50%, -50%) rotate(-25deg) scale(3);    opacity: 0;   }
    40%  { transform: translate(-50%, -50%) rotate(-25deg) scale(0.92); opacity: 1;   }
    60%  { transform: translate(-50%, -50%) rotate(-25deg) scale(1.04); opacity: 1;   }
    80%  { transform: translate(-50%, -50%) rotate(-25deg) scale(0.98); opacity: 1;   }
    100% { transform: translate(-50%, -50%) rotate(-25deg) scale(1);    opacity: 0.9; }
}

/* stamp-active クラスが付いた時にアニメーションを開始する */
#coaster.stamp-active {
    animation: stampDown 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

#result h2 {
    margin-bottom: 20px;
    font-size: 40px;
    font-family: 'Yomogi', sans-serif;
}

#result p {
    font-size: 18px;
    font-family: 'Yomogi', sans-serif;
}

/* カップ本体 */
#cup {
    width: 180px;
    background: #fffdf7;
    border: 1.5px solid #d4b896;
    border-radius: 8px 8px 18px 18px;
    padding: 14px 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    box-shadow: 2px 3px 0 #e8d5b7;
}

/* カップ上部の波線装飾 */
#cup::before {
    content: '';
    display: block;
    width: 100%;
    height: 8px;
    background: repeating-linear-gradient(
        90deg,
        #d4b896 0, #d4b896 4px,
        transparent 4px, transparent 8px
    );
    position: absolute;
    top: -1px;
    left: 0;
    border-radius: 8px 8px 0 0;
}

/* カップロゴ */
#cup-logo {
    font-size: 10px;
    letter-spacing: 3px;
    color: #a07850;
    margin-bottom: 10px;
    margin-top: 6px;
    font-family: 'Upheaval', monospace;
}

/* 区切り線 */
.cup-divider {
    width: 100%;
    border: none;
    border-top: 1px dashed #d4b896;
    margin: 6px 0;
}

/* 項目名 */
.cup-key {
    font-size: 12px;
    color: #a07850;
    letter-spacing: 2px;
    font-family: 'Upheaval', monospace;
}

/* 数値 */
.cup-val {
    font-size: 22px;
    color: #3d2b1a;
    font-family: 'Yomogi', sans-serif;
    line-height: 1.1;
}

.cup-val.big { font-size: 26px; }

/* SPEED の単位 */
.cup-unit {
    font-size: 12px;
    color: #a07850;
    margin-left: 4px;
}

/* スタンプ風マーク */
#cup-stamp {
    margin-top: 10px;
    width: 44px;
    height: 44px;
    border: 2px solid #c8a06a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #c8a06a;
    letter-spacing: 1px;
    font-family: 'Upheaval', monospace;
    opacity: 0.7;
    text-align: center;
    line-height: 1.3;
}

/* カップ底 */
#cup-bottom {
    width: 110px;
    height: 6px;
    background: #d4b896;
    border-radius: 0 0 6px 6px;
    margin-top: -2px;
}

/* 再スタートヒント */
#result-restart {
    font-size: 13px;
    color: #a07850;
    margin-top: 14px;
    font-family: 'Yomogi', sans-serif;
}

/* チェックボックス 外枠 */
.cb {
    width: 14px;
    height: 14px;
    border: 1.5px solid #c8a06a;
    border-radius: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fffdf7;
}

/* チェックマークの線（初期状態は非表示） */
.check-line {
    stroke-dasharray: 15;       /* チェックマークの線の長さ */
    stroke-dashoffset: 15;      /* 初期状態は線をオフセットして非表示にする */
    transition: none;
}

/* checked クラスがついた時に線が描画されるアニメーションを開始する */
.cb.checked .check-line {
    stroke-dashoffset: 0;       /* オフセットを0にして線全体を表示する */
    transition: stroke-dashoffset 0.4s ease;
}

/* 各項目の行レイアウト */
.cup-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
}

/* 項目情報エリア */
.cup-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* タイマーバー 外枠 */
#timer-bar-container {
    width: 100%;
    height: 16px;
    background-color: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

/* タイマーバー 本体 */
#timer-bar {
    height: 100%;
    width: 100%;
    background-color: #ff9800;
    border-radius: 8px;
    transition: width 0.9s linear, background-color 0.9s linear;
}

/* 色分けUI */
.correct { color: #ff9800; font-weight: bold; }

/* 2段表示: 18文字超の単語を2行に分割する */
.word-line {
    display: block;       /* 各行をブロック要素にして改行する */
    text-align: center;   /* 各行を中央揃えにする */
    line-height: 1.4;     /* 行間を調整する */
}

.current { text-decoration: underline; }
.current-position { color: #aaa; text-decoration: underline; }
.pending { color: #aaa; }
.miss-effect { color: red; }

#result-correct,
#result-miss,
#result-combo,
#result-speed {
    font-family: 'Yomogi', sans-serif;
    font-weight: 700;
}
