#app-container {
    width: 100%;
    max-width: 414px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    background-color: var(--color-bg);
    background-image: repeating-linear-gradient(45deg, #111 0px, #111 2px, #0a0a0a 2px, #0a0a0a 4px);
    color: var(--color-text);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
}

/* 汎用クラス: 1行省略 (...) */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ビュー共通設定 */
.view {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px;
    padding-bottom: 20px;
    box-sizing: border-box;
    text-align: center;
}

.view.active {
    display: flex;
}

/* 設定画面（レイヤー表示） */
.settings-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    background: var(--color-bg);
    background-image: repeating-linear-gradient(45deg, #111 0px, #111 2px, #0a0a0a 2px, #0a0a0a 4px);
    padding: 0;
    width: 100%;
    height: 100%;
}

.settings-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    min-height: 80px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);

    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: calc(30px + env(safe-area-inset-top));
    padding-bottom: 10px;
    padding-left: 20px;
    padding-right: 20px;
    z-index: 110;
    border-bottom: none;
    box-sizing: border-box;
    position: relative;
}

.header-content {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
}

.header-title {
    color: var(--color-yellow);
    margin: 0;
    font-size: 2.5rem;
    text-transform: uppercase;
    text-align: center;
    max-width: 70%;
    line-height: 1;
}

.settings-body {
    padding: 20px;
    padding-top: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* --- ホーム画面 --- */
#home-view {
    min-height: 100%;
}

.home-header {
    width: 100%;
    margin-top: 30px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 50px;
    flex-shrink: 0;
}

h1.main-title {
    color: var(--color-yellow);
    font-size: 2.5rem;
    background: transparent;
    margin: 0;
    padding: 0;
    text-transform: uppercase;
    line-height: 1;
}

#menu-btn-top {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--color-yellow);
    cursor: pointer;
    z-index: 60;
    line-height: 1;
}

/* ホーム画面の情報表示エリア */
#current-menu-display {
    color: var(--color-yellow);
    font-size: 2rem;
    margin-bottom: 5px;
    min-height: 2rem;
    text-align: center;
    max-width: 100%;
}

#program-info-area {
    text-align: left;
    margin-bottom: 15px;
    color: var(--color-cyan);
    font-weight: bold;
}

/* サイドメニュー */
#side-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: none;
}

#side-menu-overlay.active {
    display: block;
}

#side-menu {
    position: absolute;
    top: 0;
    right: -80%;
    width: 70%;
    height: 100%;
    background: #000;
    z-index: 201;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    border-left: 1px solid #333;
}

#side-menu.active {
    right: 0;
}

.side-menu-header {
    padding: 30px 20px 20px;
    font-size: 1.5rem;
    color: var(--color-yellow);
    font-weight: bold;
    text-align: left;
    border-bottom: 1px solid #333;
}

.side-menu-item {
    padding: 20px;
    font-size: 1.2rem;
    color: #fff;
    border-bottom: 1px solid #222;
    text-align: left;
    cursor: pointer;
}

.side-menu-item:active {
    background: #222;
}

/* 見出しスタイル */
.section-title {
    color: var(--color-cyan);
    font-size: 1.2rem;
    margin: 25px 0 10px 0;
    text-align: left;
    font-weight: bold;
    text-transform: uppercase;
}

/* リスト設定 */
#exercise-list-container,
#summary-list-container,
#saved-menus-list,
#home-list-container,
#saved-progs-list,
#program-comp-list,
#menu-pool-list {
    flex-grow: 0;
    overflow: visible;
    height: auto;
    margin-bottom: 10px;
    border-top: 1px solid #333;
    padding-top: 10px;
}

#home-list-container {
    border-top: none;
    padding-top: 0;
}

#history-list-container {
    flex-grow: 0;
    overflow: visible;
    height: auto;
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: none;
}

/* タイマー画面 */
#timer-view {
    justify-content: space-between;
    overflow: hidden;
    padding-top: 20px;
}

#timer-content {
    margin-top: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.timer-controls {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 20px;
    flex-shrink: 0;
}

hr.divider {
    border: 0;
    border-top: 1px solid #444;
    margin: 20px 0;
}

#home-footer {
    margin-top: auto;
    padding-bottom: 30px;
    width: 100%;
    flex-shrink: 0;
}