/* 眼神追追追 - 統一樣式檔案 */

/* 基本重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Comic Sans MS", cursive, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
}

/* 畫面切換 - 統一邏輯 */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease-in-out;
}

.screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* 開始畫面 */
.title-container {
  text-align: center;
  margin-bottom: 40px;
}

.game-title {
  font-size: 3rem;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 10px;
}

.game-subtitle {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
}

.character-preview {
  margin-bottom: 40px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.menu-btn {
  padding: 15px 30px;
  font-size: 1.1rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
  font-family: inherit;
}

.menu-btn.primary {
  background: #4caf50;
  color: white;
}

.menu-btn.primary:hover {
  background: #45a049;
  transform: translateY(-2px);
}

.menu-btn {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
}

.menu-btn:hover {
  background: white;
  transform: translateY(-2px);
}

/* 角色設計 */
.character {
  width: 120px;
  height: 120px;
  background: #ffe4b5;
  border-radius: 50%;
  position: relative;
  border: 4px solid #deb887;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.eyes {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
}

.eye {
  width: 35px;
  height: 35px;
  background: white;
  border-radius: 50%;
  position: relative;
  border: 2px solid #333;
}

.pupil {
  width: 16px;
  height: 16px;
  background: #333;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.5s ease;
}

.mouth {
  width: 30px;
  height: 15px;
  border: 3px solid #333;
  border-top: none;
  border-radius: 0 0 30px 30px;
}

.mouth.happy {
  border-radius: 0 0 30px 30px;
}

.mouth.sad {
  border-radius: 30px 30px 0 0;
  border-top: 3px solid #333;
  border-bottom: none;
}

.mouth.surprised {
  border-radius: 50%;
  border: 3px solid #333;
  width: 20px;
  height: 20px;
}

/* 遊戲畫面 */
.game-header {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.star-counter {
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 1.2rem;
  font-weight: bold;
}

.star-icon {
  margin-right: 5px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
}

.back-btn:hover {
  background: white;
}

.game-area {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.item-container {
  position: absolute;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-container.top-left {
  top: 10%;
  left: 10%;
}

.item-container.top-right {
  top: 10%;
  right: 10%;
}

.item-container.bottom-left {
  bottom: 20%;
  left: 10%;
}

.item-container.bottom-right {
  bottom: 20%;
  right: 10%;
}

/* 2題佈局 */
.item-container.two-items-left {
  top: 50%;
  left: 15%;
  transform: translateY(-50%);
}

.item-container.two-items-right {
  top: 50%;
  right: 15%;
  transform: translateY(-50%);
}

/* 6題佈局 */
.item-container.six-items-top-left {
  top: 15%;
  left: 8%;
}

.item-container.six-items-top-right {
  top: 15%;
  right: 8%;
}

.item-container.six-items-middle-left {
  top: 50%;
  left: 8%;
  transform: translateY(-50%);
}

.item-container.six-items-middle-right {
  top: 50%;
  right: 8%;
  transform: translateY(-50%);
}

.item-container.six-items-bottom-left {
  bottom: 15%;
  left: 8%;
}

.item-container.six-items-bottom-right {
  bottom: 15%;
  right: 8%;
}

/* 題目管理介面樣式 */
#customItemsScreen {
  justify-content: flex-start !important;
  align-items: stretch !important;
  padding: 20px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.custom-items-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.items-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 15px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toolbar-right {
  display: flex;
  gap: 10px;
}

#categoryFilter,
#searchInput {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

#searchInput {
  min-width: 200px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: #4caf50;
  color: white;
}

.btn-primary:hover {
  background: #45a049;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-danger {
  background: #f44336;
  color: white;
}

.btn-danger:hover {
  background: #da190b;
}

.items-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-label {
  font-weight: bold;
  color: #666;
}

/* 簡約版題目管理樣式 */
.items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e0e0e0;
}

.items-header h2 {
  margin: 0;
  font-size: 24px;
  color: #333;
}

.btn-add {
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

.btn-add:hover {
  background: #45a049;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.items-toolbar-simple {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select,
.search-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  transition: border-color 0.2s ease;
}

.filter-select:focus,
.search-input:focus {
  outline: none;
  border-color: #4caf50;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  border-color: #4caf50;
  background: #f8fff8;
}

.items-stats-simple {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-badge {
  background: #f5f5f5;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  color: #666;
}

.stat-badge.custom {
  background: #e8f5e8;
  color: #2e7d32;
}

.stat-badge strong {
  color: #333;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  min-height: 300px;
  flex: 1;
  align-content: start;
}

.item-card {
  background: white;
  border: 2px solid #ddd;
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
}

.item-card:hover {
  border-color: #4caf50;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.item-card.custom {
  border-color: #2196f3;
}

.item-card-image {
  width: 80px;
  height: 80px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  border-radius: 8px;
  background: #f5f5f5;
}

.item-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.item-card-name {
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

.item-card-category {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}

.item-card-actions {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.item-card-actions button {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.page-btn {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: #4caf50;
  background: #f0f8f0;
}

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

/* 簡化分頁樣式 */
.pagination-simple {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}

.pagination-simple .page-btn {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.pagination-simple .page-btn:hover:not(:disabled) {
  border-color: #4caf50;
  background: #f8fff8;
}

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

.page-info {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

/* 返回按鈕樣式 */
.back-button-container {
  display: flex;
  justify-content: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
}

.btn-back {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.btn-back:hover {
  background: #e8e8e8;
  border-color: #bbb;
}

/* 桌機版編輯彈出視窗樣式 */
.modal-content-desktop {
  background: white;
  border-radius: 16px;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.modal-header-desktop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
}

.modal-header-desktop h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.close-btn-desktop {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn-desktop:hover {
  background: #e0e0e0;
  color: #333;
}

.modal-body-desktop {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  height: 100%;
}

.editor-left,
.editor-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e9ecef;
}

.section-title {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 圖片上傳區域 */
.image-upload-area-desktop {
  position: relative;
  width: 100%;
  height: 200px;
  border: 2px dashed #dee2e6;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
}

.image-upload-area-desktop:hover {
  border-color: #4caf50;
  background: #f8fff8;
}

.upload-placeholder-desktop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
}

.upload-icon-desktop {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.upload-text-desktop {
  font-size: 16px;
  font-weight: 500;
  color: #495057;
  margin-bottom: 8px;
}

.upload-hint-desktop {
  font-size: 12px;
  color: #6c757d;
  line-height: 1.4;
}

.image-preview-desktop {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.image-actions-desktop {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.btn-upload {
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.btn-upload:hover {
  background: #45a049;
  transform: translateY(-1px);
}

.btn-remove {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.btn-remove:hover {
  background: #c82333;
  transform: translateY(-1px);
}

/* Emoji選擇器 */
.emoji-selector-desktop {
  background: white;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e9ecef;
}

.emoji-grid-desktop {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.emoji-btn-desktop {
  width: 40px;
  height: 40px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f8f9fa;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn-desktop:hover {
  background: #e9ecef;
  transform: scale(1.1);
}

.emoji-btn-desktop.selected {
  border-color: #4caf50;
  background: #e8f5e8;
  transform: scale(1.1);
}

/* 表單樣式 */
.form-group-desktop {
  margin-bottom: 20px;
}

.form-label-desktop {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
}

.form-input-desktop {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s ease;
  background: white;
}

.form-input-desktop:focus {
  outline: none;
  border-color: #4caf50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-select-desktop {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.form-select-desktop:focus {
  outline: none;
  border-color: #4caf50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.char-counter-desktop {
  text-align: right;
  font-size: 12px;
  color: #6c757d;
  margin-top: 4px;
}

/* 預覽區域 */
.item-preview-desktop {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.preview-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.preview-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.preview-category {
  font-size: 14px;
  color: #6c757d;
  background: #f8f9fa;
  padding: 4px 12px;
  border-radius: 16px;
}

/* 底部按鈕區域 */
.modal-footer-desktop {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
}

.btn-cancel-desktop {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.btn-cancel-desktop:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.btn-save-desktop {
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.btn-save-desktop:hover {
  background: #45a049;
  transform: translateY(-1px);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .modal-content-desktop {
    max-width: 95%;
    margin: 20px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .emoji-grid-desktop {
    grid-template-columns: repeat(6, 1fr);
  }

  .modal-footer-desktop {
    flex-direction: column;
  }

  .btn-cancel-desktop,
  .btn-save-desktop {
    width: 100%;
  }
}

/* 彈出視窗樣式 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #666;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid #eee;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #333;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4caf50;
}

.char-counter {
  text-align: right;
  font-size: 12px;
  color: #666;
  margin-top: 5px;
}

.image-upload-area {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-upload-area:hover {
  border-color: #4caf50;
  background: #f8fff8;
}

.image-upload-area.dragover {
  border-color: #4caf50;
  background: #f0f8f0;
}

.upload-placeholder {
  text-align: center;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.upload-text {
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

.upload-hint {
  font-size: 12px;
  color: #666;
}

.image-preview {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
}

.image-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
}

.emoji-selector {
  margin-top: 10px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  max-width: 400px;
}

.emoji-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  border-color: #4caf50;
  background: #f0f8f0;
}

.emoji-btn.selected {
  border-color: #4caf50;
  background: #e8f5e8;
}

/* 設定項目樣式 */
.setting-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.setting-item label {
  min-width: 120px;
  font-weight: bold;
}

.setting-item input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.setting-item span {
  color: #666;
  font-size: 14px;
}

/* 幫助文字樣式 */
.help-text {
  background: #e8f4fd;
  border: 1px solid #bee5eb;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  font-size: 14px;
}

.help-text p {
  margin: 0 0 10px 0;
  color: #0c5460;
}

.help-text ul {
  margin: 0;
  padding-left: 20px;
  color: #0c5460;
}

.help-text li {
  margin-bottom: 5px;
}

/* 響應式設計改進 */
@media (max-width: 768px) {
  #customItemsScreen {
    padding: 10px 0;
  }

  .custom-items-container {
    padding: 0 10px;
    min-height: calc(100vh - 20px);
  }

  .items-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    justify-content: center;
  }

  .items-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .items-header h2 {
    font-size: 20px;
  }

  .items-toolbar-simple {
    flex-direction: column;
    gap: 10px;
  }

  .search-input {
    min-width: auto;
  }

  .items-stats-simple {
    justify-content: center;
    flex-wrap: wrap;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .item-card {
    padding: 10px;
  }

  .item-card-image {
    width: 60px;
    height: 60px;
    font-size: 36px;
  }

  .modal-content {
    width: 95%;
    margin: 10px;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* 超小螢幕優化 */
@media (max-width: 480px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  .item-card {
    padding: 8px;
  }

  .item-card-image {
    width: 50px;
    height: 50px;
    font-size: 28px;
  }

  .item-card-name {
    font-size: 12px;
  }

  .item-card-category {
    font-size: 10px;
  }

  .item-card-actions button {
    padding: 3px 6px;
    font-size: 10px;
  }

  .btn-add {
    padding: 8px 16px;
    font-size: 12px;
  }

  .filter-select,
  .search-input {
    font-size: 12px;
    padding: 6px 10px;
  }
}

.item {
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.item:hover {
  transform: scale(1.1);
  background: white;
  border-color: #4caf50;
}

.character-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.guide-line {
  position: absolute;
  width: 3px;
  background: linear-gradient(to bottom, rgba(255, 255, 0, 0.8), transparent);
  transform-origin: center top;
  opacity: 0;
  transition: all 0.5s ease;
  z-index: -1;
}

.guide-line.show {
  opacity: 1;
}

.game-ui {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
}

.instruction {
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 30px;
  border-radius: 25px;
  font-size: 1.1rem;
  text-align: center;
  max-width: 300px;
}

.game-controls {
  margin-top: 15px;
  display: flex;
  justify-content: center;
}

.next-question-btn {
  background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.next-question-btn:hover {
  background: linear-gradient(135deg, #ff5252, #ff7979);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.next-question-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.next-question-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 設定和家長中心 */
.settings-container,
.parent-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
}

.settings-container h2,
.parent-container h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

.setting-item {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-item label {
  font-weight: bold;
  margin-right: 15px;
}

.setting-item select,
.setting-item input {
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
}

.setting-buttons {
  text-align: center;
  margin-top: 30px;
}

/* 家長中心 */
.auth-container {
  text-align: center;
}

.auth-container p {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.auth-container input {
  padding: 10px;
  font-size: 1.1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  margin-right: 10px;
  width: 100px;
}

.auth-container button {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin: 5px;
}

#authBtn {
  background: #4caf50;
  color: white;
}

.parent-content {
  text-align: left;
}

.stats-container,
.controls-container {
  margin-bottom: 30px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

/* 眼神方向動畫 */
.pupil.look-top-left {
  transform: translate(-65%, -65%); /* 向左上看：更左+更上 */
}

.pupil.look-top-right {
  transform: translate(-35%, -65%); /* 向右上看：更右+更上 */
}

.pupil.look-bottom-left {
  transform: translate(-65%, -35%); /* 向左下看：更左+更下 */
}

.pupil.look-bottom-right {
  transform: translate(-35%, -35%); /* 向右下看：更右+更下 */
}

.pupil.look-left {
  transform: translate(-65%, -50%); /* 向左看：更左 */
}

.pupil.look-right {
  transform: translate(-35%, -50%); /* 向右看：更右 */
}

.pupil.look-center {
  transform: translate(-50%, -50%); /* 中央：居中 */
}

/* 動畫效果 */
@keyframes correctAnswer {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wrongAnswer {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes bounce {
  0%,
  20%,
  60%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  80% {
    transform: translateY(-5px);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(2px);
  }
}

.item.correct {
  animation: correctAnswer 1s ease;
}

.item.wrong {
  animation: wrongAnswer 0.5s ease;
  filter: grayscale(100%);
}

/* 角色選擇畫面 */
.character-select-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  max-width: 800px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.character-select-container h2 {
  color: #333;
  margin-bottom: 30px;
  font-size: 2rem;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.character-option {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  padding: 20px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  user-select: none; /* 防止文字選取 */
}

.character-option:hover:not(.selected) {
  transform: translateY(-5px);
  border-color: #4caf50;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.character-option.selected {
  cursor: default; /* 已選中的角色不顯示手型游標 */
}

.character-option.selected {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.character-option.selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  background: #4caf50;
  color: white;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.character-preview-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  margin-bottom: 15px;
}

.default-character {
  width: 100px;
  height: 100px;
}

.rabbit-character {
  max-width: 100px;
  max-height: 100px;
  object-fit: contain;
  border-radius: 10px;
}

.character-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
}

.select-character-btn {
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.select-character-btn:hover {
  background: #45a049;
  transform: scale(1.05);
}

.select-character-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.character-select-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .game-title {
    font-size: 2rem;
  }

  .item-container {
    width: 130px;
    height: 130px;
  }

  .item {
    width: 90px;
    height: 90px;
    font-size: 3rem;
  }

  .character {
    width: 100px;
    height: 100px;
  }

  .settings-container,
  .parent-container,
  .character-select-container {
    padding: 20px;
  }

  .character-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .character-option {
    padding: 15px;
  }

  .character-preview-wrapper {
    height: 80px;
  }

  .default-character {
    width: 70px;
    height: 70px;
  }

  .rabbit-character {
    max-width: 70px;
    max-height: 70px;
  }

  .character-name {
    font-size: 1rem;
  }
}

/* 兔子角色樣式 */
.rabbit-character {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rabbit-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

/* 兔子圖片眼神方向模擬 - 使用輕微的移動和傾斜 */
.rabbit-image.look-left {
  transform: translateX(-3px) rotate(-1deg);
}

.rabbit-image.look-right {
  transform: translateX(3px) rotate(1deg);
}

.rabbit-image.look-up {
  transform: translateY(-2px) scale(1.02);
}

.rabbit-image.look-down {
  transform: translateY(2px) scale(0.98);
}

.rabbit-image.look-top-left {
  transform: translateX(-2px) translateY(-2px) rotate(-1deg);
}

.rabbit-image.look-top-right {
  transform: translateX(2px) translateY(-2px) rotate(1deg);
}

.rabbit-image.look-bottom-left {
  transform: translateX(-2px) translateY(2px) rotate(-1deg);
}

.rabbit-image.look-bottom-right {
  transform: translateX(2px) translateY(2px) rotate(1deg);
}

.rabbit-eyes-overlay {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 30%;
  display: none; /* 隱藏兔子的眼睛覆蓋層，避免與原圖眼睛重疊 */
  align-items: center;
  justify-content: center;
  gap: 15px;
  pointer-events: none;
}

.rabbit-eye {
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  position: relative;
  opacity: 1;
  border: 1px solid rgba(0, 0, 0, 0.3);
}

.rabbit-pupil {
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.5s ease;
}

/* 兔子眼神方向 */
.rabbit-pupil.look-top-left {
  transform: translate(-70%, -70%);
}

.rabbit-pupil.look-top-right {
  transform: translate(-30%, -70%);
}

.rabbit-pupil.look-bottom-left {
  transform: translate(-70%, -30%);
}

.rabbit-pupil.look-bottom-right {
  transform: translate(-30%, -30%);
}

.rabbit-pupil.look-left {
  transform: translate(-70%, -50%);
}

.rabbit-pupil.look-right {
  transform: translate(-30%, -50%);
}

.rabbit-pupil.look-up {
  transform: translate(-50%, -70%);
}

.rabbit-pupil.look-down {
  transform: translate(-50%, -30%);
}
