/* ==================== 
   Apple iOS 设计风格 - 作业伴学管家 PWA
   ==================== */

:root {
  --ios-blue: #007AFF;
  --ios-green: #34C759;
  --ios-orange: #FF9500;
  --ios-red: #FF3B30;
  --ios-yellow: #FFCC00;
  --ios-teal: #5AC8FA;
  --ios-indigo: #5856D6;
  --ios-purple: #AF52DE;
  --ios-pink: #FF2D55;
  
  --ios-gray: #8E8E93;
  --ios-gray2: #AEAEB2;
  --ios-gray3: #C7C7CC;
  --ios-gray4: #D1D1D6;
  --ios-gray5: #E5E5EA;
  --ios-gray6: #F2F2F7;
  
  --ios-bg-primary: #FFFFFF;
  --ios-bg-secondary: #F2F2F7;
  --ios-bg-tertiary: #FFFFFF;
  
  --ios-text-primary: #000000;
  --ios-text-secondary: #3C3C43;
  --ios-text-tertiary: #3C3C43;
  --ios-text-placeholder: #3C3C4399;
  
  --subject-chinese: #FF3B30;
  --subject-math: #007AFF;
  --subject-english: #34C759;
  --subject-science: #FF9500;
  --subject-other: #5856D6;
  
  --safe-top: env(safe-area-inset-top, 44px);
  --safe-bottom: env(safe-area-inset-bottom, 34px);
  --nav-height: 84px;
  --header-height: 96px;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--ios-bg-secondary);
  color: var(--ios-text-primary);
  line-height: 1.47059;
  letter-spacing: -0.022em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { 
  display: none !important; 
  pointer-events: none !important;
}

/* ==================== 
   加载页面
   ==================== */
.splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #007AFF 0%, #0051D5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-content {
  text-align: center;
  color: white;
  animation: splashFadeIn 0.6s ease-out;
}

@keyframes splashFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.splash-icon-wrapper {
  width: 90px;
  height: 90px;
  margin: 0 auto 28px;
}

.splash-icon-bg {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.splash-icon-svg {
  width: 42px;
  height: 42px;
}

.splash-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.021em;
  margin-bottom: 6px;
}

.splash-subtitle {
  font-size: 15px;
  font-weight: 500;
  opacity: 0.75;
  margin-bottom: 36px;
}

/* 现代加载指示器 */
.loading-ring {
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0 auto;
}

.loading-ring-track {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.loading-ring-indicator {
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes navIconBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.9); }
}

/* ==================== 
   应用容器
   ==================== */
.app {
  min-height: 100vh;
  padding-bottom: calc(100px + var(--safe-bottom));
  background-color: var(--ios-bg-secondary);
}

.app-main {
  padding-top: calc(var(--safe-top) + 66px);
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 24px;
}

/* ==================== 
   iOS 导航栏
   ==================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: calc(var(--safe-top) + 10px) 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

/* ==================== 
   学生信息卡片 - 左上角
   ==================== */
.header-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 30px;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.header-user-info:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.8);
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ios-blue) 0%, var(--ios-teal) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.header-user-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ios-text-primary);
  line-height: 1.2;
}

.header-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--ios-gray);
  line-height: 1.2;
}

/* ==================== 
   顶部操作按钮 - 文字+图标风格
   ==================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
  min-width: 44px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ios-blue);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.header-action-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 122, 255, 0.08);
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.header-action-btn:hover::before,
.header-action-btn:active::before {
  opacity: 1;
}

.header-action-btn svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s;
  position: relative;
  z-index: 1;
}

.header-action-btn:active svg {
  transform: scale(0.92);
}

.header-action-btn .btn-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.header-action-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

/* ==================== 
   iOS 卡片
   ==================== */
