/* --- GLOBAL TYPOGRAPHY --- */
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #fafafa;
  color: #111;
}

h1 { font-size: 20px; margin: 0 0 10px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.5px; color: #666; }
p { margin: 8px 0; line-height: 1.5; }

/* --- FORM ELEMENTS (Radios & Checkboxes) --- */
/* This makes the native inputs matching blue */
input[type="checkbox"], 
input[type="radio"] {
  accent-color: #0066cc;
  cursor: pointer;
}

/* --- LAYOUT UTILITIES --- */
.wrap { max-width: 900px; margin: 0 auto; padding: 24px; }

.card {
  background: white;
  border: 2px solid #e6e6e6;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 15px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  
}

.row {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.col {
  flex: 1 1 300px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stack-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* --- COMPONENTS: PROGRESS BAR --- */
.progress-track {
  background: #eee;
  height: 8px;
  border-radius: 4px;
  margin: 5px 0 25px;
  overflow: hidden;
}

.progress-fill {
  background: #0066cc; 
  height: 100%;
  transition: width 0.3s ease;
}

/* --- COMPONENTS: ACTION CHIPS (SELECTION GRID) --- */
.actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.action {
  display: flex;
  flex-direction: column;
  align-items: center;         /* Horizontally center items */
  justify-content: flex-start; /* Align items to the Top */
  text-align: center;
  
  background: #fff;
  border: 2px solid #eee;
  border-radius: 8px;
  padding: 16px 12px;          /* Added Padding: Top/Bottom 16px, Left/Right 12px */
  
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 110px;           /* Taller minimum height to fit descriptions cleanly */
  height: 100%;                /* Fill the grid cell height */
  box-sizing: border-box;
}

/* Hide the actual checkbox inside the chip */
.action input {
  display: none;
}

/* Typography inside the chip */
.action b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px; /* Space between Label and Description */
  color: #222;
  line-height: 1.2;
}

.action .muted {
  font-size: 12px;
  line-height: 1.35;
  color: #666;
  font-weight: 400;
}

/* SELECTED STATE: Chip styling */
label.action:has(input:checked) {
  border-color: #0066cc;
  background: #f0f7ff;
  box-shadow: 0 4px 10px rgba(0, 102, 204, 0.15);
  transform: translateY(-2px);
}

label.action:has(input:checked) b {
  color: #0066cc;
}

/* DISABLED STATE */
.action.disabled {
  opacity: 0.5;
  filter: grayscale(100%);
  cursor: not-allowed;
  border-color: #f0f0f0;
  background: #f9f9f9;
}

/* --- COMPONENTS: RANKING LIST --- */
.ranklist {
  list-style: none;
  padding: 12px;
  margin: 10px 0 0;
  background: #fafafa;
  border: 1px dashed #ccc;
  border-radius: 8px;
  min-height: 120px;
}

.rankitem {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  cursor: grab;
}

.rankitem:active {
  cursor: grabbing;
}

.rank-idx {
  font-family: monospace;
  font-weight: bold;
  color: #bbb;
  margin-right: 12px;
  font-size: 1.2em;
}

.handle {
  color: #aaa;
  font-size: 18px;
  user-select: none;
}

/* --- COMPONENTS: BUTTONS & FORMS --- */
.btnbar {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

/* Global Button Style (Blue) */
button {
  background: #0066cc;
  border: 1px solid #005bb5;
  color: white;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  background: #005bb5;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:disabled {
  background: #ccc;
  border-color: #bbb;
  opacity: 0.7;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: white;
  font-size: 14px;
}

/* --- MOBILE SORTING BUTTONS (Overrides Global Button) --- */
.sort-controls {
  display: flex;
  gap: 6px;
}

/* Explicitly set background to Gray and text to Blue */
.sort-btn {
  background: #f0f0f0 !important; 
  color: #0066cc !important;      
  border: 1px solid #d0d0d0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  line-height: 1;
  box-shadow: none;
}

/* On Click/Active: Flip to Blue background, White text */
.sort-btn:active {
  background: #0066cc !important;
  color: #ffffff !important;
  border-color: #005bb5;
}

/* --- UTILITIES --- */
.muted { color: #666; font-size: 13px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; background: #eee; font-size: 12px; font-weight: 600; }
.error { color: #d32f2f; font-size: 13px; margin-top: 8px; font-weight: 500; }
.mono { font-family: ui-monospace, monospace; }