@charset "utf-8";
/* ============================================================
    時間のツール（タイマー・ストップウォッチ・アラーム・時計など）共通
    ============================================================ */

/* ▼ 大きな時間の表示と、まわりの進み具合の輪 */
.timeStage{
    position: relative;
    display: grid;
    place-items: center;
    gap: var(--spaceSm);
    padding: 1.5rem 1rem;
    border-radius: var(--radiusLg);
    background: var(--catSoft);
    text-align: center;
    container-type: inline-size;
}
.timeRingWrap{
    position: relative;
    width: min(100%, 320px);
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
}
.timeRing{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.timeRingTrack{
    fill: none;
    stroke: var(--bgCard);
    stroke-width: 8;
}
.timeRingBar{
    fill: none;
    stroke: var(--catColor);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.29;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.25s linear;
}
.timeDisplay{
    position: relative;
    margin: 0;
    font-family: var(--fontMono);
    font-size: clamp(2.5rem, 13cqw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.02em;
    color: var(--textMain);
    font-variant-numeric: tabular-nums;
}
.timeDisplay.isLong{
    font-size: clamp(2rem, 10cqw, 3.5rem);
}
/* 12時間表示の「午前・午後」 */
.timeDisplay[data-suffix]::after{
    content: attr(data-suffix);
    font-size: 0.35em;
    font-family: var(--fontBase);
}
.timeSub{
    position: relative;
    margin: 0;
    font-size: 0.875rem;
    color: var(--textSub);
    font-variant-numeric: tabular-nums;
}
.timePhase{
    position: relative;
    margin: 0;
    padding: 0.15em 1em;
    border-radius: var(--radiusPill);
    background: var(--bgCard);
    font-weight: 700;
    color: var(--catText);
}
/* くり返しのタイマーの区切りごとの色（休けいは緑、準備は黄色） */
.timeStage[data-kind="rest"]{
    background: var(--successSoft);
}
.timeStage[data-kind="rest"] .timeRingBar{
    stroke: var(--success);
}
.timeStage[data-kind="prepare"]{
    background: var(--highlightSoft);
}
/* 時間になったときの点滅 */
.timeStage.isRinging{
    animation: timeRingingFlash 0.8s ease-in-out infinite alternate;
}
@keyframes timeRingingFlash{
    from{
        background-color: var(--catSoft);
    }
    to{
        background-color: var(--highlight);
    }
}
/* 全画面のとき（全画面に対応しないブラウザは isPseudoFull で画面いっぱいに広げる） */
.timeStage:fullscreen,
.timeStage.isPseudoFull{
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: var(--bgBase);
}
.timeStage.isPseudoFull{
    position: fixed;
    inset: 0;
    z-index: var(--zMenuPanel);
}
.timeStage:fullscreen .timeRingWrap,
.timeStage.isPseudoFull .timeRingWrap{
    width: min(80vmin, 640px);
}
.timeStage:fullscreen .timeDisplay,
.timeStage.isPseudoFull .timeDisplay{
    font-size: min(16vmin, 9rem);
}
.timeStage:fullscreen .timeDisplay.isLong,
.timeStage.isPseudoFull .timeDisplay.isLong{
    font-size: min(12vmin, 7rem);
}
.fullExitBtn{
    display: none;
}
.timeStage:fullscreen .fullExitBtn,
.timeStage.isPseudoFull .fullExitBtn{
    display: inline-flex;
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* ▼ 時間の入力（時・分・秒を横に並べる） */
.timeInputs{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spaceSm);
}
.timeInputs .inputText{
    font-size: 1.25rem;
    text-align: center;
}
.timePresets{
    gap: var(--spaceXs) var(--spaceSm);
}
.presetBtn{
    min-height: 40px;
    padding: 0.35em 1em;
    border-radius: var(--radiusPill);
    border: 2px solid var(--line);
    background: var(--bgCard);
    font-weight: 700;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}
.presetBtn[aria-pressed="true"]{
    border-color: var(--catColor);
    background: var(--catSoft);
    color: var(--catText);
}
@media (hover: hover){
    .presetBtn:hover{
        background: var(--catSoft);
    }
}
.timeControls{
    justify-content: center;
}
.timeControls .btn{
    min-width: 7.5em;
}
.timeSettings{
    padding-top: var(--spaceLg);
    border-top: 2px dashed var(--line);
}

/* ▼ ラップ・履歴の表 */
.lapTable{
    max-height: 22rem;
    overflow-y: auto;
}
.lapTable .isBest td{
    color: var(--success);
    font-weight: 700;
}
.lapTable .isWorst td{
    color: var(--danger);
    font-weight: 700;
}

/* ▼ アラーム・世界時計の一覧 */
.timeList{
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--spaceSm);
}
.timeListItem{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--spaceXs) var(--spaceMd);
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radiusMd);
    background: var(--bgCard);
    border: 2px solid var(--line);
}
.timeListItem.isNight{
    background: var(--bgMuted);
}
.timeListMain{
    min-width: 0;
}
.timeListName{
    margin: 0;
    font-weight: 700;
    line-height: 1.4;
}
.timeListNote{
    margin: 0;
    font-size: 0.8125rem;
    color: var(--textSub);
}
.timeListTime{
    margin: 0;
    font-family: var(--fontMono);
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.timeListActions{
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spaceXs);
}
.iconBtn{
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radiusSm);
    border: 2px solid var(--line);
    background: var(--bgCard);
}
@media (hover: hover){
    .iconBtn:hover{
        background: var(--catSoft);
    }
}