.ios-card {
  background: var(--ios-bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ==================== 
   统计卡片
   ==================== */
.stats-card {
  margin: 8px 0 20px;
  padding: 20px;
  background: linear-gradient(135deg, var(--ios-blue) 0%, var(--ios-teal) 100%);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.25);
}

.stats-grid {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}

.stat-item {
  text-align: center;
  color: white;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.021em;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 4px;
  letter-spacing: -0.008em;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ==================== 
   页面标题
   ==================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 16px;
}

.ios-btn-icon.spinning {
  animation: spin 0.8s linear infinite;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.021em;
}

.page-badge {
  padding: 5px 10px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  backdrop-filter: blur(4px);
}

/* ==================== 
   作业列表
   ==================== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  background: var(--ios-bg-primary);
  border-radius: var(--radius-xl);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.task-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: background 0.2s;
}

.task-card.pinned::before {
  background: var(--ios-orange);
}

.task-card:active {
  transform: scale(0.98);
}

.task-card.done {
  opacity: 0.55;
}

.task-card.done .task-name {
  text-decoration: line-through;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.task-subject {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.task-subject.chinese { background: rgba(255, 59, 48, 0.12); color: var(--subject-chinese); }
.task-subject.math { background: rgba(0, 122, 255, 0.12); color: var(--subject-math); }
.task-subject.english { background: rgba(52, 199, 89, 0.12); color: var(--subject-english); }
.task-subject.science { background: rgba(255, 149, 0, 0.12); color: var(--subject-science); }
.task-subject.other { background: rgba(88, 86, 214, 0.12); color: var(--subject-other); }

.task-status {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--ios-gray6);
  color: var(--ios-gray);
}

.task-status.done {
  background: rgba(52, 199, 89, 0.15);
  color: var(--ios-green);
}

.task-status.timing {
  background: rgba(0, 122, 255, 0.15);
  color: var(--ios-blue);
  animation: pulse 1.5s ease-in-out infinite;
}

.task-status.paused {
  background: rgba(255, 149, 0, 0.15);
  color: var(--ios-orange);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.task-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.021em;
  color: var(--ios-text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.task-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ios-gray);
}

.task-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-pin {
  margin-left: auto;
  font-size: 14px;
}

/* ==================== 
   空状态
   ==================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--ios-green) 0%, var(--ios-teal) 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(52, 199, 89, 0.25);
}

.empty-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ios-green);
  margin-bottom: 8px;
  letter-spacing: -0.021em;
}

.empty-text {
  font-size: 15px;
  color: var(--ios-gray);
  letter-spacing: -0.016em;
}

/* ==================== 
   绑定页面
   ==================== */
.bind-page {
  padding: 24px 20px;
}

.bind-hero {
  text-align: center;
  padding: 32px 24px;
  margin-bottom: 24px;
}

.bind-icon-large {
  width: 96px;
  height: 96px;
  background: linear-gradient(135deg, var(--ios-blue) 0%, var(--ios-teal) 100%);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin: 0 auto 24px;
  box-shadow: 0 12px 32px rgba(0, 122, 255, 0.3);
}

.bind-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.021em;
  margin-bottom: 8px;
}

.bind-desc {
  font-size: 15px;
  color: var(--ios-gray);
  letter-spacing: -0.016em;
  line-height: 1.4;
}

.bind-form-card {
  background: var(--ios-bg-primary);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.ios-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 28px;
  font-weight: 600;
  font-family: "SF Mono", SFMono-Regular, ui-monospace, monospace;
  letter-spacing: 8px;
  text-align: center;
  border: 2px solid var(--ios-gray5);
  border-radius: var(--radius-lg);
  background: var(--ios-bg-primary);
  color: var(--ios-text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.ios-input:focus {
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.ios-input:disabled {
  background: var(--ios-gray6);
  color: var(--ios-gray);
  cursor: not-allowed;
}

.ios-input::placeholder {
  color: var(--ios-text-placeholder);
  font-size: 20px;
  letter-spacing: 0;
}

.ios-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.ios-btn:active {
  transform: scale(0.96);
}

.ios-btn-primary {
  background: var(--ios-blue);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.ios-btn-primary:active {
  background: #0056D6;
}

.ios-btn-primary:disabled {
  background: var(--ios-gray4);
  color: var(--ios-gray2);
  box-shadow: none;
  cursor: not-allowed;
}

.ios-btn-block {
  width: 100%;
  margin-top: 20px;
  height: 52px;
}

.ios-btn-secondary {
  background: var(--ios-gray6);
  color: var(--ios-blue);
}

.ios-btn-danger {
  background: var(--ios-red);
  color: white;
}

.bind-status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bind-status.success {
  background: rgba(52, 199, 89, 0.12);
  color: var(--ios-green);
}

.bind-status.error {
  background: rgba(255, 59, 48, 0.12);
  color: var(--ios-red);
}

.bind-status.loading {
  background: rgba(0, 122, 255, 0.08);
  color: var(--ios-blue);
}

.lockout-banner {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 59, 48, 0.1);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
}

.lockout-icon {
  width: 36px;
  height: 36px;
  background: var(--ios-red);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.lockout-text {
  flex: 1;
  font-size: 14px;
  color: var(--ios-red);
  font-weight: 500;
  line-height: 1.4;
}

.attempts-hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ios-gray);
  text-align: center;
}

.attempts-hint.warning { color: var(--ios-orange); }
.attempts-hint.danger { color: var(--ios-red); }

/* ==================== 
   等待家长确认页面
   ==================== */
.waiting-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px;
  min-height: calc(100vh - var(--header-height) - var(--safe-top) - var(--safe-bottom));
}

.waiting-animation {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 32px;
}

.waiting-ring {
  position: absolute;
  inset: 0;
  border: 4px solid rgba(0, 122, 255, 0.2);
  border-top-color: var(--ios-blue);
  border-radius: 50%;
  animation: waitingSpin 1.5s linear infinite;
}

.waiting-ring-2 {
  inset: 12px;
  border-color: rgba(0, 122, 255, 0.15);
  border-bottom-color: var(--ios-teal);
  animation: waitingSpin 2s linear infinite reverse;
}

@keyframes waitingSpin {
  to { transform: rotate(360deg); }
}

.waiting-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  animation: waitingPulse 2s ease-in-out infinite;
}

