/* LINE Seed JP (代替として Noto Sans JP をメインにしつつ、フォントスタックを指定) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

:root {
    --base-mint: #78FFCD;
    --navy: #5477B3;
    --cream: #FFFCF7;
    --black: #333333;
    --gray: #e0e0e0;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body { 
    background-color: #000; 
    color: #fff; 
    margin: 0; 
    overflow: hidden; /* スクロールを完全に禁止 */
    font-family: "LINE Seed JP", "Noto Sans JP", sans-serif; 
    height: 100dvh; /* スマホのアドレスバー変動に対応した100%高さ */
    width: 100vw;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    flex-direction: column;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background-color: #000;
}

.screen.active {
    display: flex;
}

/* --- ヘッダー --- */
.header {
    background-color: transparent;
    padding: 20px 15px 10px; /* 余白を微調整 */
    text-align: center;
    flex-shrink: 0;
}

.header h1 {
    margin: 0;
    font-size: 1.8rem; /* 1画面に収めるため少しサイズ調整 */
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.15em;
}

/* --- コンテンツエリア --- */
.content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* 要素を上下に均等に分散配置 */
    overflow: hidden; /* スクロール機能を削除 */
}

.content.central {
    justify-content: center;
    align-items: center;
}

.section-label {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}

.setting-section {
    margin-bottom: 10px; /* 余白を詰める */
}

/* --- ボタンデザイン --- */
.pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.square-btn {
    aspect-ratio: 1 / 1;
    background-color: #fff;
    border: none;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #000;
}

.square-btn.active {
    background-color: var(--base-mint);
    color: #000;
}

.square-btn .label {
    font-size: 0.9rem;
    font-weight: 700;
}

.count-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.tall-btn {
    height: 60px; /* 1画面に収めるため高さを調整 */
    background-color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #000;
}

.tall-btn.active {
    background-color: var(--base-mint);
    color: #000;
}

/* --- メインアクション --- */
.main-action {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    flex: 1; /* 空きスペースを埋める */
}

.start-btn {
    width: 25vh; /* 画面の高さに応じて縮小 */
    height: 25vh;
    max-width: 180px;
    max-height: 180px;
    border-radius: 50%;
    background-color: var(--base-mint);
    border: none;
    font-size: 1.6rem;
    font-weight: 700;
    color: #000;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    transition: transform 0.1s;
    margin-bottom: 0; /* マージンをリセット */
}

.start-btn:active {
    transform: scale(0.95);
}

/* --- タブバー (下部ヘッダー) --- */
.tab-bar {
    position: relative; /* fixedから変更して物理的に被らないようにする */
    width: 100%;
    height: 70px;
    background-color: #000;
    display: flex;
    border-top: 1px solid #333;
    z-index: 100;
    flex-shrink: 0;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
}

.tab-item.active .tab-label {
    color: var(--base-mint);
    font-weight: 700;
}

.tab-label {
    font-size: 0.8rem;
    color: #fff;
}

/* --- 目標設定画面・リハビリ実行画面等の他スタイルは維持 --- */
.progress-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-text {
    position: absolute;
    font-size: 3.5rem;
    font-weight: 700;
}

.goal-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80%;
}

.action-btn {
    padding: 15px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
}

.mint-btn {
    background-color: var(--base-mint);
    color: black;
}

.back-btn {
    background-color: var(--gray);
    color: var(--black);
}

#screen-exec {
    background-color: black;
}

#info-panel {
    position: absolute;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 10px;
    z-index: 20;
    color: white;
}

.info-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 10px;
}

.info-item {
    text-align: center;
}

.info-label {
    font-size: 0.7rem;
}

.info-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.camera-container {
    flex: 1;
    position: relative;
}

#outputCanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#finger-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 15px;
    border-radius: 10px;
    margin: 0 10px;
}

#finger-visualizer {
    font-family: monospace;
    font-size: 1.6rem;
    color: #00FF00;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    max-width: 250px;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
}

#finger-labels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    max-width: 250px;
    font-size: 0.75rem;
    color: #fff;
    margin-top: 2px;
}

.floating-back-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 35px;
    border-radius: 25px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
    font-weight: bold;
    font-size: 1rem;
    z-index: 30;
    backdrop-filter: blur(4px);
}

#celebration-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    z-index: 1000;
    display: none;
    color: var(--navy);
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#splash-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}