:root {
  color-scheme: dark;
  --sort-gold: #d4af37;
  --sort-gold-soft: #f3d76a;
  --sort-ink: #eefaff;
  --sort-panel: rgba(8, 8, 8, 0.92);
  --sort-line: rgba(212, 175, 55, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}

body {
  position: relative;
  z-index: 1;
  color: var(--sort-ink);
  font-family: Arial, Helvetica, sans-serif;
}

.thoughts-sort {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem 7.5rem;
}

.thoughts-sort[hidden] {
  display: none !important;
}

.thoughts-sort__head {
  text-align: center;
  margin-bottom: 1rem;
}

.thoughts-sort__back {
  display: inline-block;
  margin-bottom: 0.55rem;
  color: var(--sort-gold-soft);
  text-decoration: none;
  font-size: 0.92rem;
}

.thoughts-sort__back:hover {
  color: #fff0b0;
}

.thoughts-sort__title {
  margin: 0.2rem 0 0.45rem;
  font-family: "Uncial Antiqua", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 5vw, 2rem);
  background-image: linear-gradient(180deg, #fff6c8 0%, #f3d76a 28%, #d4af37 58%, #8a6218 88%, #5c3d0e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.thoughts-sort__lead {
  margin: 0 auto;
  max-width: 36rem;
  color: rgba(238, 250, 255, 0.78);
  font-size: 0.92rem;
  line-height: 1.45;
}

.thoughts-sort__status {
  margin: 0 0 0.85rem;
  text-align: center;
  color: rgba(238, 250, 255, 0.7);
  font-size: 0.9rem;
}

.thoughts-sort__list {
  display: grid;
  gap: 0.75rem;
}

.thoughts-sort__card {
  border: 1px solid var(--sort-line);
  border-radius: 12px;
  background: var(--sort-panel);
  padding: 0.75rem 0.8rem 0.85rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.thoughts-sort__card-title {
  margin: 0 0 0.35rem;
  font-family: Cinzel, "Times New Roman", serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--sort-gold-soft);
  line-height: 1.25;
}

.thoughts-sort__media {
  position: relative;
  width: min(100%, 280px);
  margin: 0.35rem auto 0.55rem;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: #0a0c0e;
}

.thoughts-sort__media-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.thoughts-sort__media-badge {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.55);
  background: rgba(0, 0, 0, 0.72);
  color: var(--sort-gold-soft);
  font-family: Cinzel, "Times New Roman", serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.thoughts-sort__card-preview {
  margin: 0 0 0.65rem;
  color: rgba(238, 250, 255, 0.72);
  font-size: 0.84rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thoughts-sort__card-preview[hidden] {
  display: none !important;
}

.thoughts-sort__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

@media (min-width: 640px) {
  .thoughts-sort__options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.thoughts-sort__option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(40, 30, 10, 0.95), rgba(10, 8, 5, 0.98));
  color: var(--sort-gold-soft);
  font-family: Cinzel, "Times New Roman", serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.thoughts-sort__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.thoughts-sort__option:has(input:checked) {
  border-color: rgba(255, 220, 120, 0.95);
  color: #fff6c8;
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 150, 0.22),
    0 0 0 1px rgba(212, 175, 55, 0.35);
}

.thoughts-sort__footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--sort-line);
  background: linear-gradient(180deg, rgba(12, 10, 8, 0.94), rgba(0, 0, 0, 0.96));
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
}

.thoughts-sort__progress {
  margin: 0;
  min-width: 9rem;
  text-align: center;
  font-size: 0.86rem;
  color: rgba(238, 250, 255, 0.75);
}

.thoughts-sort__save {
  appearance: none;
  border: 1px solid rgba(212, 175, 55, 0.8);
  border-radius: 999px;
  min-width: 7.2rem;
  min-height: calc(7.2rem * 93 / 360);
  padding: 0.45rem 1.4rem;
  background: linear-gradient(180deg, rgba(48, 36, 12, 0.98), rgba(12, 10, 6, 0.98));
  color: var(--sort-gold-soft);
  font-family: Cinzel, "Times New Roman", serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.thoughts-sort__save:hover:not(:disabled) {
  filter: brightness(1.06);
  color: #fff0b0;
}

.thoughts-sort__save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
