/* Mobile-first App UI for 纳吉吉日 (www.3gmfw.com) */
.nj-app {
  box-sizing: border-box;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 16px 28px;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.nj-app *,
.nj-app *::before,
.nj-app *::after {
  box-sizing: border-box;
}

.nj-header {
  margin-bottom: 12px;
}

.nj-today-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

.nj-today-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #dc2626;
  flex-shrink: 0;
}

.nj-h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.nj-lead {
  margin: 0;
  font-size: 14px;
  color: #4b5563;
}

.nj-card {
  background: #fffdf9;
  border: 1px solid #f0e4d4;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(120, 53, 15, 0.04);
}

.nj-controls {
  background: #fff;
}

.nj-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.nj-preset-btn {
  min-height: 44px;
  padding: 6px 4px;
  border: 1px solid #e5d5c3;
  border-radius: 10px;
  background: #faf6f0;
  color: #44403c;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.nj-preset-btn.is-active {
  background: #9f1239;
  border-color: #9f1239;
  color: #fff;
}

.nj-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.nj-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.nj-field span {
  font-size: 13px;
  font-weight: 600;
  color: #57534e;
}

.nj-field select,
.nj-field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #d6c7b4;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-size: 16px;
  line-height: 1.3;
  appearance: auto;
}

.nj-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.nj-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #9f1239;
  flex-shrink: 0;
}

.nj-hero-card {
  border-color: #f3c6c6;
  background: linear-gradient(180deg, #fff8f6 0%, #fffdf9 100%);
}

.nj-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.nj-hero-kicker {
  font-size: 13px;
  font-weight: 600;
  color: #9f1239;
}

.nj-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.nj-badge-top {
  background: #9f1239;
  color: #fff;
}

.nj-badge-good {
  background: #fef3c7;
  color: #92400e;
}

.nj-badge-mid {
  background: #f3f4f6;
  color: #374151;
}

.nj-badge-bad {
  background: #fee2e2;
  color: #991b1b;
}

.nj-hero-date-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.nj-hero-date {
  font-size: 22px;
  font-weight: 800;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.nj-hero-week {
  font-size: 16px;
  font-weight: 600;
  color: #9f1239;
}

.nj-hero-score {
  font-size: 14px;
  color: #57534e;
  font-variant-numeric: tabular-nums;
}

.nj-hero-score strong {
  font-size: 22px;
  color: #9f1239;
}

.nj-hero-sub {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.nj-hero-meta {
  margin-top: 2px;
  font-size: 13px;
  color: #6b7280;
}

.nj-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.nj-kv {
  background: #fff;
  border: 1px solid #f0e4d4;
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}

.nj-kv span {
  display: block;
  font-size: 12px;
  color: #78716c;
}

.nj-kv strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: #1c1917;
  word-break: break-word;
}

.nj-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.nj-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.nj-tag-good {
  background: #ecfdf5;
  color: #065f46;
}

.nj-tag-bad {
  background: #fef2f2;
  color: #991b1b;
}

.nj-inline-tip {
  padding: 9px 11px;
  border-radius: 10px;
  background: #fef9c3;
  color: #713f12;
  font-size: 13px;
  margin-bottom: 12px;
}

.nj-copy-btn {
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: 10px;
  background: #9f1239;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.nj-copy-btn.is-copied {
  background: #065f46;
}

.nj-list-head,
.nj-panel-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.nj-list-head h2,
.nj-panel-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
}

.nj-count,
.nj-panel-sub {
  font-size: 13px;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.nj-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nj-day-card {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid #eadbc8;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.nj-day-card.is-selected {
  border-color: #9f1239;
  background: #fff5f5;
  box-shadow: 0 0 0 1px #9f1239;
}

.nj-day-main {
  min-width: 0;
  flex: 1;
}

.nj-day-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nj-day-date {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.nj-day-lunar {
  margin-top: 2px;
  font-size: 13px;
  color: #4b5563;
}

.nj-day-signs {
  margin-top: 2px;
  font-size: 12px;
  color: #78716c;
}

.nj-day-arrow {
  font-size: 13px;
  font-weight: 600;
  color: #9f1239;
  flex-shrink: 0;
}

.nj-empty {
  padding: 16px;
  border-radius: 10px;
  background: #faf5ed;
  color: #57534e;
  font-size: 14px;
  text-align: center;
}

.nj-hours-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.nj-hour {
  border: 1px solid #e7e5e4;
  border-radius: 10px;
  padding: 8px;
  background: #fafaf9;
  min-width: 0;
}

.nj-hour-good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.nj-hour-bad {
  border-color: #fecaca;
  background: #fef2f2;
  opacity: 0.88;
}

.nj-hour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
}

.nj-hour-head em {
  font-style: normal;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #e5e7eb;
}

.nj-hour-good .nj-hour-head em {
  background: #16a34a;
  color: #fff;
}

.nj-hour-bad .nj-hour-head em {
  background: #dc2626;
  color: #fff;
}

.nj-hour-time {
  margin-top: 2px;
  font-size: 11px;
  color: #57534e;
  font-variant-numeric: tabular-nums;
}

.nj-hour-shen {
  margin-top: 2px;
  font-size: 12px;
  color: #374151;
}

.nj-extra-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px dashed #e7d8c5;
  font-size: 13px;
  color: #4b5563;
}

.nj-related {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.nj-related a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #e5d5c3;
  background: #fffdf9;
  color: #9f1239;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nj-footnote {
  font-size: 12px;
  color: #78716c;
  line-height: 1.5;
}

@media (min-width: 600px) {
  .nj-hours-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
