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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', Arial, sans-serif;
    background: #348CA0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    padding: 1rem;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    color: #333;
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
}

.timer-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: stretch;
}

.timer-container {
    background: #fff;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    display: grid;
    align-items: center;
    gap: 1rem;
    min-height: 350px;
}

.timer-container h2 {
    color: #555;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 400;
}

.display {
    background: #1a1a1a;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 3rem;
    font-weight: bold;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.3);
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 60px;
}

.input-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 0;
}

/* 與倒數卡片的 輸入列＋提示列 等高，讓三張卡片的顯示器對齊 */
.input-placeholder {
    height: 60px;
}
.input-placeholder::after {
    content: "";
    display: block;
    min-height: 1.2em;
}

.date-display {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    background: rgba(52, 140, 160, 0.1);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.date-display span {
    color: #348CA0;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.countdown-input input {
    width: 4.5rem;
    min-width: calc(3ch + 1.5rem);
    padding: 0.5rem 0.25rem;
    -moz-appearance: textfield;
    appearance: textfield;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.countdown-input input::-webkit-outer-spin-button,
.countdown-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.countdown-input input:focus {
    outline: none;
    border-color: #348CA0;
}

.countdown-input span {
    font-size: 1.5rem;
    font-weight: bold;
    color: #666;
}

.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    min-width: 120px;
    height: 44px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-start {
    background: linear-gradient(45deg, #2E7D32, #1B5E20);
    color: white;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-pause {
    background: linear-gradient(45deg, #B45309, #92400E);
    color: white;
}

.btn-pause:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

.btn-reset {
    background: linear-gradient(45deg, #C62828, #B71C1C);
    color: white;
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 停用的暫停鍵：灰階＋虛線外框，不只靠透明度區別 */
.btn[aria-disabled="true"] {
    background: #555;
    color: #bbb;
    outline: 2px dashed #888;
    outline-offset: -4px;
    box-shadow: none;
}

.hint {
    min-height: 1.2em;
    line-height: 1.2;
    font-size: 0.85rem;
    color: #ffb74d;
    text-align: center;
}

/* 大平板尺寸 */
@media (max-width: 1400px) {
    .container {
        max-width: 1200px;
        padding: 1.8rem;
    }
    
    .timer-section {
        gap: 1.5rem;
    }
}

/* 平板尺寸 */
@media (max-width: 1024px) {
    .container {
        max-width: 900px;
        padding: 1.8rem;
    }
    
    .timer-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .display {
        font-size: 2.5rem;
    }
}

/* 手機橫向 */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    .container {
        padding: 1.5rem;
        border-radius: 15px;
    }
    
    .timer-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .timer-container {
        min-height: 300px;
    }
    
    header h1 {
        font-size: 2rem;
        letter-spacing: 1px;
    }
    
    .display {
        font-size: 2rem;
        height: 80px;
    }
    
    .countdown-input {
        height: 50px;
    }
    
    .countdown-input input {
        width: 4rem;
        font-size: 1rem;
    }
    
    .controls {
        min-height: 50px;
        gap: 0.8rem;
    }
    
    .btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
        min-width: 100px;
        height: 44px;
    }
}

/* 手機直向 */
@media (max-width: 480px) {
    body {
        padding: 0.3rem;
    }
    
    .container {
        padding: 1rem;
        border-radius: 10px;
    }
    
    .timer-section {
        gap: 1.5rem;
    }
    
    .timer-container {
        padding: 1rem;
        min-height: 280px;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .timer-container h2 {
        font-size: 1.3rem;
    }
    
    .display {
        font-size: 1.8rem;
        height: 70px;
        padding: 0.5rem;
    }
    
    .countdown-input input {
        width: 3.6rem;
        padding: 0.3rem 0.2rem;
        font-size: 0.9rem;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-width: 80px;
        height: 44px;
        flex: 1;
        min-width: calc(33.33% - 0.4rem);
    }
}

/* 極小螢幕 */
@media (max-width: 320px) {
    .container {
        padding: 0.8rem;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    .display {
        font-size: 1.5rem;
        height: 60px;
    }
    
    .btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
        height: 44px;
    }
}

/* 可及性補強：鍵盤 focus 可見、輸入框觸控目標 ≥44px、減少動態 */
.btn:focus-visible,
.countdown-input input:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 2px;
}

.countdown-input input {
    min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
    .btn:hover { transform: none; }
}

/* 三欄並排時按鈕不得超出卡片 */
.controls { flex-wrap: wrap; }
.controls .btn { min-width: 96px; padding-left: 1.2rem; padding-right: 1.2rem; }
.controls { flex-wrap: wrap; justify-content: center; }
@media (max-width: 480px) {
    .controls .btn { min-width: 0; flex: 1 1 0; padding-left: 0.5rem; padding-right: 0.5rem; }
}
