/* 余計な余白計算を排除 */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-color: #d2cbb8;
    --face-color: #fdfaf2;
    --accent-color: #3e2723;
    --disclaimer-color: #7d746d; 
}

html, body {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    position: fixed;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-color);
    font-family: "Georgia", "Times New Roman", "Yu Mincho", "MS PMincho", serif;
}

header {
    padding-top: 15px;
    flex-shrink: 0;
}

.page-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
    letter-spacing: 0.2em;
    font-variant: small-caps;
}

/* 修正の要：aspect-ratio で正方形を強制。
   width を「画面幅の92%」と「利用可能な高さ（70dvh）」の小さい方に合わせることで、
   縦長でも横長でも絶対に潰れない正方形になります。
*/
.clock-container {
    position: relative;
    width: min(92vw, 70dvh); /* 横幅92%か、高さ70%の小さい方に合わせる */
    aspect-ratio: 1 / 1;    /* 強制的に正方形を維持 */
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 変数として時計の現在のサイズを保持（数字のフォントサイズ用） */
.clock-face {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--face-color);
    border: 5px solid var(--accent-color);
    outline: 2px solid var(--accent-color);
    outline-offset: -10px;
    border-radius: 50%;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.1), 0 10px 30px rgba(0,0,0,0.2);
}

.tick-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.tick {
    position: absolute;
    top: 2.5%;
    left: 50%;
    width: 3px;
    height: 15px;
    background-color: var(--accent-color);
    transform: translateX(-50%);
}

.tick.small {
    width: 1px;
    height: 8px;
    opacity: 0.6;
}

.number {
    position: absolute;
    width: 12%;
    height: 12%;
    text-align: center;
    /* 100% は clock-container の横幅（正方形の1辺）基準になる */
    font-size: min(8vw, 6dvh); 
    font-weight: bold;
    color: var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.hand {
    position: absolute;
    top: 50%;
    left: 50%;
    /* 針の長さもコンテナの高さ（正方形の1辺）に対して一定の比率にする */
    height: 45%; 
    width: auto;
    transform-origin: 50% 86.25%; 
    transform: translate(-50%, -86.25%) rotate(0deg);
    z-index: 10;
}

#hour-hand { z-index: 11; }
#minute-hand { z-index: 12; }
#second-hand { z-index: 13; }

.center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4%;
    height: 4%;
    background-color: var(--accent-color);
    border: 2px solid #8d6e63;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
}

footer {
    padding-bottom: 10px;
    width: 95%;
    flex-shrink: 0;
}

.disclaimer {
    margin: 0;
    font-size: 0.6rem;
    color: var(--disclaimer-color);
    text-align: center;
    line-height: 1.4;
}