* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #F5E6D3;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

#farmCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 顶部信息栏 */
.info-bar {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  pointer-events: none;
}

.timer-display {
  text-align: left;
  pointer-events: auto;
}

.timer {
  font-size: 48px;
  font-weight: 700;
  color: #D84315;
  text-shadow: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.status {
  font-size: 18px;
  color: #FF6E40;
  margin-top: 8px;
  text-shadow: none;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 240, 220, 0.85);
  padding: 12px 20px;
  border-radius: 12px;
  backdrop-filter: none;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(216, 67, 21, 0.1);
  border: 2px solid #FFB74D;
}

.stats-row {
  display: flex;
  gap: 24px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stat-item .label {
  font-size: 12px;
  color: #FF6E40;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-item .value {
  font-size: 18px;
  font-weight: 700;
  color: #D84315;
  font-variant-numeric: tabular-nums;
}

/* 控制栏 */
.control-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 12px;
  pointer-events: auto;
  background: rgba(255, 240, 220, 0.92);
  padding: 12px 16px;
  border-radius: 12px;
  backdrop-filter: none;
  box-shadow: 0 4px 12px rgba(216, 67, 21, 0.15);
  border: 2px solid #FFB74D;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-primary {
  background: #FF6E40;
  color: white;
  box-shadow: 0 4px 12px rgba(255, 110, 64, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 110, 64, 0.4);
  background: #FF5722;
}

.btn-secondary {
  background: rgba(255, 240, 220, 0.6);
  color: #D84315;
  border: 2px solid #FFB74D;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 240, 220, 0.8);
  border-color: #FF9100;
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 模式选择器 */
.mode-selector {
  display: flex;
  gap: 6px;
  padding: 6px 0 2px 0;
  border-top: 1px solid rgba(255, 183, 77, 0.4);
  justify-content: center;
}

.mode-opt {
  width: 44px;
  height: 36px;
  border: 2px solid #FFB74D;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 240, 220, 0.6);
  color: #D84315;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-opt:hover {
  background: rgba(255, 240, 220, 0.9);
  border-color: #FF9100;
}

.mode-opt.active {
  background: #FF6E40;
  color: white;
  border-color: #FF6E40;
  box-shadow: 0 2px 8px rgba(255, 110, 64, 0.3);
}

/* 休息时长配置 */
.break-config-row {
  border-top: 1px solid rgba(255, 183, 77, 0.4);
  padding: 6px 0 2px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.break-config-row input {
  width: 44px;
  height: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #D84315;
  background: white;
  border: 2px solid #FFB74D;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
}

.break-config-row input:focus {
  border-color: #FF6E40;
  box-shadow: 0 0 0 2px rgba(255, 110, 64, 0.2);
}

.break-config-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.btn-lang-inline {
  height: 28px;
  font-size: 13px;
  font-weight: 700;
  color: #D84315;
  background: white;
  border: 2px solid #FFB74D;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0 8px;
  min-width: 44px;
  text-align: center;
  transition: all 0.2s;
  line-height: 24px;
}

.btn-lang-inline:hover {
  border-color: #FF6E40;
  box-shadow: 0 0 0 2px rgba(255, 110, 64, 0.2);
}

.btn-lang-inline:active {
  transform: scale(0.95);
}

.time-label {
  font-size: 13px;
  font-weight: 600;
  color: #D84315;
}

.btn-clear {
  padding: 10px 16px;
  border: 2px solid #E8D5C0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 240, 220, 0.5);
  color: #A08060;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-clear:hover {
  background: rgba(200, 80, 60, 0.15);
  border-color: #C8503C;
  color: #C8503C;
}

/* ===== 小屏手机响应式 ===== */
@media (max-width: 768px) {
  .info-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    top: 12px;
    left: 12px;
    right: 12px;
  }
  .timer { font-size: 32px; }
  .status { font-size: 14px; margin-top: 4px; }
  .stats {
    width: 100%;
    gap: 6px;
    padding: 8px 12px;
  }
  .stats-row { gap: 12px; justify-content: space-around; }
  .stat-item .label { font-size: 10px; }
  .stat-item .value { font-size: 13px; }
  .stat-item { gap: 3px; }
  .mode-opt { width: 36px; height: 30px; font-size: 15px; }
  .break-config-row input { width: 36px; height: 24px; font-size: 12px; }
  .btn-lang-inline { height: 24px; font-size: 11px; min-width: 36px; line-height: 20px; }
  .time-label { font-size: 11px; }
  .control-bar {
    width: calc(100% - 24px);
    bottom: 10px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 10px;
  }
  .btn { padding: 6px 10px; font-size: 11px; }
}

/* 超小屏手机 (≤400px) */
@media (max-width: 400px) {
  .info-bar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .timer { font-size: 26px; letter-spacing: 1px; }
  .status { font-size: 12px; }
  .stats { padding: 6px 8px; gap: 4px; }
  .stats-row { gap: 6px; }
  .stat-item .label { font-size: 9px; }
  .stat-item .value { font-size: 11px; }
  .mode-opt { width: 30px; height: 26px; font-size: 13px; border-radius: 6px; }
  .mode-selector { gap: 4px; padding: 4px 0 2px 0; }
  .break-config-row { gap: 4px; padding: 4px 0 2px 0; }
  .break-config-row input { width: 30px; height: 20px; font-size: 11px; }
  .btn-lang-inline { height: 20px; font-size: 10px; min-width: 30px; line-height: 16px; }
  .time-label { font-size: 10px; }
  .control-bar {
    width: calc(100% - 16px);
    bottom: 6px;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 8px;
  }
  .btn { padding: 5px 8px; font-size: 10px; border-radius: 6px; }
  .btn-clear { padding: 5px 8px; font-size: 10px; }
}

/* 动画 */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.timer {
  animation: pulse 2s ease-in-out infinite;
}