.xp-range-field {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
}

.xp-range-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.xp-dual-range {
  position: relative;
  padding: 0.75rem 0;
  --xp-thumb-size: 16px;
  --xp-thumb-half: calc(var(--xp-thumb-size) / 2);
}

.xp-dual-track {
  position: relative;
  height: 10px;
  margin: 0 var(--xp-thumb-half);
  border-radius: 999px;
  background: #0b1220;
  border: 1px solid var(--border);
  overflow: visible;
}

.xp-dual-ticks {
  position: absolute;
  inset: 0;
}

.xp-dual-tick {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 14px;
  background: #ffffff;
  opacity: 0.7;
  transform: translateX(-50%);
}

.xp-dual-tick-label {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.64rem;
  color: #e2e8f0;
  white-space: nowrap;
  line-height: 1;
}

.xp-dual-selected {
  position: absolute;
  top: -1px;
  height: 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.45);
  border: 1px solid rgba(56, 189, 248, 0.85);
}

.xp-dual-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.xp-dual-input::-webkit-slider-runnable-track {
  height: 10px;
  background: transparent;
}

.xp-dual-input::-moz-range-track {
  height: 10px;
  background: transparent;
}

.xp-dual-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--xp-thumb-size);
  height: var(--xp-thumb-size);
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #38bdf8;
  pointer-events: auto;
  cursor: ew-resize;
  margin-top: -3px;
}

.xp-dual-input::-moz-range-thumb {
  width: var(--xp-thumb-size);
  height: var(--xp-thumb-size);
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #38bdf8;
  pointer-events: auto;
  cursor: ew-resize;
}

#schedule-form {
  margin-top: 0.45rem;
}

#schedule-summary {
  margin-top: 0.85rem;
}

#schedule-list {
  display: grid;
  gap: 1rem;
}

.calendar-toolbar-buttons,
.calendar-toolbar-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.calendar-toolbar-nav {
  justify-content: flex-end;
  margin-top: 0;
}

.calendar-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.6rem 0 0.65rem;
}

.calendar-icon-btn {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0.38rem;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar-icon-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.calendar-icon-btn.danger {
  color: #fca5a5;
  border-color: #7f1d1d;
}

.calendar-list-header button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.calendar-month {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: #0b1220;
}

.calendar-title {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.calendar-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.calendar-month-head .calendar-title {
  margin: 0;
}

.calendar-nav-slot {
  min-height: 2.15rem;
}

.calendar-grid,
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.calendar-weeks {
  display: grid;
  gap: 0.6rem;
}

.calendar-week-block {
  display: grid;
  gap: 0.45rem;
}

.calendar-weekdays {
  margin-bottom: 0.35rem;
}

.calendar-weekday {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.calendar-cell {
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  position: relative;
}

.calendar-cell-add-btn {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  margin: 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.85rem;
  line-height: 1.1;
}

.calendar-cell.empty {
  opacity: 0.35;
}

.calendar-cell.has-plan {
  border-color: #334155;
  background: #111c30;
}

.calendar-day {
  font-size: 0.8rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.calendar-day-star {
  color: #facc15;
  font-size: 0.72rem;
  line-height: 1;
}

.calendar-games {
  font-weight: 600;
}

.calendar-time {
  font-size: 0.8rem;
}

.calendar-xp {
  font-size: 0.76rem;
  color: #bfdbfe;
}

.calendar-stage {
  font-size: 0.72rem;
  color: #cbd5e1;
  border-top: 1px dashed var(--border);
  padding-top: 0.2rem;
}

.task-chip-list {
  display: grid;
  gap: 0.2rem;
}

.task-chip {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
  font-size: 0.72rem;
  background: #0b1324;
}

.task-chip-content {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
  flex: 1 1 auto;
}

.task-chip-title {
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-chip-xp {
  color: #cbd5e1;
  font-size: 0.68rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-chip.selected {
  border-color: #38bdf8;
  background: #0f2b46;
}

.task-chip.mutation {
  border-color: #a78bfa;
  background: #2a1f4a;
}

.task-chip button {
  margin-top: 0;
  font-size: 0.68rem;
  padding: 0.2rem 0.35rem;
}

.task-chip-gear-btn {
  min-width: 1.9rem;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  align-self: center;
}

.calendar-editor-modal[hidden] {
  display: none;
}

.calendar-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

body > .calendar-editor-modal {
  flex: 0 0 0;
  width: 100%;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
}

.calendar-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
}

.calendar-editor-panel {
  position: relative;
  width: min(560px, 92vw);
  margin: 10vh auto 0;
  z-index: 2;
}

.calendar-editor-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

#calendar-auto-plan-form {
  display: grid;
  gap: 0.85rem;
}

.auto-plan-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem;
  background: rgba(15, 23, 42, 0.45);
}

.auto-plan-group h4 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: #bfdbfe;
}

.auto-plan-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auto-plan-toggle-title {
  font-weight: 600;
}

.auto-plan-toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.3rem;
}

.auto-plan-toggle-control input[type="checkbox"] {
  margin: 0;
}

.calendar-week-mutation {
  border: 1px dashed #1d4ed8;
  background: #0b1b3a;
  color: #bfdbfe;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
}

.calendar-cell button {
  padding: 0.28rem 0.45rem;
  font-size: 0.75rem;
}

.warn-text {
  color: #fca5a5;
}

.ok-text {
  color: #86efac;
}

.xp-result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.sync-target-xp-btn {
  margin-top: 0;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.label-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: 1px solid #475569;
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 0.72rem;
  line-height: 1;
  cursor: help;
  user-select: none;
}

.help-tip::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 260px;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #0b1220;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: normal;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.16s ease;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  opacity: 1;
}

@media (max-width: 640px) {
  .calendar-cell {
    min-height: 74px;
  }
}
