/* 高对比度纯黑白样式，适配电子墨水屏 */
:root { --fg:#000; --bg:#fff; --border:#000; }
html,body { height:100%; background:var(--bg); color:var(--fg); }
body { margin:0; font-family: Arial, "Helvetica Neue", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
* { box-sizing: border-box; }
.app { display:flex; flex-direction:column; min-height:100vh; padding:16px; gap:8px; }

/* 时间区 */
.time { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 15px; 
  margin-bottom: 8px;
}
.time-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
}
.time-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-left: 15px;
}
.greeting {
  font-size: clamp(20px, 4vw, 32px);
  font-weight: 600;
  color: var(--fg);
  opacity: 0.9;
  text-align: right;
  line-height: 1.2;
}
.date { font-size: clamp(14px, 3vw, 18px); font-weight:600; margin-bottom: 2px; }
.clock { font-size: clamp(24px, 6vw, 36px); font-weight:700; letter-spacing: 1px; margin-bottom: 0px; }
.lunar { font-size: 12px; color: var(--fg); opacity: 0.7; margin-top: 1px; }
.festival { font-size: 12px; font-weight:600; margin-top: 1px; }
.location { display: none !important; }

/* 操作区 */
.actions { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }
button { background:var(--bg); color:var(--fg); border:2px solid var(--border); padding:10px 14px; border-radius:8px; font-size: 16px; }
button:active { transform: scale(0.98); }

/* Native主题样式 */
body.theme-native { }
body.theme-native .weather { border:2px solid var(--border); border-radius:8px; }
body.theme-native .anniversary { border:2px solid var(--border); border-radius:8px; }
body.theme-native .sentence { border:2px solid var(--border); border-radius:8px; }
body.theme-native .clock { font-family: Arial, "Helvetica Neue", "Segoe UI", sans-serif; font-weight:700; letter-spacing:1px; }
.action-btn {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}
.action-btn:hover {
  background: var(--text);
  color: var(--bg);
}

/* 句子样式 */
.sentence {
  text-align: center;
  margin: 2px 0;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}
.sentence-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.sentence-title-main {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}
.refresh-sentence-btn {
  /* 继承统一的组件按钮样式 */
}
.sentence-content {
  font-size: 15px;
  line-height: 1.4;
  color: var(--fg);
  padding: 5px 25px 5px 5px;
  text-align: left;
  word-wrap: break-word;
}
.sentence-author {
  font-size: 15px;
  color: var(--fg);
  text-align: right;
  margin-top: 5px;
  font-style: normal;
}