@keyframes waitingPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.waiting-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.021em;
  margin-bottom: 8px;
}

.waiting-desc {
  font-size: 15px;
  color: var(--ios-gray);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 32px;
}

.waiting-info {
  width: 100%;
  max-width: 320px;
  background: var(--ios-bg-primary);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.waiting-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--ios-gray5);
}

.waiting-info-item:last-child {
  border-bottom: none;
}

.waiting-info-label {
  font-size: 15px;
  color: var(--ios-gray);
}

.waiting-info-value {
  font-size: 15px;
  font-weight: 600;
  font-family: "SF Mono", SFMono-Regular, ui-monospace, monospace;
  color: var(--ios-text-primary);
}

.waiting-progress {
  width: 100%;
  max-width: 320px;
  margin-bottom: 24px;
}

.waiting-progress-bar {
  height: 4px;
  background: var(--ios-gray5);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}

.waiting-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ios-blue), var(--ios-teal));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.waiting-progress-text {
  text-align: center;
  font-size: 13px;
  color: var(--ios-blue);
  font-weight: 500;
}

.waiting-actions {
  width: 100%;
  max-width: 320px;
}

/* ==================== 
   计时器页面
   ==================== */
.timer-page {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background: var(--ios-blue);
  pointer-events: auto;
}

.timer-header {
  padding: calc(var(--safe-top) + 12px) 20px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.timer-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 18px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.timer-close-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.92);
}

.timer-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: white;
  text-align: center;
  pointer-events: auto;
}

