/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

.btn--primary {
  background-color: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background-color: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn--green {
  background-color: #1a7a3a;
  color: #fff;
}

.btn--green:hover {
  background-color: #15612e;
  box-shadow: var(--shadow-md);
}

.btn--secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn--secondary:hover {
  background-color: var(--bg-hover);
}

.btn--ghost {
  background: none;
  color: var(--text-secondary);
}

.btn--ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.btn--block {
  width: 100%;
}

.btn--lg {
  padding: 16px 32px;
  font-size: 1.125rem;
}

.btn--sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn--vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 24px;
  font-size: 1.3rem;
  line-height: 1;
  flex: 1;
  min-width: 0;
}

.btn-vertical-spacer {
  display: block;
  height: 1em;
}

.mode-desc-area {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  height: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn--danger-outline {
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn--danger-outline:hover {
  background: var(--danger-light);
}

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

/* ===== Cards ===== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-color);
}

.card--interactive:active {
  transform: scale(0.98);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeInOverlay 0.15s ease;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal__body {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  animation: toastIn 0.25s ease;
  pointer-events: auto;
  white-space: nowrap;
}

.toast--success {
  border-color: var(--success);
  background: var(--success-light);
}

.toast--error {
  border-color: var(--danger);
  background: var(--danger-light);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

/* ===== Form Elements ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input--lg {
  padding: 14px 18px;
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.3em;
}

.form-select {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
}

/* ===== Checkbox / Toggle ===== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-label {
  font-size: 0.95rem;
}

.toggle-sublabel {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 14px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle__slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}

.toggle input:checked + .toggle__slider {
  background: var(--accent);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(20px);
}

/* ===== Checkbox Grid ===== */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.checkbox-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
  -webkit-tap-highlight-color: transparent;
}

.checkbox-chip input {
  display: none;
}

.checkbox-chip--checked {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  gap: 0;
}

.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ===== Stat ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== List ===== */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item__rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.list-item__image {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.list-item__info {
  flex: 1;
  min-width: 0;
}

.list-item__primary {
  font-weight: 600;
}

.list-item__secondary {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== Loading ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px;
  color: var(--text-muted);
}

.loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Section ===== */
.section {
  margin-bottom: 24px;
}

.section__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
