* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  background: #ffffff;
  color: #000000;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 16px;
  padding-bottom: 80px;
}

/* Header */
.header {
  margin-bottom: 32px;
}

.header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 20px;
  color: #000000;
}

.current-mode {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #000000;
  color: #ffffff;
  border-radius: 24px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.current-mode .emoji {
  font-size: 24px;
}

/* Modes Grid */
.modes-grid {
  display: flex;
  flex-direction: column;
  gap: 48px;
  margin-bottom: 32px;
}

.modes-column {
  display: flex;
  flex-direction: column;
}

.modes-column h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: left;
}

/* Modes List */
.modes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 100px;
}

.mode-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid #e5e5e5;
}

.mode-item:active {
  transform: scale(0.98);
}

.mode-item.active {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

/* iOS Toggle */
.mode-item .toggle {
  width: 51px;
  height: 31px;
  background: #e5e5e5;
  border-radius: 16px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.mode-item .toggle::after {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  top: 2px;
  left: 2px;
  transition: all 0.2s ease;
}

.mode-item.active .toggle {
  background: #34C759;
}

.mode-item.active .toggle::after {
  left: 22px;
}

.mode-item .emoji {
  font-size: 28px;
  flex-shrink: 0;
}

.mode-item .name {
  flex: 1;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.4px;
}

.mode-item .edit-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.mode-item .edit-btn:hover {
  opacity: 1;
}

.mode-item.active .edit-btn {
  opacity: 0.7;
}

/* Add Button */
.add-mode-btn {
  width: 100%;
  padding: 16px;
  background: #000000;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: -0.4px;
}

.add-mode-btn:active {
  transform: scale(0.98);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.15s ease;
}

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

.modal-content {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 320px;
  animation: slideUp 0.2s ease;
}

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

.modal-content h2 {
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.5px;
}

.modal-content input {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  border: 1.5px solid #e5e5e5;
  border-radius: 10px;
  font-size: 17px;
  background: #ffffff;
  color: #000000;
  transition: border-color 0.15s;
  letter-spacing: -0.3px;
}

.modal-content input:focus {
  outline: none;
  border-color: #000000;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.modal-buttons button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: -0.3px;
}

.btn-cancel {
  background: #f5f5f5;
  color: #000000;
}

.btn-save {
  background: #000000;
  color: #ffffff;
}

.btn-delete {
  background: #FF3B30;
  color: #ffffff;
}

.modal-buttons button:active {
  transform: scale(0.96);
}

/* Loading */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e5e5;
  border-top-color: #000000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: #000000;
  color: #ffffff;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  z-index: 3000;
  transition: all 0.2s ease;
  pointer-events: none;
  letter-spacing: -0.3px;
}

.toast.show {
  transform: translate(-50%, -50%) scale(1);
}

/* Drag */
.mode-item.dragging {
  opacity: 0.4;
}

.mode-item.drag-over {
  border-color: #000000;
}

/* Toast variants */
.toast.error {
  background: #ff3333;
}

.toast.success {
  background: #00b894;
}

.toast.info {
  background: var(--tg-theme-button-color, #0074e4);
}
