.back-link {
  padding: 12px 15px;
  border: 1px solid rgba(24, 216, 255, 0.38);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.history-summary article {
  display: grid;
  gap: 4px;
}

.history-summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(440px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.history-layout > *,
.session-card,
.wheel-event-card,
.wheel-waiting-card {
  min-width: 0;
}

.session-archive {
  max-height: 780px;
  overflow-y: auto;
}

.workday {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid rgba(24, 216, 255, 0.18);
}

.workday:first-child {
  padding-top: 0;
  border-top: 0;
}

.workday-header,
.session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workday-header h3 {
  margin: 0;
  color: var(--lime);
  font-size: 18px;
  text-transform: capitalize;
}

.workday-header > strong {
  color: var(--cyan);
  font-size: 12px;
}

.session-card {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

.session-card-header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.session-card-header small {
  color: var(--muted);
  font-size: 10px;
}

.session-entries {
  gap: 5px;
}

.remove-session {
  min-height: 34px;
  padding: 0 10px;
  border-color: rgba(255, 107, 107, 0.48);
  color: #ff9898;
  background: rgba(255, 107, 107, 0.09);
  font-size: 10px;
  white-space: nowrap;
}

.remove-session:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.empty-history,
.empty-session {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
}

.archive-filter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
  align-items: end;
}

.session-archive time {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

.edit-order {
  min-height: 28px;
  padding: 0 9px;
  color: var(--cyan);
  font-size: 10px;
}

.wheel-history-panel {
  margin-top: 16px;
}

.wheel-waiting-panel {
  margin-top: 16px;
}

.wheel-waiting-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.wheel-waiting {
  display: grid;
  gap: 10px;
}

.wheel-waiting-card {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(24, 216, 255, 0.22);
  border-left: 4px solid var(--cyan);
  background: rgba(255, 255, 255, 0.035);
}

.wheel-waiting-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.wheel-waiting-header strong {
  color: #fff;
}

.wheel-waiting-status {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

.wheel-waiting-card p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.wheel-waiting-source {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

.wheel-waiting-reason {
  color: var(--muted);
  font-size: 12px;
}

.wheel-waiting-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.wheel-waiting-details > span {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 7px;
  border: 1px solid rgba(24, 216, 255, 0.14);
  background: rgba(0, 0, 0, 0.14);
}

.wheel-waiting-details b {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.wheel-waiting-details time,
.wheel-waiting-details span span {
  min-width: 0;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.wheel-waiting-actions {
  display: grid;
}

.wheel-waiting-delete {
  min-height: 44px;
  color: #ff9898;
  border-color: rgba(255, 107, 107, 0.48);
  background: rgba(255, 107, 107, 0.09);
  font-size: 10px;
}

.wheel-history-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.wheel-history {
  display: grid;
  gap: 14px;
  max-height: 680px;
  overflow-y: auto;
}

.wheel-history-day {
  display: grid;
  gap: 8px;
}

.wheel-history-day h3 {
  margin: 0;
  color: var(--lime);
  font-size: 16px;
  text-transform: capitalize;
}

.wheel-event-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(24, 216, 255, 0.22);
  border-left: 4px solid var(--cyan);
  background: rgba(255, 255, 255, 0.035);
}

.wheel-event-card.is-done {
  border-color: rgba(143, 255, 74, 0.28);
  border-left-color: var(--lime);
  background: rgba(143, 255, 74, 0.055);
}

.wheel-event-card.wheel-tier-epic,
.wheel-waiting-card.wheel-tier-epic {
  --wheel-tier-color: #bd80ff;
  border-color: rgba(189, 128, 255, 0.4);
  border-left-color: var(--wheel-tier-color);
  background: rgba(189, 128, 255, 0.08);
}

.wheel-event-card.wheel-tier-legendary,
.wheel-waiting-card.wheel-tier-legendary {
  --wheel-tier-color: #ffb168;
  border-color: rgba(255, 177, 104, 0.4);
  border-left-color: var(--wheel-tier-color);
  background: rgba(255, 177, 104, 0.08);
}

.wheel-tier-epic .wheel-event-header strong,
.wheel-tier-legendary .wheel-event-header strong,
.wheel-tier-epic .wheel-waiting-header strong,
.wheel-tier-legendary .wheel-waiting-header strong,
.wheel-tier-epic .wheel-tier-label,
.wheel-tier-legendary .wheel-tier-label {
  color: var(--wheel-tier-color);
}

.wheel-event-header,
.wheel-event-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.wheel-event-header strong {
  color: #fff;
}

.wheel-challenge-status,
.wheel-event-footer {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

.wheel-event-card.is-done .wheel-challenge-status {
  color: var(--lime);
}

.wheel-event-card p,
.wheel-event-card small {
  margin: 0;
}

.wheel-event-card small,
.wheel-result-description {
  color: var(--muted);
}

.wheel-result-description {
  font-size: 12px;
}

.wheel-event-times {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.wheel-event-times > span {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid rgba(24, 216, 255, 0.14);
  background: rgba(0, 0, 0, 0.14);
}

.wheel-event-times b {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.wheel-event-times time {
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.wheel-event-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.wheel-history-bulk-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.wheel-event-actions button {
  min-height: 36px;
  font-size: 10px;
}

.wheel-status-action {
  color: var(--lime);
  border-color: rgba(143, 255, 74, 0.42);
  background: rgba(143, 255, 74, 0.07);
}

.wheel-delete-action {
  color: #ff9898;
  border-color: rgba(255, 107, 107, 0.48);
  background: rgba(255, 107, 107, 0.09);
}

#cancelEdit[hidden] {
  display: none;
}

@media (max-width: 860px) {
  .history-layout {
    grid-template-columns: 1fr;
  }

  .archive-filter {
    grid-template-columns: 1fr;
  }

  .workday-header,
  .session-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .remove-session {
    width: 100%;
  }

  .session-archive,
  .wheel-history {
    max-height: none;
    overflow: visible;
  }

  .wheel-event-times {
    grid-template-columns: 1fr;
  }

  .wheel-waiting-details {
    grid-template-columns: 1fr;
  }

  .wheel-event-actions {
    grid-template-columns: 1fr;
  }

  .wheel-history-bulk-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .back-link {
    width: 100%;
    min-height: 48px;
    display: grid;
    place-content: center;
    text-align: center;
  }

  .secret-actions {
    grid-template-columns: 1fr;
  }

  .workday-header,
  .session-card-header,
  .wheel-waiting-header,
  .wheel-event-header,
  .wheel-event-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .wheel-waiting-status,
  .wheel-challenge-status {
    align-self: flex-start;
  }

  .wheel-history-panel,
  .wheel-waiting-panel {
    margin-top: 10px;
  }

  .wheel-history-note,
  .wheel-waiting-note,
  .wheel-result-description {
    font-size: 13px;
    line-height: 1.5;
  }

  .edit-order,
  .remove-session,
  .wheel-event-actions button,
  .wheel-history-bulk-actions button,
  .wheel-waiting-delete {
    min-height: 48px;
    touch-action: manipulation;
  }
}
