.collection-page-container {
  width: 100%;
  box-sizing: border-box;
}

.collection-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.collection-list-item {
  display: block;
  padding: 20px;
  border: 1px solid var(--myborder);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf8 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.collection-list-item:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.1);
  border-color: var(--myred);
}

.collection-list-item h3 {
  margin: 12px 0 6px;
  color: var(--myred);
  font-size: 1.08rem;
}

.collection-list-item p {
  margin: 0;
  color: var(--mygray);
}

.collection-progress-block {
  margin-top: 10px;
}

.collection-progress-label {
  margin: 0 0 6px;
  color: var(--mygray);
  font-size: 0.9rem;
}

.collection-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #f0e6e1;
  overflow: hidden;
}

.collection-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: #d9822b;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.collection-progress-fill-complete {
  background: #2a9d57;
}

.collection-section-title {
  margin-top: 28px;
}

.collection-card-topline,
.collection-meta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.collection-type-chip {
  display: inline-flex;
  align-items: center;
  background: #fff2ec;
  color: var(--myred);
  border: 1px solid #f1c7b7;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.85rem;
  font-weight: 600;
}

.collection-date,
.collection-meta-row span:not(.collection-type-chip) {
  color: var(--mygray);
  font-size: 0.92rem;
}

.collection-days-left {
  color: #0f5132;
  background: #d1e7dd;
  border: 1px solid #badbcc;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.collection-breadcrumb {
  margin-bottom: 8px;
  color: var(--mygray);
}

.collection-header-block {
.collection-problem-index {
  position: absolute;
  left: -26px;
  top: 8px;
  z-index: 5;
}

.collection-problem-index-with-controls {
  left: -40px;
}

.collection-problem-index-number {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #d3d3d3;
  background: #ffffff;
  color: #5f5f5f;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 0 4px;
}
  margin-bottom: 24px;
}

.collection-calendar {
  margin: 18px 0 26px;
  padding: 14px;
  border: 1px solid var(--myborder);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf8 100%);
}

.collection-calendar .subtitle {
  margin: 0 0 10px;
}

.collection-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.collection-calendar-weekdays {
  margin-bottom: 8px;
}

.collection-calendar-weekdays span {
  text-align: center;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--mygray);
}

.collection-calendar-days {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collection-calendar-day {
  min-height: 46px;
  border: 1px solid #e4ddd9;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.collection-calendar-create-button {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
}

.collection-calendar-create-button:hover .collection-calendar-day-number,
.collection-calendar-create-button:focus-visible .collection-calendar-day-number {
  color: #8a1f11;
  text-decoration: underline;
}

.collection-calendar-create-button:focus-visible {
  outline: 2px solid #c84a1a;
  outline-offset: 2px;
  border-radius: 6px;
}

.collection-calendar-dialog {
  border: 1px solid #e4ddd9;
  border-radius: 12px;
  padding: 0;
  width: min(92vw, 440px);
}

.collection-calendar-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.collection-calendar-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.collection-calendar-dialog-date {
  margin: 0;
  color: var(--mygray);
}

.collection-calendar-dialog-form input,
.collection-calendar-dialog-form select {
  width: 100%;
  box-sizing: border-box;
}

.collection-calendar-dialog-actions {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.collection-calendar-day-past {
  opacity: 0.28;
}

.collection-calendar-day-today {
  border-color: #c84a1a;
  box-shadow: inset 0 0 0 1px rgba(200, 74, 26, 0.2);
  background: #fff5ef;
}

.collection-calendar-day-today .collection-calendar-day-number {
  color: #8a1f11;
  font-weight: 700;
}

.collection-calendar-day-empty {
  border: 1px dashed #ece5e1;
  background: #fffdfc;
}

.collection-calendar-day-number {
  font-size: 0.86rem;
  color: #4f4f4f;
}

.collection-calendar-dots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.collection-calendar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d9822b;
}

.collection-calendar-dot-complete {
  background: #2a9d57;
}

.collection-problem-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.collection-problem-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--myborder);
  border-radius: 12px;
  padding: 18px;
  background: #ffffff;
}

.collection-problem-card h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.collection-problem-card p {
  margin: 0;
  color: var(--mygray);
}

.collection-problem-copy {
  min-width: 0;
}

.collection-side-panel p {
  margin: 0 0 12px;
}

.collection-side-controls {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #eadad4;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdfa 0%, #fff6f1 100%);
}

.collection-side-control-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.collection-side-control-label {
  color: #6f1c14;
  font-size: 0.92rem;
  font-weight: 700;
}

.collection-side-select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid #d8c7c1;
  border-radius: 10px;
  background: #fff;
  color: #2d201d;
  font: inherit;
}

.collection-side-checkbox {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #4a2c28;
  font-weight: 600;
}

.collection-side-checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: #8b1e16;
}

.collection-side-summary {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid #eadad4;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdfa 0%, #fff6f1 100%);
}

.collection-side-score-row {
  margin: 0;
}

.collection-side-progress-block {
  margin-top: 0;
}

.collection-score-delta-summary {
  font-weight: 700;
}

.collection-score-delta-summary-positive {
  color: #2a9d57;
}

.collection-score-delta-summary-negative {
  color: #b42318;
}

.collection-side-controls-compact {
  margin-top: 0;
}

.collection-score-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.collection-score-mode-button {
  border: 1px solid #d7c0b8;
  border-radius: 999px;
  background: #fff;
  color: #6f1c14;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.collection-score-mode-button:hover {
  transform: translateY(-1px);
  border-color: #b94c3d;
}

