/* --- Components --- */

.btn-text {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* --- History / Calendar --- */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 10px;
}

.calendar-container {
    background: #111;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #333;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    color: #888;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 5px;
    position: relative;
    font-size: 1.1rem;
    color: #fff;
}

.calendar-day:hover {
    background: #222;
}

.calendar-day.today {
    border: 1px solid var(--color-cyan);
}

.calendar-day.selected {
    background: #333;
    border: 1px solid var(--color-yellow);
    color: var(--color-yellow);
    font-weight: bold;
}

.calendar-day.has-data::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--color-yellow);
    border-radius: 50%;
    margin-top: 2px;
}

.calendar-day.other-month {
    opacity: 0.3;
    pointer-events: none;
}

/* History List Item */
.history-item {
    background: #222;
    border-left: 4px solid var(--color-cyan);
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.history-time {
    font-size: 1.2rem;
    color: var(--color-yellow);
    font-weight: bold;
    min-width: 60px;
}

.history-info-box {
    flex-grow: 1;
    margin-left: 10px;
    margin-right: 10px;
    overflow: hidden;
}

.history-title-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-detail-text {
    color: #aaa;
    font-size: 0.85rem;
    margin-top: 3px;
}

/* --- UIパーツ：メインボタン --- */
.btn {
    border: none;
    padding: 15px 30px;
    font-size: 1.5rem;
    font-family: var(--font-sport);
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%);
    margin: 10px auto;
    width: 90%;
    display: block;
}

/* --- UIパーツ：リスト内ボタン --- */
.btn-list {
    border: none;
    padding: 5px 15px;
    font-size: 1.1rem;
    font-family: var(--font-sport);
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%);
    margin: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    width: 50px;
    height: 34px;
    padding: 0;
    margin-left: 5px;
}

/* ドラッグハンドル */
.drag-handle {
    font-size: 1.8rem;
    color: #666;
    margin: 0 5px 0 0;
    cursor: grab;
    line-height: 1;
    display: flex;
    align-items: center;
    touch-action: none;
}

.drag-handle:active {
    cursor: grabbing;
    color: var(--color-yellow);
}

/* SortableJS */
.sortable-ghost {
    opacity: 0.4;
    background: var(--color-yellow);
}

/* カラーバリエーション */
.btn-yellow {
    background-color: var(--color-yellow);
    color: #000;
}

.btn-cyan {
    background-color: var(--color-cyan);
    color: #000;
}

.btn-white {
    background-color: var(--color-white);
    color: #000;
}

.btn-red {
    background-color: var(--color-red);
    color: #fff;
}

.btn-small {
    font-size: 1rem;
    padding: 10px 20px;
    width: auto;
    display: inline-block;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 5px;
}

.form-group label {
    display: block;
    color: var(--color-cyan);
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.time-input-group {
    display: flex;
    gap: 5px;
    align-items: center;
}

input[type="number"],
input[type="text"] {
    padding: 8px;
    background: #333;
    border: 1px solid var(--color-yellow);
    color: var(--color-yellow);
    font-size: 1.1rem;
    font-family: var(--font-sport);
    text-align: center;
    box-sizing: border-box;
}

input[type="text"] {
    width: 100%;
    text-align: left;
}

input[type="number"] {
    width: 50px;
    cursor: pointer;
    caret-color: transparent;
}

/* メニュー追加プール */
.menu-pool-container {
    border: 1px solid var(--color-yellow);
    padding: 15px;
    margin-top: 20px;
    border-radius: 4px;
}

.pool-title {
    color: var(--color-yellow);
    font-weight: bold;
    margin: 0 0 15px 0;
    text-align: left;
}

#menu-pool-list .btn-list.btn-yellow {
    font-size: 1.2rem;
    line-height: 1;
    width: 50px;
    height: 34px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* リストアイテム */
.saved-menu-item,
.exercise-item {
    background: #222;
    border-left: 4px solid var(--color-yellow);
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    min-height: 50px;
}

.saved-menu-info,
.exercise-info {
    font-size: 1rem;
    flex-grow: 1;
    min-width: 0;
    margin-right: 10px;
}

.saved-menu-info strong,
.exercise-info strong {
    color: var(--color-yellow);
    display: block;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-menu-info span,
.exercise-detail {
    font-size: 0.8rem;
    color: #aaa;
    display: block;
}


/* --- アコーディオン --- */
.acc-item {
    background: #000;
    border: 1px solid #333;
    margin-bottom: 10px;
    text-align: left;
}

.acc-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #000;
}

.acc-title {
    color: var(--color-yellow);
    font-weight: bold;
    font-size: 1.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.acc-sub {
    color: #888;
    font-size: 0.9rem;
    margin-top: 5px;
}

.acc-icon {
    color: var(--color-cyan);
    font-size: 0.8rem;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.acc-item.open .acc-icon {
    transform: rotate(180deg);
}

.acc-body {
    display: none;
    padding: 20px 15px;
    background: #000;
    border-top: 1px solid #222;
}

.acc-item.open .acc-body {
    display: block;
}

.acc-summary {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    color: var(--color-cyan);
    font-weight: bold;
    font-size: 1rem;
}

.acc-summary span .val {
    color: #fff;
    margin-left: 3px;
}

.acc-exercise-card {
    background: #222;
    border-left: 5px solid var(--color-yellow);
    padding: 12px 15px;
    margin-bottom: 8px;
    text-align: left;
}

.acc-ex-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-yellow);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acc-ex-detail {
    font-size: 0.85rem;
    color: #aaa;
}

/* タイマー画面アイテム */
#round-display {
    color: var(--color-cyan);
    font-size: 1.5rem;
    margin-top: 10px;
    flex-shrink: 0;
}

.phase-banner {
    font-size: 3.5rem;
    font-weight: bold;
    margin: 10px 0;
    text-transform: uppercase;
    color: var(--color-yellow);
    text-shadow: 0 0 15px currentColor;
}

#main-timer-display {
    font-size: 9.5rem;
    font-weight: bold;
    color: var(--color-yellow);
    text-shadow: 0 0 20px var(--color-yellow);
    line-height: 1;
    margin: 10px 0;
    font-variant-numeric: tabular-nums;
}

