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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  background: #ffb84d;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #333;
}

/* 导航栏 */
.nav-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #ffffff;
  border: none;
  border-radius: 50px;
  text-decoration: none;
  color: #2c3e50;
  font-weight: 600;
  font-size: 14px;
  box-shadow:
    8px 8px 20px rgba(210, 105, 30, 0.8),
    -8px -8px 20px rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
}

.nav-link:hover {
  transform: translateY(-2px);
  box-shadow:
    10px 10px 25px rgba(210, 105, 30, 0.9),
    -10px -10px 25px rgba(255, 255, 255, 0.5);
}

.nav-icon {
  font-size: 16px;
}

.nav-text {
  white-space: nowrap;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 40px;
  width: 100%;
  max-width: 1400px;
}

/* ===== 区域定义 ===== */

/* 时钟区：包括闹钟、状态、说明、按钮 */
.clock-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

/* 统计区：统计信息面板 */
.stats-zone {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* 计时器部分 */
.timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.timer-circle {
  position: relative;
  width: min(70vmin, 600px);
  height: min(70vmin, 600px);
  background: #ffffff;
  border-radius: 50%;
  box-shadow:
    25px 25px 80px rgba(210, 105, 30, 0.8),
    -25px -25px 80px rgba(255, 255, 255, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-circle svg {
  position: absolute;
  width: 100%;
  height: 100%;
}

#progress-sector {
  transition: fill 0.5s ease;
}

/* 工作状态 - 红色 */
#progress-sector.work {
  fill: #c41e3a;
}

/* 休息状态 - 绿色 */
#progress-sector.rest {
  fill: #4caf50;
}

.timer-text {
  position: relative;
  z-index: 1;
}

#time-display {
  font-size: clamp(48px, 12vmin, 96px);
  font-weight: 700;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  color: #2c3e50;
  transition: color 0.5s ease;
  letter-spacing: 0.05em;
}

#time-display.work {
  color: #2c3e50;
}

#time-display.rest {
  color: #2c3e50;
}

.status-display {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
}

/* 信息部分 */
.info-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.description {
  color: #5a6c7d;
  font-size: 16px;
  text-align: center;
  max-width: 400px;
  line-height: 1.6;
}

.start-btn {
  padding: 16px 48px;
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  background: #ffffff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow:
    12px 12px 24px rgba(210, 105, 30, 0.8),
    -12px -12px 24px rgba(255, 255, 255, 0.4);
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    15px 15px 30px rgba(210, 105, 30, 0.9),
    -15px -15px 30px rgba(255, 255, 255, 0.5);
}

.start-btn:active {
  box-shadow:
    inset 6px 6px 12px #d1d5db,
    inset -6px -6px 12px #f8f9fa;
}

.start-btn.hidden {
  visibility: hidden;
  pointer-events: none;
}

/* 选择弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow:
    25px 25px 60px rgba(210, 105, 30, 0.8),
    -25px -25px 60px rgba(255, 255, 255, 0.4);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  font-size: 32px;
  color: #2c3e50;
  margin-bottom: 12px;
  text-align: center;
}

.modal-description {
  font-size: 16px;
  color: #5a6c7d;
  text-align: center;
  margin-bottom: 32px;
}

.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  gap: 8px;
}

.choice-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.choice-btn:active {
  transform: translateY(-2px);
}

.work-btn {
  background: linear-gradient(135deg, #c41e3a 0%, #e94560 100%);
  color: white;
}

.rest-btn {
  background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
  color: white;
}

.btn-icon {
  font-size: 48px;
}

.btn-text {
  font-size: 24px;
  font-weight: 700;
}

.btn-subtitle {
  font-size: 14px;
  opacity: 0.9;
}

.btn-subtitle kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  margin-left: 4px;
}

/* 统计面板 */
.stats-panel {
  background: #ffffff;
  border-radius: 20px;
  padding: 30px;
  box-shadow:
    12px 12px 30px rgba(210, 105, 30, 0.8),
    -12px -12px 30px rgba(255, 255, 255, 0.4);
  min-width: 400px;
}

