﻿/* とけいあそび */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Zen Maru Gothic', sans-serif;
    touch-action: manipulation;
    user-select: none;
}

body {
    background: linear-gradient(180deg, #E3F2FD 0%, #BBDEFB 100%);
}

#game-container.game-shell > .ui-chrome {
    padding-inline-end: max(4px, env(safe-area-inset-right, 0px));
}

#game-container.game-shell .ui-stats-row.clock-stats {
    min-height: 32px;
}

.stat-pill {
    font-size: clamp(0.75rem, 3.2vmin, 0.88rem);
    font-weight: 800;
    color: #37474f;
    background: rgba(255, 255, 255, 0.95);
    padding: 5px 12px;
    border-radius: 999px;
    border: 2px solid #90caf9;
}

/* ゲーム本体（全体スクロールなし・内部で縦に収める） */
.clock-play {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 6px 10px;
    gap: clamp(4px, 1.2dvh, 8px);
    overflow: hidden;
}

/* 目標デジタル表示 */
.target-panel {
    text-align: center;
    flex-shrink: 0;
}

.target-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #37474f;
    margin-bottom: 2px;
}

.target-digital {
    font-size: clamp(1.75rem, min(9vmin, 12vw), 3rem);
    font-weight: 900;
    color: #0d47a1;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

/* アナログ時計（調整パネルより優先して縦スペースを確保） */
.analog-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
}

.current-digital {
    font-size: clamp(1rem, 4.5vmin, 1.3rem);
    font-weight: 700;
    color: #78909c;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

#clock-svg {
    width: min(100%, 94vw, calc(var(--app-vw, 100vw) * 0.94), 360px);
    max-height: min(44dvh, calc(var(--app-vh, 100dvh) * 0.44), 340px);
    height: auto;
    display: block;
    touch-action: none;
}

.tick-major {
    stroke: #37474f;
    stroke-width: 3;
    stroke-linecap: round;
}

.tick-minor {
    stroke: #90a4ae;
    stroke-width: 1.5;
    stroke-linecap: round;
}

/* 時計盤の時数字（1〜12） */
.clock-hour-num {
    font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
    font-size: 15px;
    font-weight: 800;
    fill: #37474f;
    pointer-events: none;
    user-select: none;
}

/* ±調整パネル（コンパクトにして時計盤を大きく） */
.adjust-panel {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 6px 5px;
    border: 2px solid #90caf9;
}

.adjust-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.adjust-label {
    flex: 1;
    min-width: 0;
    font-weight: 800;
    font-size: 0.72rem;
    color: #455a64;
    line-height: 1.2;
}

.adj-btn {
    width: min(30px, 8vw);
    height: min(28px, 6dvh);
    font-size: 0.92rem;
    font-weight: 900;
    border: none;
    border-radius: 6px;
    background: #42a5f5;
    color: #fff;
    box-shadow: 0 2px 0 #1565c0;
    cursor: pointer;
    font-family: inherit;
}

.adj-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

/* かくにんボタン */
.confirm-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 900;
    border: none;
    border-radius: 16px;
    background: #7cb342;
    color: #fff;
    box-shadow: 0 4px 0 #558b2f;
    cursor: pointer;
}

.confirm-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

.overlay-sub {
    margin: 0 0 14px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #546e7c;
    text-align: center;
}

@media screen and (max-height: 600px) {
    .target-digital { font-size: 1.55rem; }
    #clock-svg {
        width: min(100%, 92vw, calc(var(--app-vw, 100vw) * 0.92), 300px);
        max-height: min(38dvh, 280px);
    }
    .clock-play { padding: 4px 6px 8px; gap: 4px; }
    .adjust-label { font-size: 0.68rem; }
    .adj-btn { width: 28px; height: 26px; font-size: 0.85rem; border-radius: 5px; box-shadow: 0 2px 0 #1565c0; }
    .adjust-panel { padding: 5px 4px; gap: 2px; }
    .confirm-btn { padding: 7px 12px; font-size: 0.92rem; }
}

@media screen and (max-height: 520px) {
    .target-label { font-size: 0.74rem; }
    .current-digital { font-size: 0.85rem; }
    #clock-svg {
        width: min(100%, 90vw, 260px);
        max-height: min(34dvh, 240px);
    }
    .adj-btn { width: 26px; height: 24px; font-size: 0.8rem; border-radius: 5px; }
}