.timer-subject-badge {
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.016em;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.timer-task-content {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.021em;
  margin-bottom: 48px;
  max-width: 320px;
  line-height: 1.3;
}

.timer-display {
  padding: 32px 48px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.timer-time {
  font-size: 64px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.024em;
  font-family: "SF Mono", SFMono-Regular, ui-monospace, monospace;
  line-height: 1;
}

.timer-status {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 500;
  opacity: 0.9;
}

.timer-status.paused {
  padding: 8px 16px;
  background: var(--ios-orange);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timer-controls {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.timer-btn {
  min-width: 140px;
  height: 56px;
  padding: 0 32px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.timer-btn:active {
  transform: scale(0.96);
}

.timer-btn-pause {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.timer-btn-resume {
  background: white;
  color: var(--ios-green);
}

.timer-btn-finish {
  background: white;
  color: var(--ios-green);
}

.timer-btn-abandon {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.wakelock-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.wakelock-label {
  font-size: 15px;
  font-weight: 500;
  opacity: 0.95;
}

.wakelock-status {
  font-size: 13px;
  opacity: 0.7;
}

.ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.3);
  transition: 0.3s;
  border-radius: 31px;
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ios-switch input:checked + .switch-slider {
  background-color: var(--ios-green);
}

.ios-switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

/* ==================== 
   现代底部导航 - iOS 风格
   ==================== */
/* ==================== 
   浮动导航栏 - 现代风格
   ==================== */
.app-nav {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  height: 64px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 32px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 100;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  height: 52px;
  min-width: 90px;
  border: none;
  border-radius: 26px;
  background: transparent;
  color: #8e8e93;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-item.active {
  background: var(--ios-blue);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke: currentColor;
}

.nav-item:active .nav-icon {
  transform: scale(0.9);
}

.nav-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* 移动端比较小的屏幕 */
@media (max-width: 375px) {
  .app-nav {
    height: 56px;
    padding: 4px;
  }
  
  .nav-item {
    height: 48px;
    min-width: 80px;
    padding: 8px 16px;
  }
  
  .nav-icon {
    width: 20px;
    height: 20px;
  }
  
  .nav-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .nav-label {
    font-size: 13px;
  }
}

/* ==================== 
   iOS 弹窗
   ==================== */
.ios-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-height: 85vh;
  background: var(--ios-bg-secondary);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  animation: sheetSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 5px;
  background: var(--ios-gray4);
  border-radius: 3px;
  margin: 8px auto 16px;
}

.modal-header {
  padding: 8px 20px 16px;
  text-align: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.024em;
}

.modal-body {
  padding: 0 16px 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.ios-list {
  background: var(--ios-bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ios-list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--ios-gray5);
  cursor: pointer;
  transition: background 0.2s;
}

.ios-list-item:last-child {
  border-bottom: none;
}

.ios-list-item:active {
  background: var(--ios-gray6);
}

.list-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.list-item-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list-item-content {
  flex: 1;
  font-size: 17px;
  letter-spacing: -0.022em;
}

.list-item-content.danger {
  color: var(--ios-red);
}

.list-item-arrow {
  color: var(--ios-gray3);
  font-size: 14px;
}

/* ==================== 
   iOS Toast
   ==================== */
.ios-toast {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.016em;
  z-index: 400;
  animation: toastFadeIn 0.3s ease;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==================== 
   暂停原因弹窗
   ==================== */
.pause-reasons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 8px 0;
}

.pause-reason-card {
  background: var(--ios-bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
}

.pause-reason-card:active {
  transform: scale(0.96);
}

.pause-reason-card.water {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.2);
}

.pause-reason-card.restroom {
  background: rgba(255, 149, 0, 0.08);
  border-color: rgba(255, 149, 0, 0.2);
}

.pause-reason-card.rest {
  background: rgba(175, 82, 222, 0.08);
  border-color: rgba(175, 82, 222, 0.2);
}

.pause-reason-card.exercise {
  background: rgba(52, 199, 89, 0.08);
  border-color: rgba(52, 199, 89, 0.2);
}

.pause-reason-card.other {
  background: rgba(142, 142, 147, 0.08);
  border-color: rgba(142, 142, 147, 0.2);
}

.pause-reason-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
}

.pause-reason-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.021em;
}

.pause-reason-subtitle {
  font-size: 13px;
  color: var(--ios-gray);
}

/* ==================== 
   确认弹窗
   ==================== */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.confirm-dialog .modal-overlay {
  background: rgba(0, 0, 0, 0.4);
}

.confirm-sheet {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: var(--ios-bg-secondary);
  border-radius: 16px;
  overflow: hidden;
  text-align: center;
  animation: confirmPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes confirmPop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.confirm-header {
  padding: 20px;
  border-bottom: 0.5px solid var(--ios-gray4);
}

.confirm-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
  margin-bottom: 4px;
}

.confirm-message {
  font-size: 13px;
  color: var(--ios-gray);
  line-height: 1.4;
}

.confirm-actions {
  display: flex;
}

.confirm-btn {
  flex: 1;
  padding: 16px;
  border: none;
  background: transparent;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.022em;
  cursor: pointer;
  transition: background 0.2s;
}

.confirm-btn:first-child {
  border-right: 0.5px solid var(--ios-gray4);
}

.confirm-btn:active {
  background: var(--ios-gray5);
}

.confirm-btn.primary {
  color: var(--ios-blue);
  font-weight: 600;
}

.confirm-btn.danger {
  color: var(--ios-red);
  font-weight: 600;
}

/* ==================== 
   响应式适配
   ==================== */
@media (min-width: 768px) {
  .app {
    max-width: 414px;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
  }
  
  .app-header {
    max-width: 414px;
    left: 50%;
    transform: translateX(-50%);
  }
  
  /* 导航栏已经居中，只需限制宽度 */
  .app-nav {
    max-width: 280px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .timer-time { font-size: 48px; }
  .timer-task-content { font-size: 20px; margin-bottom: 24px; }
}