.stats-title {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 20px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow:
    inset 3px 3px 6px #d1d5db,
    inset -3px -3px 6px #ffffff;
}

.stat-item:hover {
  box-shadow:
    inset 4px 4px 8px #d1d5db,
    inset -4px -4px 8px #ffffff;
}

.stat-icon {
  font-size: 32px;
}

.stat-label {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
}

.work-stat .stat-value {
  color: #c41e3a;
}

.rest-stat .stat-value {
  color: #4caf50;
}

.total-stat .stat-value {
  color: #667eea;
}

/* 快捷键提示 */
.shortcuts-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 20px;
  background: #ffffff;
  padding: 16px 24px;
  border-radius: 50px;
  box-shadow:
    8px 8px 20px rgba(210, 105, 30, 0.8),
    -8px -8px 20px rgba(255, 255, 255, 0.4);
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #5a6c7d;
}

.shortcut-item kbd {
  display: inline-block;
  padding: 4px 10px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 600;
  color: #2c3e50;
  background: #f0f2f5;
  border: none;
  border-radius: 6px;
  box-shadow:
    inset 2px 2px 4px #d1d5db,
    inset -2px -2px 4px #ffffff;
  min-width: 28px;
  text-align: center;
}

/* ===== 响应式布局统一规则 ===== */
/* 
  布局逻辑：
  - 横屏（landscape）：左右布局（时钟在左，统计在右）
  - 竖屏（portrait）：上下布局（时钟在上，统计在下）
  - 适用于所有设备：PC、iPad、手机
*/

/* ========== 横屏布局（所有设备） ========== */

