/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 透明背景支持，適配任何iframe背景 */
html {
  background: transparent !important;
  background-color: transparent !important;
  color-scheme: light !important;
  height: 100%;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: transparent !important;
  background-color: transparent !important;
  color: #333;
  text-align: center;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 10px;
  position: relative;
}

h1 {
  margin-bottom: 10px;
  /* 文字陰影確保在任何背景下都可讀 */
  text-shadow: 
    1px 1px 2px rgba(255,255,255,0.8),
    -1px -1px 2px rgba(0,0,0,0.3);
}

/* ===== 響應式 3D 場景背景 ===== */
#scene-container {
  position: relative;
  width: min(90vw, 700px);
  height: min(90vw, 700px);
  margin: 0 auto;
  background: url('images/basket-bg.png') center/contain no-repeat;
  overflow: visible;
  perspective: 1200px; 
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  z-index: 0;
}

/* 響應式斷點 */
@media (max-width: 768px) {
  #scene-container {
    width: min(95vw, 600px);
    height: min(95vw, 600px);
  }
}

@media (max-width: 480px) {
  #scene-container {
    width: min(100vw, 500px);
    height: min(100vw, 500px);
  }
}

/* ===== 響應式留言表單 ===== */
.comment-form-container {
  position: absolute;
  top: 70%;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90%, 600px);
  width: 100%;
  z-index: 20;
  padding: 0 10px;
}

@media (max-width: 768px) {
  .comment-form-container {
    top: 75%;
    max-width: 95%;
  }
}

@media (max-width: 480px) {
  .comment-form-container {
    top: 80%;
    max-width: 98%;
    padding: 0 5px;
  }
}

.comment-form {
  /* 增強深色背景下的毛玻璃效果 */
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(20px) brightness(1.1);
  -webkit-backdrop-filter: blur(20px) brightness(1.1);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 1px 3px rgba(255,255,255,0.3);
}

@media (max-width: 480px) {
  .comment-form {
    padding: 15px;
    border-radius: 12px;
  }
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .file-upload {
    width: 100% !important;
  }
  
  /* 讓昵稱和位置在手機上也保持同一行 */
  .form-row:first-child {
    flex-direction: row;
    gap: 8px;
  }
  
  .form-row:first-child input {
    flex: 1;
    min-width: 0;
  }
}

.form-row input,
.form-row textarea {
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  font-size: 14px;
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(10px) brightness(1.2);
  -webkit-backdrop-filter: blur(10px) brightness(1.2);
  color: #333;
  transition: all 0.3s ease;
  
  /* 增強文字可讀性 */
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
  box-shadow: 
    inset 0 1px 3px rgba(0,0,0,0.1),
    0 1px 2px rgba(255,255,255,0.4);
}

@media (max-width: 480px) {
  .form-row input,
  .form-row textarea {
    padding: 10px;
    font-size: 16px; /* 防止iOS縮放 */
  }
}

.form-row input::placeholder,
.form-row textarea::placeholder {
  color: rgba(0,0,0,0.7);
  text-shadow: 0 1px 1px rgba(255,255,255,0.6);
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border: 1px solid rgba(74,74,255,0.8);
  background: rgba(255,255,255,0.45);
  box-shadow: 
    0 0 0 3px rgba(74,74,255,0.2),
    0 2px 10px rgba(74,74,255,0.15),
    inset 0 1px 3px rgba(0,0,0,0.1);
}

textarea {
  height: 80px;
  resize: vertical;
}

@media (max-width: 480px) {
  textarea {
    height: 60px;
  }
}

.file-upload {
  position: relative;
  width: 150px;
}

