* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    color: #333;
    line-height: 1.6;
}

/* --- macOS Safari風バーのスタイル修正 --- */
.macos-window-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    /* Safariの厚みに合わせて微調整 */
    background: rgba(246, 246, 246, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
}

.macos-buttons {
    display: flex;
    gap: 8px;
    width: 220px;
}

.macos-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    border: 0.5px solid rgba(0, 0, 0, 0.05);
}

.macos-btn.close {
    background: #ff5f57;
}

.macos-btn.minimize {
    background: #ffbd2e;
}

.macos-btn.maximize {
    background: #28c840;
}

/* ホバー時にmac標準のアイコンを表示 */
.macos-buttons:hover .macos-btn::after {
    font-size: 9px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.macos-btn.close:hover::after {
    content: "✕";
}

.macos-btn.minimize:hover::after {
    content: "−";
}

.macos-btn.maximize:hover::after {
    content: "↔";
}

.macos-title-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.macos-address-bar {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    padding: 5px 20px;
    width: 100%;
    max-width: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #333;
}

.lock-icon {
    margin-right: 6px;
    opacity: 0.5;
    font-size: 10px;
}

.macos-actions-spacer {
    width: 220px;
}

/* 右側のスペーサー（レイアウトバランス用） */
.spacer {
    width: 52px;
}

/* メインコンテンツエリア */
.page-wrapper {
    padding: 2em;
    min-height: calc(100vh - 40px);
    margin-top: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.glass-container {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 3em 2.5em;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
    text-align: center;
    transition: background 0.8s ease;
}

.glass-container>div {
    margin: 1em 0;
    text-align: center;
    color: white;
    font-weight: 500;
}

/* タイマー表示 */
#timer {
    font-size: 5em;
    margin: 0.5em 0;
    font-weight: bold;
    color: white;
    font-family: 'Courier New', Courier, monospace;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(255, 255, 255, 0.4);
    text-align: center;
    animation: float-3d 4s ease-in-out infinite;
    transform-style: preserve-3d;
    perspective: 1000px;
}

#timer span {
    display: inline-block;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

#timer span:nth-child(1) {
    animation-name: float-digit-1;
    animation-duration: 3.2s;
    animation-delay: 0s;
}

#timer span:nth-child(2) {
    animation-name: float-digit-2;
    animation-duration: 2.8s;
    animation-delay: 0.15s;
}

#timer span:nth-child(3) {
    animation-name: float-digit-3;
    animation-duration: 3.5s;
    animation-delay: 0.3s;
}

#timer span:nth-child(4) {
    animation-name: float-digit-4;
    animation-duration: 2.6s;
    animation-delay: 0.45s;
}

#timer span:nth-child(5) {
    animation-name: float-digit-5;
    animation-duration: 3.1s;
    animation-delay: 0.6s;
}

/* ステータス表示 */
.status {
    font-size: 1.8em;
    font-weight: bold;
    margin: 1em 0;
    transition: color 0.3s;
    font-family: 'Courier New', Courier, monospace;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    color: white;
    text-align: center;
    animation: pulse 2s ease-in-out infinite;
}

/* 入力フィールド */
input[type="number"] {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 0.5em;
    width: 70px;
    text-align: center;
    color: #1d1d1f;
    font-size: 1em;
    font-weight: 500;
    margin: 0 0.3em;
}

input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* ボタン */
button {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 0.8em 1.5em;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-size: 1.2em;
    margin: 0.5em;
}

button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

/* アニメーション定義 */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes float-digit-1 {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    20% {
        transform: translateY(-6px) rotate(1deg);
    }

    40% {
        transform: translateY(-3px) rotate(-0.5deg);
    }

    60% {
        transform: translateY(-8px) rotate(0.5deg);
    }

    80% {
        transform: translateY(-2px) rotate(-1deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

@keyframes float-digit-2 {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    25% {
        transform: translateY(-10px) rotate(-1deg);
    }

    50% {
        transform: translateY(-5px) rotate(0.5deg);
    }

    75% {
        transform: translateY(-12px) rotate(-0.5deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

@keyframes float-digit-3 {
    0% {
        transform: translateY(0px) scale(1);
    }

    30% {
        transform: translateY(-4px) scale(1.05);
    }

    60% {
        transform: translateY(-7px) scale(0.98);
    }

    85% {
        transform: translateY(-3px) scale(1.02);
    }

    100% {
        transform: translateY(0px) scale(1);
    }
}

@keyframes float-digit-4 {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    15% {
        transform: translateY(-9px) rotate(1.5deg);
    }

    45% {
        transform: translateY(-4px) rotate(-1deg);
    }

    70% {
        transform: translateY(-11px) rotate(0.5deg);
    }

    90% {
        transform: translateY(-2px) rotate(-0.5deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

@keyframes float-digit-5 {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    22% {
        transform: translateY(-7px) rotate(-1.5deg);
    }

    48% {
        transform: translateY(-13px) rotate(1deg);
    }

    72% {
        transform: translateY(-5px) rotate(-0.5deg);
    }

    88% {
        transform: translateY(-9px) rotate(0.5deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}