/* 日历 Pro - 移动端优先，rilipro.com */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --primary: #0f766e;
  --primary-soft: #0d9488;
  --accent: #f59e0b;
  --surface: #fff;
  --surface-elevated: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(15, 118, 110, 0.08);
  --touch: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #14b8a6;
    --primary-soft: #2dd4bf;
    --accent: #fbbf24;
    --surface: #0f172a;
    --surface-elevated: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* 首页 */
.page {
  min-height: 100vh;
  padding: max(env(safe-area-inset-top), 20px) 20px max(env(safe-area-inset-bottom), 32px);
  max-width: 480px;
  margin: 0 auto;
}

.header {
  text-align: center;
  padding: 28px 0 32px;
}
.header-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}
.site-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: block;
  color: var(--primary);
}
.site-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}
.site-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin: 0;
}
.site-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* 常见问题 */
.faq { margin-top: 32px; margin-bottom: 8px; }
.faq-title { font-size: 1.0625rem; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.faq-item {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-item summary {
  padding: 14px 16px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '';
  float: right;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center;
  background-size: 18px;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item p {
  padding: 12px 16px 14px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
  border-top: 1px solid var(--border);
  overflow-wrap: break-word;
}
.faq-item p code { font-size: 0.8125rem; padding: 2px 6px; }
.faq-item p + p { margin-top: 0.75em; padding-top: 0; border-top: none; }

/* 卡片网格 - 移动端单列 */
.cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  display: block;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.card:active { transform: scale(0.99); }
.card-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}
.card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-icon svg { width: 28px; height: 28px; }
.card-icon.weather { background: rgba(15, 118, 110, 0.12); color: var(--primary); }
.card-icon.huangli { background: rgba(180, 83, 9, 0.12); color: #b45309; }
.card-icon.jieqi { background: rgba(185, 28, 28, 0.12); color: #b91c1c; }
.card-icon.holiday { background: rgba(135, 206, 235, 0.35); color: #2e7db5; }
.card-icon.star { background: rgba(139, 92, 246, 0.18); color: #7c3aed; }
.card-icon.countdown { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.card-icon.countup { background: rgba(102, 126, 234, 0.15); color: #667eea; }
.card-body { flex: 1; min-width: 0; }
.card-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 2px; }
.card-desc { font-size: 0.8125rem; color: var(--text-muted); }
.card-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
}
.card-arrow svg { width: 20px; height: 20px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 20px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--primary);
}
.btn-ghost svg { width: 18px; height: 18px; }
.btn-icon { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }

/* 页脚 */
.footer {
  text-align: center;
  padding: 32px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.feedback-link {
  display: inline-block;
  margin-bottom: 16px;
  padding: 8px 16px;
  color: var(--primary);
  text-decoration: none;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}
.feedback-link:hover {
  background: var(--primary);
  color: var(--surface);
}
.back-home-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}
.back-home-link:hover {
  opacity: 0.7;
}

/* 反馈页面样式 */
.feedback-section {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px 40px;
}
.feedback-form {
  background: var(--surface-elevated);
  padding: 24px;
  border-radius: var(--radius);
}
.form-group {
  margin-bottom: 24px;
}
.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
}
.form-textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 120px;
  box-sizing: border-box;
}
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.btn-block {
  width: 100%;
}

/* ---------- 天气订阅页 ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  margin-bottom: 20px;
  -webkit-tap-highlight-color: transparent;
}
.back-link:hover { color: var(--primary); }
.back-link svg { width: 18px; height: 18px; }

.weather-header { margin-bottom: 24px; }
.weather-header h1 { font-size: 1.375rem; font-weight: 700; margin-bottom: 6px; }
.weather-header p { font-size: 0.9375rem; color: var(--text-muted); }

.form-block { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}
.form-input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  box-sizing: border-box;
}
.form-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
}
.form-input {
  width: 100%;
  min-height: var(--touch);
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  box-sizing: border-box;
}
.form-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
}
.form-input:disabled { opacity: 0.6; cursor: not-allowed; }
.form-input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
}
.form-input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  right: 12px;
  width: 20px;
  height: 20px;
  opacity: 0.6;
  cursor: pointer;
}
.form-input[type="date"]::-webkit-inner-spin-button,
.form-input[type="date"]::-webkit-clear-button {
  display: none;
}
.form-select {
  width: 100%;
  min-height: var(--touch);
  padding: 0 44px 0 16px;
  font: inherit;
  font-size: 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}
.form-select:disabled { opacity: 0.6; cursor: not-allowed; }

/* 降温降雨开关 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.switch-label {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text);
}
.switch-desc { font-size: 0.8125rem; color: var(--text-muted); margin-top: 2px; }
.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
  background: var(--border);
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch.on { background: var(--primary); }
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.switch.on::after { transform: translateX(22px); }

/* 提醒时间选项卡：当晚 6 / 8 / 10 点，默认 8 点 */
.alarm-tabs {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
}
.alarm-tabs.visible { display: flex; }
.alarm-tab {
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.alarm-tab:hover { border-color: var(--primary); color: var(--primary); }
.alarm-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.alarm-iphone-tip {
  display: none;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -4px 0 12px;
  line-height: 1.5;
}
.alarm-iphone-tip.visible { display: block; }

/* 假期与调休：补班提醒 提前 N 天 + 整点 */
.holiday-remind-opts {
  display: none;
  margin: -4px 0 16px;
}
.holiday-remind-opts.visible { display: block; }
.holiday-remind-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.holiday-remind-row .form-select { flex: 1; min-width: 0; }
.holiday-remind-row .form-label { margin-bottom: 0; margin-right: 0; flex-shrink: 0; }

/* 星座运势：12 星座 icon 卡 + 时间 1/3/7 */
.star-sign-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.star-sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 10px 4px;
  background: var(--surface-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.star-sign:active { transform: scale(0.98); }
.star-sign svg { 
  width: 28px; 
  height: 28px; 
  display: block; 
  color: var(--text-muted);
  transition: color 0.2s;
}
.star-sign.active svg,
.star-sign:hover svg {
  color: var(--primary);
}
.star-sign span { 
  font-size: 0.75rem; 
  color: var(--text-muted);
  transition: color 0.2s;
}
.star-sign.active span,
.star-sign:hover span {
  color: var(--primary);
}
.star-sign:hover { border-color: var(--primary); }
.star-sign.active { border-color: var(--primary); background: rgba(15, 118, 110, 0.1); }
.star-days { display: flex; gap: 10px; margin-bottom: 16px; }
.star-day {
  flex: 1;
  padding: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, background 0.2s;
}
.star-day:hover { border-color: var(--primary); }
.star-day.active { border-color: var(--primary); background: rgba(15, 118, 110, 0.1); color: var(--primary); }
.star-title { 
  display: grid; 
  grid-template-columns: repeat(4, 1fr); 
  gap: 8px; 
  margin-bottom: 20px; 
}
.star-title-btn {
  padding: 10px 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  text-align: center;
}
.star-title-btn:hover { border-color: var(--primary); }
.star-title-btn.active { border-color: var(--primary); background: rgba(15, 118, 110, 0.1); color: var(--primary); }

/* 订阅结果 */
.result { display: none; margin-top: 24px; }
.result.visible { display: block; }
.result-loading {
  display: none;
  padding: 20px 16px;
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-align: center;
}
.result-loading span { display: block; margin-bottom: 12px; }
.result-loading-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.result-loading-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 36%;
  background: var(--primary);
  border-radius: 2px;
  animation: result-load 1.1s ease-in-out infinite;
}
@keyframes result-load {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}
.result.loading .result-loading { display: block; }
.result.loading .result-content { display: none; }
.result-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.result-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-title svg { width: 20px; height: 20px; color: var(--primary); }
.url-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 0;
}
.url-row .url-input { min-width: 0; }
.url-input {
  flex: 1;
  min-height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.url-row .copy-btn { flex-shrink: 0; min-height: 48px; }
.help-card {
  background: rgba(15, 118, 110, 0.06);
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.help-card h4 { font-size: 0.875rem; color: var(--text); margin-bottom: 10px; }
.help-card ol { padding-left: 18px; }
.help-card li { margin-bottom: 4px; }

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-backdrop.visible { display: flex; }
.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px max(env(safe-area-inset-bottom), 24px);
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
}
.modal-close:hover { background: var(--surface-elevated); color: var(--text); }
.modal-close svg { width: 22px; height: 22px; }

/* 黄历 / 节日 弹窗内选项 */
.modal-options { display: flex; gap: 12px; margin-bottom: 20px; }
.modal-opt {
  flex: 1;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.modal-opt:hover { border-color: var(--primary); background: rgba(15, 118, 110, 0.06); }
.modal-opt.active { border-color: var(--primary); background: rgba(15, 118, 110, 0.12); }
.modal-opt .t { font-weight: 600; font-size: 1rem; }
.modal-opt .d { font-size: 0.75rem; color: var(--text-muted); }

/* Toast */
.toast-wrap {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom), 24px);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 200;
  padding: 12px 20px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.9375rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
}
.toast-wrap.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 大屏 */
@media (min-width: 600px) {
  .cards { display: grid; grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .page { max-width: 720px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