#current-exercise-name {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

#next-phase-display {
    color: var(--color-cyan);
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.timer-controls .btn {
    width: 45%;
    font-size: 1.2rem;
    padding: 15px 10px;
    margin: 0;
}

/* ピッカーモーダル */
#picker-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 300;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
}

#picker-modal.active {
    display: flex;
}

.picker-content {
    background: #111;
    border: 2px solid var(--color-yellow);
    padding: 20px;
    text-align: center;
    border-radius: 20px;
    width: 100%;
    max-width: 350px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.picker-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: center;
}

.picker-title {
    color: var(--color-cyan);
    font-weight: bold;
    font-size: 1.2rem;
}

.picker-btn-close {
    background: none;
    border: 1px solid #444;
    color: #aaa;
    padding: 5px 15px;
    cursor: pointer;
}

.picker-btn-ok {
    background: var(--color-yellow);
    border: none;
    color: #000;
    padding: 5px 20px;
    font-weight: bold;
    cursor: pointer;
}

.picker-columns {
    display: flex;
    justify-content: center;
    height: var(--picker-height);
    position: relative;
    background: #000;
    overflow: hidden;
    border-radius: 10px;
    margin-top: 10px;
}

.picker-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: var(--item-height);
    margin-top: calc(var(--item-height) / -2);
    background: rgba(223, 255, 0, 0.2);
    border-top: 1px solid var(--color-yellow);
    border-bottom: 1px solid var(--color-yellow);
    pointer-events: none;
    z-index: 10;
}

.picker-col {
    flex: 1;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    text-align: center;
    padding: 0;
    position: relative;
    z-index: 20;
    scrollbar-width: none;
}

.picker-col::-webkit-scrollbar {
    display: none;
}

.picker-col-spacer {
    height: calc((var(--picker-height) - var(--item-height)) / 2);
}

.picker-item {
    height: var(--item-height);
    line-height: var(--item-height);
    font-size: 1.5rem;
    color: #666;
    scroll-snap-align: center;
    transition: color 0.2s;
}

.picker-item.selected {
    color: var(--color-yellow);
    font-weight: bold;
    font-size: 1.8rem;
}

.picker-label {
    font-size: 0.9rem;
    color: var(--color-cyan);
    line-height: var(--picker-height);
    width: 40px;
}

/* メッセージ用カスタムモーダル */
#message-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 400;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    padding: 20px;
    box-sizing: border-box;
}

#message-modal.active {
    display: flex;
}

.message-content {
    background: #111;
    border: 2px solid var(--color-yellow);
    padding: 30px 20px;
    text-align: center;
    border-radius: 15px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

#message-text {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 30px;
    line-height: 1.5;
    font-weight: bold;
}

#message-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.msg-btn {
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-family: var(--font-sport);
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    min-width: 100px;
}

.msg-btn-ok {
    background: var(--color-yellow);
    color: #000;
}

.msg-btn-cancel {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}