/* ===== 基本設定 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ===== 主容器 ===== */
.container {
  background: #1e293b;
  border-radius: 1.5rem;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #f8fafc;
}

/* ===== 模式切換 ===== */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  background: #0f172a;
  border-radius: 0.75rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: #3b82f6;
  color: white;
}

/* ===== 輸入區 ===== */
.input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.input-group.hidden {
  display: none;
}

input[type="number"],
input[type="time"] {
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 0.75rem;
  color: #f8fafc;
  font-size: 1.5rem;
  padding: 0.5rem 1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  width: 8rem;
}

input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

input:focus {
  border-color: #3b82f6;
}

input[type="time"] {
  width: auto;
}

.unit {
  font-size: 1rem;
  color: #64748b;
}

/* ===== 倒數顯示 ===== */
.display {
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  color: #f8fafc;
  line-height: 1;
  margin-bottom: 0.5rem;
  transition: color 0.5s;
}

/* 剩 5 分鐘：橘色警告 */
.display.warn {
  color: #f97316;
}

/* 剩 1 分鐘：紅色緊急 */
.display.danger {
  color: #ef4444;
}

/* 時間到：閃爍 */
.display.done {
  color: #ef4444;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ===== 狀態文字 ===== */
.status {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1.5rem;
  min-height: 1.25rem;
}

/* ===== 控制按鈕 ===== */
.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  padding: 0.65rem 1.75rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:active {
  transform: scale(0.96);
}

.btn.hidden {
  display: none;
}

.btn-start {
  background: #3b82f6;
  color: white;
}

.btn-start:hover {
  background: #2563eb;
}

.btn-pause {
  background: #f59e0b;
  color: white;
}

.btn-pause:hover {
  background: #d97706;
}

.btn-reset {
  background: #334155;
  color: #94a3b8;
}

.btn-reset:hover {
  background: #475569;
  color: #e2e8f0;
}

/* ===== 通知提示 ===== */
.notice {
  margin-top: 1.25rem;
  padding: 0.5rem 0.75rem;
  background: #451a03;
  border: 1px solid #92400e;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: #fbbf24;
}

/* ===== RWD：小螢幕 ===== */
@media (max-width: 400px) {
  .display {
    font-size: 4rem;
  }
  .container {
    padding: 2rem 1.25rem;
  }
}