/* 汇率样式 */
.exchange {
  text-align: center;
  margin: 2px 0;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  position: relative;
}
.exchange-title {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 15px;
  color: var(--fg, #333);
  font-weight: 500;
  z-index: 100;
}
.refresh-exchange-btn {
  /* 继承统一的组件按钮样式 */
}
.exchange-container {
  display: flex;
  justify-content: space-between;
  gap: clamp(3px, 1vw, 6px);
  padding: 20px 25px 5px 5px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.exchange-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px clamp(3px, 1vw, 6px);
  background: var(--bg-secondary, rgba(255,255,255,0.05));
  border-radius: 4px;
  border: 1px solid var(--border-light, rgba(255,255,255,0.1));
  flex: 1;
  min-width: 0;
  justify-content: center;
  text-align: center;
}
.currency-pair {
  font-size: clamp(12px, 3vw, 14px);
  color: var(--fg, #333);
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exchange-rate {
  font-size: clamp(14px, 3.5vw, 16px);
  color: var(--fg, #333);
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 配置面板 */
.overlay { 
  position: fixed; 
  inset: 0; 
  background: rgba(255,255,255,0.95); 
  display: none; 
  overflow-y: auto;
  padding: clamp(10px, 3vw, 20px);
  box-sizing: border-box;
  z-index: 1000;
}
.panel { 
  max-width: clamp(300px, 90vw, 520px); 
  width: 100%;
  margin: 0 auto; 
  border: 2px solid var(--border); 
  border-radius: 8px; 
  padding: clamp(12px, 3vw, 16px); 
  background: var(--bg);
  min-height: fit-content;
  box-sizing: border-box;
}
.panel h2 { margin: 0 0 clamp(8px, 2vw, 12px) 0; font-size: clamp(18px, 4vw, 22px); }
.field { display: flex; flex-direction: column; gap: clamp(4px, 1vw, 6px); margin-bottom: clamp(8px, 2vw, 12px); }
.field label { font-weight: 600; font-size: clamp(14px, 3vw, 16px); }
.field input, .field select { 
  border: 2px solid var(--border); 
  padding: clamp(6px, 1.5vw, 8px); 
  font-size: clamp(14px, 3vw, 16px); 
  border-radius: 6px; 
  background: var(--bg); 
  color: var(--fg);
  box-sizing: border-box;
}

/* 配置面板标题样式 */
.panel h3 { 
  margin: clamp(12px, 3vw, 16px) 0 clamp(6px, 1.5vw, 8px) 0; 
  font-size: clamp(14px, 3vw, 16px); 
  font-weight: 600; 
  border-bottom: 1px solid var(--border); 
  padding-bottom: clamp(2px, 0.5vw, 4px); 
}

/* 通用关闭按钮样式 */
.close-btn,
.unified-modal-close,
.salary-config-close {
  background: none;
  border: 2px solid transparent;
  border-radius: 4px;
  font-size: clamp(18px, 4vw, 20px);
  cursor: pointer;
  padding: 2px;
  width: clamp(28px, 6vw, 32px);
  height: clamp(28px, 6vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
}

/* 统一的组件按钮样式 */
.component-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--fg);
  font-size: 16px;
  font-weight: normal;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  border-radius: 3px;
}

.component-btn:hover {
  opacity: 1;
  background: rgba(128, 128, 128, 0.1);
}

.component-btn:active {
  transform: scale(0.95);
}

/* 可隐藏的按钮样式 */
.component-btn.hideable {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* 当鼠标悬停在组件上时显示可隐藏按钮 */
section:hover .component-btn.hideable {
  opacity: 0.7;
  pointer-events: auto;
}

section:hover .component-btn.hideable:hover {
  opacity: 1;
}

.close-btn:hover,
.unified-modal-close:hover,
.salary-config-close:hover {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.close-btn:active,
.unified-modal-close:active,
.salary-config-close:active {
  transform: scale(0.95);
}

.close-btn:focus,
.unified-modal-close:focus,
.salary-config-close:focus {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* 统一弹窗样式 */
.unified-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: clamp(10px, 3vw, 20px);
}

.unified-modal {
  background: var(--bg);
  border: 2px solid var(--fg);
  border-radius: 8px;
  width: 100%;
  max-width: clamp(300px, 90vw, 400px);
  max-height: clamp(400px, 85vh, 600px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.unified-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 3vw, 16px);
  border-bottom: 1px solid var(--fg);
  flex-shrink: 0;
}

.unified-modal-title {
  margin: 0;
  font-size: clamp(16px, 4vw, 18px);
  font-weight: 600;
  color: var(--fg);
}

.unified-modal-content {
  padding: clamp(12px, 3vw, 16px);
  overflow-y: auto;
  flex: 1;
}

.unified-modal-footer {
  padding: clamp(12px, 3vw, 16px);
  border-top: 1px solid var(--fg);
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2vw, 12px);
  flex-shrink: 0;
}

.unified-modal-btn {
  padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px);
  border: 2px solid var(--fg);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  font-size: clamp(14px, 3vw, 16px);
  font-weight: 600;
  min-height: 40px;
  min-width: 60px;
  transition: all 0.2s ease;
}

.unified-modal-btn:hover {
  background: var(--fg);
  color: var(--bg);
}

.unified-modal-btn:focus {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.unified-form-group {
  margin-bottom: clamp(12px, 3vw, 16px);
}

.unified-form-label {
  display: block;
  margin-bottom: clamp(4px, 1vw, 6px);
  font-size: clamp(14px, 3vw, 16px);
  font-weight: 600;
  color: var(--fg);
}

.unified-form-input {
  width: 100%;
  padding: clamp(8px, 2vw, 12px);
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: clamp(14px, 3vw, 16px);
  min-height: 40px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.unified-form-input:focus {
  outline: none;
  border-color: var(--fg);
}

.unified-form-input::placeholder {
  color: var(--fg);
  opacity: 0.6;
}

/* 开关样式 */
.switch { 
  position: relative; 
  display: inline-block; 
  width: clamp(40px, 10vw, 50px); 
  height: clamp(20px, 5vw, 24px); 
}
.switch input { 
  opacity: 0; 
  width: 0; 
  height: 0; 
}
.slider { 
  position: absolute; 
  cursor: pointer; 
  top: 0; 
  left: 0; 
  right: 0; 
  bottom: 0; 
  background-color: #ccc; 
  transition: .4s; 
  border-radius: 24px; 
}
.slider:before { 
  position: absolute; 
  content: ""; 
  height: clamp(14px, 3.5vw, 18px); 
  width: clamp(14px, 3.5vw, 18px); 
  left: clamp(2px, 0.5vw, 3px); 
  bottom: clamp(2px, 0.5vw, 3px); 
  background-color: white; 
  transition: .4s; 
  border-radius: 50%; 
}
input:checked + .slider { 
  background-color: var(--fg); 
}
input:checked + .slider:before { 
  transform: translateX(clamp(18px, 4.5vw, 26px)); 
}

/* 模块配置样式 */
.module-config { 
  border: 1px solid var(--border); 
  border-radius: 6px; 
  background: var(--bg);
  overflow: hidden;
}
.module-config-item { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 12px; 
  border-bottom: 1px solid var(--border); 
  transition: background-color 0.2s ease;
}
.module-config-item:last-child { 
  border-bottom: none; 
}
.module-config-item:hover { 
  background: rgba(128, 128, 128, 0.05); 
}
.module-info { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  flex: 1; 
  margin-right: 12px;
}
.module-name { 
  font-weight: 500; 
  font-size: 14px;
}
.module-controls { 
  display: flex; 
  gap: 4px;
}
.order-btn { 
  width: 32px; 
  height: 32px; 
  border: 1px solid var(--border); 
  background: var(--bg); 
  color: var(--fg); 
  border-radius: 4px; 
  cursor: pointer; 
  font-size: 16px; 
  font-weight: bold; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  transition: all 0.2s ease;
}
.order-btn:hover { 
  background: var(--fg); 
  color: var(--bg); 
}
.order-btn:active { 
  transform: scale(0.95); 
}

/* 配置面板按钮样式 */
#saveBtn, #closeBtn {
  padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px);
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  font-size: clamp(14px, 3vw, 16px);
  font-weight: 600;
  min-height: 40px;
  transition: all 0.2s ease;
}
#saveBtn:hover, #closeBtn:hover {
  background: var(--fg);
  color: var(--bg);
}
#saveBtn:focus, #closeBtn:focus {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* 工资计算器样式 */
.salary-calculator {
  margin: 2px 0;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  position: relative;
}
.salary-config-btn {
  /* 继承统一的组件按钮样式 */
  top: 4px;
  right: 4px;
}
.salary-content {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.salary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  flex: 1;
  min-width: 0;
}
.salary-label {
  font-size: 11px;
  color: var(--fg);
  opacity: 0.8;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.salary-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 工资计算器配置弹窗样式 */
.salary-config-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.salary-config-modal {
  background: var(--bg);
  border: 2px solid var(--fg);
  border-radius: 8px;
  width: clamp(280px, 90vw, 400px);
  max-height: clamp(400px, 85vh, 600px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.salary-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 3vw, 16px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.salary-config-header h3 {
  margin: 0;
  font-size: clamp(16px, 4vw, 18px);
  font-weight: 600;
  color: var(--fg);
}

.salary-config-content {
  padding: clamp(12px, 3vw, 16px);
  overflow-y: auto;
  flex: 1;
}

.salary-config-item {
  margin-bottom: clamp(12px, 3vw, 16px);
}

.salary-config-item label {
  display: block;
  margin-bottom: clamp(4px, 1vw, 6px);
  font-size: clamp(14px, 3vw, 16px);
  color: var(--fg);
  font-weight: 600;
}

.salary-config-item input {
  width: 100%;
  padding: clamp(8px, 2vw, 12px);
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: clamp(14px, 3vw, 16px);
  box-sizing: border-box;
  background: var(--bg);
  color: var(--fg);
  min-height: 40px;
  transition: border-color 0.2s ease;
}
.salary-config-item input:focus {
  outline: none;
  border-color: var(--fg);
}
.salary-config-item input::placeholder {
  color: var(--fg);
  opacity: 0.6;
}

.salary-config-footer {
  padding: clamp(12px, 3vw, 16px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2vw, 12px);
  flex-shrink: 0;
}

.salary-config-save,
.salary-config-cancel {
  padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px);
  border: 2px solid var(--fg);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  font-size: clamp(14px, 3vw, 16px);
  min-height: 40px;
  min-width: 60px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.salary-config-save:hover,
.salary-config-cancel:hover {
  background: var(--fg);
  color: var(--bg);
}

.salary-config-save:focus,
.salary-config-cancel:focus {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* 响应式布局 */
@media (max-width: 420px) {
  .forecast { 
    grid-template-columns: repeat(6, 1fr); 
    gap: clamp(2px, 1vw, 4px);
  }
  .fc-item { 
    padding-top: clamp(2px, 1vw, 4px); 
  }
  .overlay { padding: 10px; }
  .panel { 
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    padding: 20px 16px;
  }
  .field input, .field select {
    font-size: 16px; /* 防止iOS缩放 */
    padding: 12px 8px;
  }
  
  /* 倒计时小屏幕优化 */
  .countdown-row {
    gap: clamp(4px, 1vw, 8px);
  }
  .countdown-item {
    padding: clamp(4px, 1vw, 6px);
    min-width: 0;
  }
  .countdown-title {
    font-size: 1em;
    padding: 0 5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    transition: font-size 0.3s ease;
  }
  .countdown-time {
    font-size: clamp(14px, 4vw, 18px);
    line-height: 1.1;
  }
  
  /* 工资计算器小屏幕优化 */
  .salary-content {
    gap: clamp(3px, 1vw, 6px);
  }
  .salary-item {
    padding: clamp(2px, 1vw, 4px) clamp(3px, 1vw, 6px);
  }
  .salary-label {
    font-size: clamp(9px, 2.5vw, 11px);
  }
  .salary-value {
    font-size: clamp(11px, 3vw, 13px);
  }
  
  /* 汇率组件小屏幕优化 */
  .exchange-container {
    gap: clamp(2px, 0.8vw, 4px);
    padding: 20px 20px 5px 5px;
  }
  .exchange-item {
    padding: 3px clamp(2px, 0.8vw, 4px);
  }
  .currency-pair {
    font-size: clamp(10px, 2.5vw, 12px);
  }
  .exchange-rate {
    font-size: clamp(12px, 3vw, 14px);
  }
  
  /* 工资设置弹窗小屏幕优化 */
  .salary-config-modal {
    width: 95vw;
    max-width: 280px;
    max-height: 90vh;
  }
  .salary-config-header {
    padding: 10px;
  }
  .salary-config-header h3 {
    font-size: 14px;
  }
  .salary-config-content {
    padding: 10px;
  }
  .salary-config-item {
    margin-bottom: 10px;
  }
  .salary-config-item label {
    font-size: 12px;
    margin-bottom: 4px;
  }
  .salary-config-item input {
    padding: 8px;
    font-size: 12px;
    min-height: 36px;
    border-width: 1px;
  }
  .salary-config-footer {
    padding: 10px;
    gap: 8px;
  }
  .salary-config-save,
  .salary-config-cancel {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
    min-width: 50px;
  }
  
  /* 倒计时和纪念日弹窗小屏幕优化 */
  .modal-content {
    padding: 12px;
    max-width: 95vw;
    max-height: 90vh;
  }
  .modal-header {
    margin-bottom: 10px;
  }
  .modal-title {
    font-size: 14px;
  }
  .close-btn,
  .unified-modal-close,
  .salary-config-close {
    width: 28px;
    height: 28px;
    font-size: 16px;
    padding: 2px;
    border-width: 1px;
  }
  
  /* 配置面板小屏幕优化 */
  .overlay {
    padding: 8px;
  }
  .panel {
    padding: 10px;
    max-width: 95vw;
  }
  .panel h2 {
    font-size: 16px;
    margin-bottom: 8px;
  }
  .panel h3 {
    font-size: 13px;
    margin: 10px 0 6px 0;
  }
  .field {
    margin-bottom: 8px;
    gap: 3px;
  }
  .field label {
    font-size: 13px;
  }
  .field input, .field select {
    padding: 6px;
    font-size: 13px;
  }
  .switch {
    width: 36px;
    height: 18px;
  }
  .switch .slider:before {
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
  }
  .switch input:checked + .slider:before {
    transform: translateX(18px);
  }
}

@media (max-height: 600px) {
  .overlay { padding: 8px; }
  .panel { margin: 0; padding: 8px; }
  .modal-content { 
    padding: 10px; 
    max-height: 95vh; 
  }
}

/* 降低动画以适配墨水屏 */
*, *::before, *::after { transition: none !important; animation: none !important; }