/* Trello-like board layout */
body {
  position: relative;
  overflow-x: hidden;
}

.back-link {
  position: fixed;
  left: 1.5rem;
  top: 1.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b8a87;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  z-index: 10;
}

.back-link:hover {
  color: #f4c23b;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(244, 194, 59, 0.3);
}

.header {
  position: relative;
  margin-bottom: 2rem;
  padding-top: 2.5rem;
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem 0 0;
  margin-top: 1rem;
}

.recommended-btn {
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #8b8a87;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.recommended-btn:hover {
  color: #7ab87a;
  background: rgba(122, 184, 122, 0.1);
  border-color: rgba(122, 184, 122, 0.3);
}

.settings-link-btn {
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #8b8a87;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.settings-link-btn:hover {
  color: #f4c23b;
  background: rgba(244, 194, 59, 0.1);
  border-color: rgba(244, 194, 59, 0.3);
}

.trello-board {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0 2rem;
  align-items: flex-start;
}

/* Trello column */
.trello-column {
  flex: 0 0 260px;
  min-width: 260px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
}

.trello-column[data-box="1"] .column-header { border-top-color: #5b9bd5; }
.trello-column[data-box="2"] .column-header { border-top-color: #7ab87a; }
.trello-column[data-box="3"] .column-header { border-top-color: #e8a838; }
.trello-column[data-box="4"] .column-header { border-top-color: #c47b7b; }
.trello-column[data-box="5"] .column-header { border-top-color: #9b7bb8; }

.column-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-top: 3px solid transparent;
  border-radius: 12px 12px 0 0;
}

.column-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e8e6e3;
  margin: 0;
}

.learning-since {
  font-size: 0.8rem;
  color: #6b6a68;
  margin-top: 0.5rem;
  font-weight: 500;
}

.edit-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: #8b8a87;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.edit-mode-btn:hover {
  color: #e8e6e3;
  background: rgba(255, 255, 255, 0.1);
}

.edit-mode-btn.active {
  color: #f4c23b;
  background: rgba(244, 194, 59, 0.12);
  border-color: rgba(244, 194, 59, 0.3);
}

.edit-mode-icon {
  font-size: 1rem;
  opacity: 0.9;
}

.date-controls.debug-only[hidden],
.column-move-buttons.debug-only[hidden] {
  display: none;
}

.column-move-buttons {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.move-btn {
  padding: 0.2rem 0.5rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b8a87;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.move-btn:hover:not(:disabled) {
  color: #e8e6e3;
  background: rgba(255, 255, 255, 0.1);
}

.move-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.date-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #6b6a68;
}

.date-controls .date-label {
  font-weight: 500;
}

.date-controls .date-value {
  font-weight: 600;
  color: #8b8a87;
}

.date-controls .date-value.simulated {
  color: #e8a838;
}

.date-buttons {
  display: flex;
  gap: 0.25rem;
}

.date-btn {
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: #8b8a87;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.date-btn:hover {
  color: #e8e6e3;
  background: rgba(255, 255, 255, 0.1);
}

.column-header .schedule {
  display: block;
  font-size: 0.8rem;
  color: #8b8a87;
  font-weight: 500;
  margin-top: 0.25rem;
}

.column-cards {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Continent card */
.continent-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.continent-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(244, 194, 59, 0.25);
  transform: translateY(-1px);
}

.continent-card.empty {
  opacity: 0.4;
  cursor: default;
}

.continent-card.locked {
  opacity: 0.65;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.04);
}

.continent-card.locked:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  transform: none;
}

.continent-card .lock-icon {
  font-size: 0.75em;
  opacity: 0.8;
  margin-left: 0.25rem;
}

.continent-card .lock-days {
  font-size: 0.85em;
  font-weight: 500;
  color: #8b8a87;
  margin-left: 0.2rem;
}

.continent-card .continent-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e8e6e3;
}

.continent-card .card-count {
  font-size: 0.8rem;
  color: #8b8a87;
  margin-top: 0.25rem;
}

.continent-card .card-count strong {
  color: #f4c23b;
  font-weight: 600;
}

.continent-card .continent-card-main {
  flex: 1;
}

.continent-card .region-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.region-btn {
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: #8b8a87;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.region-btn:hover {
  color: #e8e6e3;
  background: rgba(255, 255, 255, 0.1);
}

.region-btn.combine-btn:hover {
  color: #7ab87a;
}

.region-btn.divide-btn:hover {
  color: #5b9bd5;
}

/* Responsive: tablet and below */
@media (max-width: 900px) {
  .trello-board {
    flex-wrap: wrap;
    justify-content: center;
  }

  .trello-column {
    flex: 1 1 200px;
    min-width: 200px;
    max-width: 280px;
  }
}

/* Unfolded foldables / wide tablets: wider columns, scroll horizontally */
@media (min-width: 600px) and (max-width: 900px) {
  .trello-board {
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-self: flex-start;
    width: 100%;
    max-width: 100%;
    padding: 0.5rem 1rem 2rem 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .trello-column {
    flex: 0 0 240px;
    min-width: 240px;
    max-width: 240px;
  }
}

/* Responsive: mobile */
@media (max-width: 600px) {
  .header {
    padding-top: 3rem;
    margin-bottom: 1rem;
  }

  .trello-board {
    padding: 0.5rem 1rem 2rem 1rem;
    overflow-x: auto;
    overflow-y: visible;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    /* Left-align so Box 1 is visible; constrain width for scroll container */
    align-self: flex-start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .trello-column {
    flex: 0 0 220px;
    min-width: 220px;
    max-width: 220px;
  }

  .page-footer {
    padding: 1.5rem 1rem 0;
  }

  .back-link {
    left: 0.75rem;
    top: 0.75rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
}