.file-upload input {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-label {
  display: block;
  padding: 12px;
  border: 1px dashed rgba(74,74,255,0.8);
  border-radius: 8px;
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(10px) brightness(1.2);
  -webkit-backdrop-filter: blur(10px) brightness(1.2);
  color: #4A4AFF;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
  box-shadow: 
    inset 0 1px 3px rgba(0,0,0,0.1),
    0 1px 2px rgba(255,255,255,0.4);
}

.file-upload-label:hover {
  background: rgba(255,255,255,0.45);
  border-color: #4A4AFF;
  transform: translateY(-1px);
  box-shadow: 
    0 2px 8px rgba(74,74,255,0.3),
    inset 0 1px 3px rgba(0,0,0,0.1),
    0 1px 2px rgba(255,255,255,0.5);
}

/* ===== 圖片預覽樣式 ===== */
.image-preview {
  margin-top: 8px;
  padding: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.image-preview img {
  max-width: 80px;
  max-height: 80px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.image-preview button {
  margin-left: 8px;
  padding: 4px 8px;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  text-shadow: none;
}

.image-preview button:hover {
  background: #ff6666;
  transform: scale(1.1);
}

.submit-btn {
  width: 100%;
  padding: 14px;
  background: #3838FF !important;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff !important;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 15px rgba(56,56,255,0.4),
    0 2px 4px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.submit-btn:hover {
  background: #4A4AFF !important;
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(56,56,255,0.5),
    0 4px 8px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 480px) {
  .submit-btn {
    padding: 12px;
    font-size: 15px;
  }
}

#statusMessage {
  margin-top: 10px;
  font-size: 14px;
  min-height: 18px;
  color: #444;
  text-shadow: 
    1px 1px 2px rgba(255,255,255,0.8),
    -1px -1px 1px rgba(0,0,0,0.3);
}

/* ===== 響應式 CSS3D 留言卡 - 實色彩色背景 ===== */
.comment-card {
  position: relative;
  display: inline-block;
  max-width: 300px;
  padding: 20px 16px;
  /* 基礎白色背景 */
  background: rgba(255,255,255, 1) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255);
  border-radius: 8px;
  box-shadow: 
    0 2px 8px rgba(0,0,0,0.2),
    0 1px 2px rgba(0,0,0,0.1);
  font-size: 16px;
  line-height: 1.4;
  transition: all 0.3s ease;
  z-index: 2;
  backface-visibility: visible !important;
  color: #333 !important;
}

/* 有圖片的留言卡片 - 更大尺寸 */
.comment-card.has-image {
  max-width: 400px;
  padding: 24px 20px;
}

/* 有圖片的留言卡片中的名字樣式 */
.comment-card.has-image .comment-header {
  margin-bottom: 16px;
}

.comment-card.has-image strong {
  font-size: 0.9em;
}

.comment-card.has-image .comment-location {
  font-size: 0.75em;
}

@media (max-width: 768px) {
  .comment-card.has-image {
    max-width: 320px;
    padding: 20px 16px;
  }
  
  .comment-location {
    font-size: 0.75em;
  }
  
  .comment-card.has-image .comment-location {
    font-size: 0.7em;
  }
}

@media (max-width: 480px) {
  .comment-card.has-image {
    max-width: 280px;
    padding: 16px 12px;
  }
  
  .comment-location {
    font-size: 0.7em;
  }
  
  .comment-card.has-image .comment-location {
    font-size: 0.65em;
  }
}

/* 實色彩色背景 - 紅色 */
.comment-card.color-red {
  background: rgba(255, 120, 120, 1) !important;
  border-color: rgba(255, 100, 100, 1) !important;
  color: #2c1810 !important;
  box-shadow: 
    0 2px 8px rgba(255, 100, 100, 0.4),
    0 1px 2px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 實色彩色背景 - 藍色 */
.comment-card.color-blue {
  background: rgba(120, 170, 255, 1) !important;
  border-color: rgba(100, 150, 255, 1) !important;
  color: #1a1c2c !important;
  box-shadow: 
    0 2px 8px rgba(100, 150, 255, 0.4),
    0 1px 2px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 實色彩色背景 - 綠色 */
.comment-card.color-green {
  background: rgba(120, 255, 170, 1) !important;
  border-color: rgba(100, 255, 150, 1) !important;
  color: #1a2c1c !important;
  box-shadow: 
    0 2px 8px rgba(100, 255, 150, 0.4),
    0 1px 2px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 實色彩色背景 - 黃色 */
.comment-card.color-yellow {
  background: rgba(255, 230, 120, 1) !important;
  border-color: rgba(255, 220, 100, 1) !important;
  color: #2c2510 !important;
  box-shadow: 
    0 2px 8px rgba(255, 220, 100, 0.4),
    0 1px 2px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
  .comment-card {
    max-width: 250px;
    padding: 15px 12px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .comment-card {
    max-width: 200px;
    padding: 12px 10px;
    font-size: 13px;
  }
}

/* Hover效果：增強彩色背景 */
.comment-card:hover {
  transform: translateY(-2px);
  z-index: 50;
}

/* 圖片hover效果 */
.comment-card:hover img {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.comment-card.has-image:hover img {
  transform: scale(1.03);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.comment-card.color-red:hover {
  background: rgba(255, 140, 140, 1) !important;
  box-shadow: 
    0 8px 25px rgba(255, 100, 100, 0.5),
    0 4px 8px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.comment-card.color-blue:hover {
  background: rgba(140, 180, 255, 1) !important;
  box-shadow: 
    0 8px 25px rgba(100, 150, 255, 0.5),
    0 4px 8px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.comment-card.color-green:hover {
  background: rgba(140, 255, 180, 1) !important;
  box-shadow: 
    0 8px 25px rgba(100, 255, 150, 0.5),
    0 4px 8px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.comment-card.color-yellow:hover {
  background: rgba(255, 240, 140, 1) !important;
  box-shadow: 
    0 8px 25px rgba(255, 220, 100, 0.5),
    0 4px 8px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.comment-card strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  word-break: break-word;
  line-height: 1.3;
  font-size: 0.95em;
}

.comment-header {
  margin-bottom: 12px;
}

.comment-location {
  font-size: 0.8em;
  opacity: 0.8;
  margin-top: 4px;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.2;
}

.comment-card.color-red strong {
  color: #1a0f08 !important;
}

.comment-card.color-red .comment-location {
  color: #2c1810 !important;
}

.comment-card.color-blue strong {
  color: #0f111a !important;
}

.comment-card.color-blue .comment-location {
  color: #1a1c2c !important;
}

.comment-card.color-green strong {
  color: #0f1a11 !important;
}

.comment-card.color-green .comment-location {
  color: #1a2c1c !important;
}

.comment-card.color-yellow strong {
  color: #1a1508 !important;
}

.comment-card.color-yellow .comment-location {
  color: #2c2510 !important;
}

.comment-card p {
  margin: 0;
  word-break: break-word;
  line-height: 1.5;
  font-weight: 500;
}

.comment-card img {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 120px;
  max-height: 200px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

/* 有圖片的留言卡片中的圖片樣式 */
.comment-card.has-image img {
  min-height: 150px;
  max-height: 250px;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
  .comment-card.has-image img {
    min-height: 120px;
    max-height: 180px;
  }
}

@media (max-width: 480px) {
  .comment-card.has-image img {
    min-height: 100px;
    max-height: 150px;
  }
}