.collection-score-mode-button.is-active {
  background: linear-gradient(135deg, #8b1e16 0%, #c0392b 100%);
  border-color: #8b1e16;
  color: #fff;
}

@media (max-width: 768px) {
  .collection-problem-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .collection-page-container .problem-item-with-edit {
    margin-left: 36px;
    width: calc(100% - 36px);
  }

  .collection-order-controls {
    left: -34px;
  }

  .collection-problem-index-with-controls {
    left: -34px;
  }

  .collection-problem-card .back-button {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
}

.collection-page-container .problem-item-with-edit {
  padding-bottom: 58px;
  margin-left: 42px;
  width: calc(100% - 42px);
}

.collection-problem-index {
  position: absolute;
  left: -26px;
  top: 8px;
  z-index: 5;
}

.collection-problem-index-with-controls {
  left: -40px;
}

.collection-problem-index-number {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #d3d3d3;
  background: #ffffff;
  color: #5f5f5f;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 0 4px;
}

.collection-order-controls {
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 4;
}

.collection-order-button {
  width: 28px;
  height: 22px;
  border: 1px solid #d3d3d3;
  border-radius: 6px;
  background: #ffffff;
  color: #5f5f5f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 12px;
}

.collection-order-button:hover {
  color: #8a1f11;
  border-color: #8a1f11;
}

.collection-order-button:disabled {
  opacity: 0.35;
  cursor: default;
  color: #6f6f6f;
  border-color: #d3d3d3;
}

.collection-optional-pair-button {
  width: 28px;
  height: 22px;
  border: 1px solid #d3d3d3;
  border-radius: 6px;
  background: #ffffff;
  color: #5f5f5f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 12px;
}

.collection-optional-pair-button:hover {
  color: #8a1f11;
  border-color: #8a1f11;
}

.collection-optional-pair-button[data-enabled="true"] {
  background: #fff6eb;
  border-color: #d9822b;
  color: #8a1f11;
}

.collection-optional-pair-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.problem-item-optional-hover {
  box-shadow: inset 0 0 0 2px rgba(217, 130, 43, 0.45);
}

.problem-item-optional-linked {
  border-color: #f0c48b;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
}

.recommended-problem-item-in-exam {
  border-color: #f2c8c2;
  background: linear-gradient(180deg, #ffffff 0%, #fff4f2 100%);
}

.problem-reset-score-button:disabled,
.problem-page-break-button:disabled,
.visibility-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.collection-page-container .collection-add-wrapper-superuser {
  right: 184px;
}

.collection-remove-button {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #d3d3d3;
  background: #ffffff;
  color: #8a1f11;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.collection-remove-button:hover {
  border-color: #8a1f11;
  background-color: #ffe8e0;
}

.problem-reset-score-button {
  position: absolute;
  right: 96px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #d3d3d3;
  background: #ffffff;
  color: #666;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-weight: bold;
}

.problem-reset-score-button:hover {
  border-color: #666;
  background-color: #f5f5f5;
}

.problem-page-break-button {
  position: absolute;
  right: 138px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #d3d3d3;
  background: #ffffff;
  color: #666;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-weight: 700;
}

.problem-page-break-button:hover {
  border-color: #8a1f11;
  color: #8a1f11;
  background-color: #fff2ec;
}

.problem-page-break-button.is-active {
  border-color: #8a1f11;
  color: #8a1f11;
  background: #ffe8e0;
}

.collection-page-container .problem-link,
.collection-page-container .problem-link:hover {
  text-decoration: none;
}

.problem-score-editable {
  cursor: text;
}

.problem-score-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  text-align: inherit;
}

.problem-score-input:focus {
  outline: none;
}

.problem-score-editing .problem-score-label {
  display: none;
}

.problem-score-delta {
  margin-left: 6px;
  font-size: 0.72em;
  font-weight: 600;
}

.problem-score-delta-positive {
  color: #2a9d57;
}

.problem-score-delta-negative {
  color: #b42318;
}

.problem-score-editing .problem-score-delta {
  display: none;
}

  .collection-problem-index-number-editable {
    position: relative;
    z-index: 6;
    pointer-events: auto;
    cursor: text;
  }

  .collection-problem-index-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }

  .collection-problem-index-input {
    width: 2ch;
    min-width: 16px;
    max-width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    margin: 0;
    text-align: center;
    -moz-appearance: textfield;
  }

  .collection-problem-index-input::-webkit-outer-spin-button,
  .collection-problem-index-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  .collection-problem-index-input:focus {
    outline: none;
  }

  .collection-problem-index-editing .collection-problem-index-display {
    display: none;
  }

  .collection-problem-index-number-editable:focus-visible {
    outline: 2px solid #c84a1a;
    outline-offset: 2px;
  }

  /* Subscore badges at beginning of list items */
  .problem-subscore-badge {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 4px;
    padding: 4px 10px;
    background-color: #ffffff;
    color: #333;
    border: 1px solid #e8ddd8;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  .problem-subscore-badge-editable {
    cursor: text;
  }

  .problem-subscore-badge-editable:hover {
    background-color: #f9f5f3;
    border-color: #d3c7c0;
  }

  .problem-subscore-delta {
    margin-left: 4px;
    font-size: 0.8em;
    font-weight: 700;
  }

  .problem-subscore-toggle-container {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    margin-bottom: 4px;
    vertical-align: middle;
  }

  .problem-subscore-toggle {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: #8b1e16;
  }

  .problem-subpart-disabled {
    opacity: 0.45;
    transition: opacity 0.15s ease;
  }

  .problem-subpart-disabled .problem-subscore-badge {
    background-color: #f4f0ee;
  }

  /* Inline input for subscores */
  .problem-subscore-inline-input {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 4px;
    padding: 4px 10px;
    background-color: #ffffff;
    color: #333;
    border: 2px solid var(--myred);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    width: 80px;
    text-align: center;
  }

  .problem-subscore-inline-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 74, 26, 0.1);
  }