/* ▼ アナログ時計 */
.analogClock{
    position: relative;
    width: min(100%, 360px);
    aspect-ratio: 1 / 1;
}
.analogFace{
    fill: var(--bgCard);
    stroke: var(--catColor);
    stroke-width: 3;
}
.analogTick{
    stroke: var(--textSub);
    stroke-width: 1;
    stroke-linecap: round;
}
.analogTick.isHour{
    stroke: var(--textMain);
    stroke-width: 2.5;
}
.analogNum{
    fill: var(--textMain);
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
}
.analogHand{
    stroke-linecap: round;
    transform-origin: 100px 100px;
}
.analogHour{
    stroke: var(--textMain);
    stroke-width: 5;
}
.analogMinute{
    stroke: var(--textMain);
    stroke-width: 3.5;
}
.analogSecond{
    stroke: var(--accent);
    stroke-width: 1.5;
}
.analogCap{
    fill: var(--accent);
}
/* 時計の色のテーマ */
.clockThemeDark .timeStage,
.timeStage.clockThemeDark{
    background: var(--bgCode);
}
.timeStage.clockThemeDark .timeDisplay,
.timeStage.clockThemeDark .timeSub{
    color: var(--textOnCode);
}
.timeStage.clockThemeDark .analogFace{
    fill: var(--bgCode);
}
.timeStage.clockThemeDark .analogNum{
    fill: var(--textOnCode);
}
.timeStage.clockThemeDark .analogTick.isHour,
.timeStage.clockThemeDark .analogHour,
.timeStage.clockThemeDark .analogMinute{
    stroke: var(--textOnCode);
}

/* ▼ カウントダウン（日・時・分・秒を並べる） */
.countdownGrid{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--spaceSm);
    width: min(100%, 560px);
}
.countdownUnit{
    padding: 0.75rem 0.25rem;
    border-radius: var(--radiusMd);
    background: var(--bgCard);
}
.countdownValue{
    display: block;
    font-family: var(--fontMono);
    font-size: clamp(1.75rem, 8cqw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.countdownLabel{
    font-size: 0.8125rem;
    color: var(--textSub);
}

/* ▼ メトロノームの拍の表示 */
.beatDots{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spaceSm);
}
.beatDot{
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bgCard);
    border: 2px solid var(--lineStrong);
    transition: transform 0.08s ease, background-color 0.08s ease;
}
.beatDot.isActive{
    background: var(--catColor);
    border-color: var(--catColor);
    transform: scale(1.2);
}
.beatDot.isAccent{
    border-width: 4px;
}

@media (prefers-reduced-motion: reduce){
    .timeStage.isRinging{
        animation: none;
        background-color: var(--highlight);
    }
    .timeRingBar,
    .beatDot{
        transition: none;
    }
}

/* ▼ メトロノームの振り子（JSで傾ける。止まっているときはまっすぐ） */
.metroPendulum{
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}
.metroPendulum svg{
    width: 160px;
    height: auto;
}
.metroBody{
    fill: var(--catSoft);
    stroke: var(--catColor);
    stroke-width: 3;
    stroke-linejoin: round;
}
.metroArm{
    transform-box: view-box;
    transform-origin: 100px 128px;
}
.metroRod{
    stroke: var(--catText);
    stroke-width: 4;
    stroke-linecap: round;
}
.metroWeight{
    fill: var(--catColor);
}
.metroPivot{
    fill: var(--catText);
}
