/* RESET & BASE STYLES */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
  background-color: #f0f2f5; 
  color: #333;
  touch-action: pan-y; /* Chỉ cho phép cuộn lên xuống, chặn kéo ngang */
  overflow-x: hidden; /* Chặn cuộn ngang tuyệt đối */
  overscroll-behavior-x: none;
}

/* HEADER */
header { background-color: #1976d2; color: white; padding: 15px 20px; font-size: 1.2rem; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* LAYOUT (RESPONSIVE) */
.container { overflow: hidden; display: flex; flex-direction: column; gap: 30px; padding: 20px; max-width: 1000px; margin: 0 auto; margin-top: 20px; }
@media (min-width: 768px) {
  .container { flex-direction: row; align-items: center; }
  .left-col { flex: 2; }
  .right-col { flex: 1; height: 450px; }
}

/* WHEEL STYLES */
.wheel-wrapper { 
  position: relative; width: 100%; max-width: 450px; aspect-ratio: 1; margin: 0 auto; 
  cursor: pointer; /* Biến cả vòng quay thành nút bấm */
}
.pointer {
  position: absolute; right: -15px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0; z-index: 10;
  border-top: 15px solid transparent; border-bottom: 15px solid transparent; border-right: 30px solid #fbc02d; /* Đổi mũi tên sang màu vàng giống bản gốc */
  filter: drop-shadow(-3px 0px 2px rgba(0,0,0,0.3));
}
.wheel {
  width: 100%; height: 100%; border-radius: 50%; border: 8px solid white;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2); position: relative; overflow: hidden;
  /* CSS transition sẽ được JS thêm vào lúc bấm quay để mượt mà nhất */
}

/* Đồ trang trí thêm cho giống wheelofnames */
.center-circle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 22%; height: 22%; background: white; border-radius: 50%; z-index: 5;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.tap-to-spin {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-10deg);
  z-index: 6; color: white; font-weight: 800; font-size: 1.8rem; font-family: 'Arial', sans-serif;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.4); pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Text trong miếng bánh */
.slice-text {
  position: absolute; top: 50%; left: 50%; width: 50%; 
  height: 40px; /* Tăng chiều cao lên để chứa vừa chữ lớn hơn (trước là 30px) */
  margin-top: -20px; /* Ép tâm quay: luôn bằng đúng MỘT NỬA chiều cao (height / 2) */
  transform-origin: 0% 50%; 
  display: flex; align-items: center; justify-content: flex-end; 
  padding-right: 20px; 
  padding-left: 22%; 
  color: white; font-weight: bold; 
  font-size: 1.8rem; /* TĂNG CỠ CHỮ Ở ĐÂY (trước đó là 1.2rem, bạn có thể tăng lên 2rem nếu muốn to hơn nữa) */
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* LỊCH SỬ TRÚNG THƯỞNG */
.history-container { 
  margin-top: 30px; 
  background: white; 
  padding: 15px 20px; 
  border-radius: 8px; 
  box-shadow: 0 2px 10px rgba(0,0,0,0.05); 
  height: 200px; /* Cố định chiều cao */
  display: flex;
  flex-direction: column;
}
.history-list { 
  list-style: none; 
  margin-top: 10px; 
  overflow-y: auto; /* Tự động có thanh cuộn nếu lịch sử quá dài */
  flex-grow: 1;
  padding-right: 5px;
}
.history-item { 
  padding: 10px; 
  border-bottom: 1px solid #eee; 
  font-size: 1.2rem; 
  color: #e91e63; /* Màu hồng nổi bật cho người thắng */
  font-weight: bold; 
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.history-item span { 
  color: #888; 
  font-size: 0.9rem; 
  font-weight: normal; 
}

/* Tùy chỉnh thanh cuộn cho đẹp */
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.list-container { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); height: 100%; display: flex; flex-direction: column; }
.list-title { margin-bottom: 10px; font-size: 1.1rem; }
textarea { flex-grow: 1; width: 100%; min-height: 200px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 1rem; resize: none; outline: none; }
textarea:focus { border-color: #0070f3; }

/* MODAL STYLES */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 100;
}
.modal-overlay.active { display: flex; }
.modal-content { background: white; padding: 30px; border-radius: 12px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 10px 30px rgba(0,0,0,0.3); animation: popIn 0.3s ease-out; }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 1.5rem; margin-bottom: 15px; color: #333; }
.winner-name { font-size: 2.5rem; color: #e91e63; margin-bottom: 25px; word-break: break-word; }
.modal-actions button { padding: 10px 20px; font-size: 1rem; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; margin: 0 5px; }
.btn-close { background-color: #e0e0e0; color: #333; }
.btn-close:hover { background-color: #ccc; }
.btn-remove { background-color: #f44336; color: white; }
.btn-remove:hover { background-color: #d32f2f; }