/* 约球登记 — hand-written styles, no framework. */

:root {
  --yq-bg: #f6f7f9;
  --yq-surface: #ffffff;
  --yq-border: #e2e5ea;
  --yq-text: #1f2430;
  --yq-muted: #6b7280;
  --yq-accent: #1a7f4b;
  --yq-heat-0: #f1f3f5;
  --yq-heat-1: #cdeccd;
  --yq-heat-2: #93d793;
  --yq-heat-3: #4fb85f;
  --yq-heat-4: #1a7f4b;
  --yq-danger: #c0392b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--yq-bg);
  color: var(--yq-text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

.yq-app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.yq-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.yq-header__note {
  margin: 0 0 20px;
  color: var(--yq-muted);
  font-size: 14px;
}

.yq-status {
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--yq-surface);
  border: 1px solid var(--yq-border);
  border-radius: 8px;
}

.yq-status[data-status="failed"] {
  border-color: var(--yq-danger);
  color: var(--yq-danger);
}

.yq-layout {
  display: grid;
  grid-template-columns: minmax(320px, 5fr) minmax(360px, 7fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .yq-layout {
    grid-template-columns: 1fr;
  }
}

.yq-calendar,
.yq-day-panel > section,
.yq-form {
  background: var(--yq-surface);
  border: 1px solid var(--yq-border);
  border-radius: 10px;
  padding: 16px;
}

/* Calendar */

.yq-calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.yq-calendar__label {
  margin: 0;
  font-size: 18px;
}

.yq-nav-btn {
  border: 1px solid var(--yq-border);
  background: var(--yq-surface);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
}

.yq-nav-btn:hover {
  border-color: var(--yq-accent);
  color: var(--yq-accent);
}

.yq-calendar__weekdays,
.yq-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.yq-calendar__weekday {
  text-align: center;
  font-size: 12px;
  color: var(--yq-muted);
  padding: 4px 0;
}

.yq-cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--yq-border);
  border-radius: 6px;
  background: var(--yq-surface);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

.yq-cal-cell:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.yq-cal-cell[data-heat="1"] { background: var(--yq-heat-1); }
.yq-cal-cell[data-heat="2"] { background: var(--yq-heat-2); }
.yq-cal-cell[data-heat="3"] { background: var(--yq-heat-3); }
.yq-cal-cell[data-heat="4"] { background: var(--yq-heat-4); color: #fff; }

.yq-cal-cell[data-selected="true"] {
  outline: 2px solid var(--yq-accent);
  outline-offset: 1px;
}

.yq-cal-cell__count {
  font-size: 11px;
  color: inherit;
  opacity: 0.85;
}

/* Day panel */

.yq-day-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.yq-day-panel__title {
  margin: 0;
  font-size: 20px;
}

.yq-day-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.yq-notice[data-state="error"] {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--yq-danger);
  border-radius: 8px;
  color: var(--yq-danger);
  background: #fdf1ef;
}

.yq-best-window {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--yq-accent);
  font-weight: 600;
}

.yq-best-window[data-state="empty"] {
  color: var(--yq-muted);
  font-weight: 400;
}

.yq-heatmap__slots {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 320px;
  overflow-y: auto;
}

.yq-slot {
  display: grid;
  grid-template-columns: 44px 1fr 40px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.yq-slot[data-best-window="true"] .yq-slot__time {
  color: var(--yq-accent);
  font-weight: 700;
}

.yq-slot[data-best-window="true"] .yq-slot__track {
  outline: 1px solid var(--yq-accent);
  outline-offset: 1px;
}

.yq-slot__time {
  color: var(--yq-muted);
  font-variant-numeric: tabular-nums;
}

.yq-slot__track {
  height: 12px;
  background: var(--yq-heat-0);
  border-radius: 3px;
  overflow: hidden;
}

.yq-slot__bar {
  height: 100%;
  background: var(--yq-heat-0);
}

.yq-slot__bar[data-heat="1"] { background: var(--yq-heat-1); }
.yq-slot__bar[data-heat="2"] { background: var(--yq-heat-2); }
.yq-slot__bar[data-heat="3"] { background: var(--yq-heat-3); }
.yq-slot__bar[data-heat="4"] { background: var(--yq-heat-4); }

.yq-slot__count {
  color: var(--yq-muted);
  text-align: right;
}

/* Field distribution */

.yq-fields__list,
.yq-entries__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yq-fields__list li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 8px;
  background: var(--yq-bg);
  border-radius: 6px;
}

.yq-fields__count {
  color: var(--yq-muted);
}

/* Entries */

.yq-entry {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 6px 8px;
  background: var(--yq-bg);
  border-radius: 6px;
}

.yq-entry__time {
  color: var(--yq-muted);
  font-variant-numeric: tabular-nums;
}

.yq-entry__delete {
  border: 1px solid var(--yq-danger);
  background: transparent;
  color: var(--yq-danger);
  border-radius: 5px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
}

.yq-entry__delete:hover {
  background: var(--yq-danger);
  color: #fff;
}

.yq-empty {
  margin: 0;
  color: var(--yq-muted);
  font-size: 13px;
}

/* Form */

.yq-form form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.yq-form__day {
  margin: 0;
  font-size: 13px;
  color: var(--yq-muted);
}

.yq-form__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.yq-form__row > span:first-child {
  flex: 0 0 64px;
}

.yq-form__row input,
.yq-form__row select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--yq-border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.yq-form__row input:focus,
.yq-form__row select:focus {
  outline: 2px solid var(--yq-accent);
  outline-offset: 0;
  border-color: var(--yq-accent);
}

.yq-form__time-sep {
  color: var(--yq-muted);
  padding: 0 4px;
}

.yq-form__error {
  margin: 0;
  color: var(--yq-danger);
  font-size: 13px;
}

.yq-form__submit {
  align-self: flex-start;
  padding: 8px 24px;
  border: none;
  border-radius: 6px;
  background: var(--yq-accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.yq-form__submit:disabled {
  opacity: 0.6;
  cursor: wait;
}