/* PC横屏：大屏幕横向 */
@media (min-width: 1024px) {
  .container {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 60px;
    padding: 60px;
  }

  .clock-zone {
    flex: 1;
    max-width: 600px;
  }

  .stats-zone {
    flex: 0 0 auto;
    max-width: 500px;
  }

  .timer-circle {
    width: min(50vmin, 500px);
    height: min(50vmin, 500px);
  }

  .stats-panel {
    min-width: 450px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* iPad横屏：平板横向布局 */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: landscape) {
  .container {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 50px;
    padding: 30px 50px 100px;
  }

  .clock-zone {
    flex: 1;
    max-width: 500px;
  }

  .stats-zone {
    flex: 0 0 auto;
    max-width: 400px;
  }

  .timer-circle {
    width: min(55vh, 450px);
    height: min(55vh, 450px);
  }

  .status-display {
    font-size: 22px;
  }

  .description {
    font-size: 15px;
    max-width: 350px;
  }

  .start-btn {
    padding: 14px 42px;
    font-size: 18px;
  }

  .stats-panel {
    min-width: 350px;
    padding: 25px;
  }

  .stats-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-item {
    flex-direction: row;
    justify-content: space-between;
    padding: 16px 20px;
  }

  .stat-icon {
    font-size: 28px;
    order: 1;
  }

  .stat-label {
    font-size: 13px;
    order: 2;
    flex: 1;
    text-align: left;
    margin-left: 14px;
  }

  .stat-value {
    font-size: 30px;
    order: 3;
  }

  .shortcuts-hint {
    bottom: 15px;
    right: 15px;
    gap: 16px;
    padding: 12px 20px;
  }

  .nav-link {
    padding: 10px 18px;
    font-size: 14px;
  }
}

/* 手机横屏：小屏幕横向布局 */
@media (max-width: 767px) and (orientation: landscape) {
  .container {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 15px 30px 80px;
  }

  .clock-zone {
    flex: 1;
    max-width: 400px;
  }

  .stats-zone {
    flex: 0 0 auto;
    max-width: 320px;
  }

  .timer-circle {
    width: min(50vh, 300px);
    height: min(50vh, 300px);
  }

  .status-display {
    font-size: 18px;
  }

  .description {
    font-size: 13px;
    max-width: 280px;
  }

  .start-btn {
    padding: 10px 32px;
    font-size: 15px;
  }

  .stats-panel {
    min-width: 280px;
    padding: 20px;
  }

  .stats-title {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-item {
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .stat-icon {
    font-size: 24px;
    order: 1;
  }

  .stat-label {
    font-size: 11px;
    order: 2;
    flex: 1;
    text-align: left;
    margin-left: 10px;
  }

  .stat-value {
    font-size: 24px;
    order: 3;
  }

  .shortcuts-hint {
    bottom: 10px;
    right: 10px;
    gap: 10px;
    padding: 8px 14px;
  }

  .shortcut-item {
    font-size: 11px;
  }

  .shortcut-item kbd {
    padding: 3px 8px;
    font-size: 10px;
    min-width: 22px;
  }

  .nav-bar {
    top: 10px;
    right: 10px;
  }

  .nav-link {
    padding: 6px 12px;
    font-size: 12px;
  }

  .nav-icon {
    font-size: 14px;
  }
}

/* ========== 竖屏布局（所有设备） ========== */

/* iPad竖屏：平板竖向布局 */
@media (min-width: 600px) and (max-width: 1023px) and (orientation: portrait) {
  .container {
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 90px 40px 120px;
  }

  .clock-zone {
    width: 100%;
    max-width: 600px;
  }

  .stats-zone {
    width: 100%;
    max-width: 600px;
  }

  .timer-circle {
    width: min(60vw, 500px);
    height: min(60vw, 500px);
  }

  .status-display {
    font-size: 24px;
  }

  .description {
    font-size: 16px;
    max-width: 450px;
  }

  .start-btn {
    padding: 18px 56px;
    font-size: 22px;
  }

  .stats-panel {
    width: 100%;
    min-width: unset;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .shortcuts-hint {
    bottom: 20px;
    right: 20px;
    gap: 18px;
    padding: 14px 22px;
  }
}

/* 手机竖屏：小屏幕竖向布局 */
@media (max-width: 599px) and (orientation: portrait) {
  .container {
    flex-direction: column;
    align-items: center;
    gap: 35px;
    padding: 90px 20px 150px;
  }

  .clock-zone {
    width: 100%;
  }

  .stats-zone {
    width: 100%;
  }

  .timer-circle {
    width: min(75vw, 400px);
    height: min(75vw, 400px);
  }

  .status-display {
    font-size: 22px;
  }

  .description {
    font-size: 15px;
    max-width: 90%;
  }

  .start-btn {
    padding: 16px 48px;
    font-size: 20px;
  }

  .stats-panel {
    width: 92%;
    min-width: unset;
    padding: 24px 20px;
  }

  .stats-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-item {
    flex-direction: row;
    justify-content: space-between;
    padding: 18px;
  }

  .stat-icon {
    font-size: 28px;
    order: 1;
  }

  .stat-label {
    font-size: 14px;
    order: 2;
    flex: 1;
    text-align: left;
    margin-left: 12px;
  }

  .stat-value {
    font-size: 32px;
    order: 3;
  }

  .shortcuts-hint {
    flex-direction: column;
    bottom: 15px;
    right: 15px;
    gap: 10px;
    padding: 12px 16px;
  }

  .shortcut-item {
    font-size: 13px;
  }

  .modal-content {
    padding: 35px 25px;
  }

  .choice-buttons {
    gap: 14px;
  }

  .choice-btn {
    padding: 22px;
  }

  .btn-icon {
    font-size: 44px;
  }

  .btn-text {
    font-size: 22px;
  }
}

/* 极小屏幕优化 */
@media (max-width: 360px) {
  .timer-circle {
    width: min(70vw, 280px);
    height: min(70vw, 280px);
  }

  .start-btn {
    padding: 14px 40px;
    font-size: 18px;
  }

  .stats-panel {
    padding: 20px 16px;
  }

  .nav-text {
    display: none;
  }

  .shortcuts-hint {
    padding: 10px 14px;
    gap: 8px;
  }

  .shortcut-item {
    font-size: 12px;
  }
}