/* ============ Global Styles ============ */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Prompt', system-ui, Segoe UI, Arial, Helvetica, sans-serif;
  margin: 0;
  color: #fff;
  background: linear-gradient(#ffb199, #ff0844);
}

/* BACKGROUND IMAGE */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('assets/bg.jpg') center/cover no-repeat;
  filter: brightness(0.85);
  z-index: -1;
}

/* ===== ปรับปรุงตัวอักษร ===== */
h1, .hero h1 {
  margin: 10px 0 14px;
  text-shadow: 
    0 2px 10px rgba(0,0,0,0.5),
    0 4px 20px rgba(255,159,10,0.3);
  font-weight: 800;
  letter-spacing: 0.5px;
}

h2 {
  margin: 10px 0 14px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  font-weight: 700;
  letter-spacing: 0.3px;
}

h3 {
  margin: 10px 0 14px;
  text-shadow: 0 1px 5px rgba(0,0,0,0.3);
}

p {
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  letter-spacing: 0.3px;
  line-height: 1.6;
}

/* ตัวเลขจำนวนกระทง */
#counter {
  text-shadow: 
    0 0 20px rgba(255,159,10,0.8),
    0 0 40px rgba(255,159,10,0.4),
    0 2px 10px rgba(0,0,0,0.5);
  font-weight: 900;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% {
    text-shadow: 
      0 0 20px rgba(255,159,10,0.8),
      0 0 40px rgba(255,159,10,0.4),
      0 2px 10px rgba(0,0,0,0.5);
  }
  50% {
    text-shadow: 
      0 0 30px rgba(255,159,10,1),
      0 0 60px rgba(255,159,10,0.6),
      0 2px 10px rgba(0,0,0,0.5);
  }
}

/* ===== Hero Section ===== */
.hero {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  animation: fadeIn 0.8s ease-out;
}

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

/* ===== ปรับปรุงปุ่มทั้งหมด ===== */
.btn {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ff9f0a 0%, #ff6b00 100%);  /*ปุ่มลอยเลย*/
  border: 3px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  box-shadow: 
    0 4px 15px rgba(255,159,10,0.4),
    0 0 20px rgba(255,159,10,0.2),
    inset 0 1px 0 rgba(255,255,255,0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Shine effect */
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.3),
    transparent
  );
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: linear-gradient(135deg, #ff8800 0%, #ff5500 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 8px 25px rgba(255,159,10,0.6),
    0 0 40px rgba(255,159,10,0.4),
    inset 0 1px 0 rgba(255,255,255,0.4);
  border-color: rgba(255,255,255,0.5);
}

.btn:active {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 
    0 4px 15px rgba(255,159,10,0.5),
    inset 0 2px 5px rgba(0,0,0,0.2);
}

/* ปุ่มแบบ Ghost */
.btn.ghost {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 
    0 4px 15px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn.ghost:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 8px 25px rgba(0,0,0,0.3),
    0 0 30px rgba(255,255,255,0.2),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

.btn.ghost:active {
  transform: translateY(-1px) scale(1.02);
}

/* Loading state */
.btn.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.btn.loading::after {
  content: "กำลังส่ง...";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: inherit;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Card ===== */
.card {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(5px);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.3),
    0 0 20px rgba(255,159,10,0.1);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 
    0 12px 40px rgba(0,0,0,0.4),
    0 0 30px rgba(255,159,10,0.2);
  transform: translateY(-2px);
}

/* ===== Input & Textarea ===== */
input, textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: #fff;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

input::placeholder,
textarea::placeholder {
  color: rgba(255,255,255,0.5);
}

input:focus, textarea:focus {
  outline: none;
  border-color: rgba(255,159,10,0.6);
  box-shadow: 
    0 0 0 3px rgba(255,159,10,0.2),
    inset 0 2px 4px rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.15);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* ===== Design Selection (กระทง) ===== */
.designs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 6px 0 10px;
}

.design {
  background: rgba(0,0,0,0.25);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
}

.design:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.08) translateY(-5px);
  box-shadow: 0 8px 20px rgba(255,159,10,0.3);
}

.design img {
  width: 120px;
  height: 88px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
}

.design input {
  margin: 6px;
  cursor: pointer;
}

.design input[type="radio"]:checked ~ label {
  color: #ff9f0a;
  font-weight: 700;
}

.design:has(input[type="radio"]:checked) {
  background: rgba(238, 233, 224, 0.2);
  border-color: rgba(233, 148, 12, 0.6);
  box-shadow: 
    0 4px 15px rgba(190, 188, 186, 0.4),
    0 0 20px rgba(210, 202, 190, 0.2);
  transform: scale(1.05);
}

/* ===== Recent List ===== */
.recent {
  max-width: 800px;
  margin: 32px auto;
  padding: 0 16px;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

li {
  background: rgba(0,0,0,0.25);
  padding: 10px;
  border-radius: 10px;
  transition: all 0.3s ease;
  cursor: pointer;
}

li:hover {
  background: rgba(255,255,255,0.15);
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* ===== Footer ===== */
.foot {
  display: flex;
  justify-content: center;
  margin: 30px 0 20px;
}

/* ===== River & Float ===== */
.river {
  height: 300px;
  background: linear-gradient(#1e3c72, #2a5298);
  position: relative;
  overflow: hidden;
  margin: 10px 16px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.float {
  position: absolute;
  bottom: 24px;
  left: -160px;
  width: 160px;
  animation: floatMove 18s linear infinite;
}

@keyframes floatMove {
  from { 
    left: -180px; 
    transform: translateY(0); 
  }
  to { 
    left: calc(100% + 180px); 
    transform: translateY(-2px); 
  }
}

.share {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 10px 0;
}

/* ===== Sound Button ===== */
.sound-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  background: linear-gradient(135deg, #ff9f0a 0%, #ff6b00 100%);
  color: #fff;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50px;
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 
    0 4px 15px rgba(255,159,10,0.4),
    0 0 20px rgba(255,159,10,0.2),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: pulse 2s ease-in-out infinite;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.sound-btn:hover {
  background: linear-gradient(135deg, #edeae7 0%, #0b2e4b 100%);
  transform: scale(1.1) translateY(-2px);
  box-shadow: 
    0 6px 25px rgba(255,159,10,0.6),
    0 0 30px rgba(255,159,10,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.5);
}

.sound-btn:active {
  transform: scale(1.05) translateY(0);
  box-shadow: 0 2px 10px rgba(255,159,10,0.3);
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 
      0 4px 15px rgba(255,159,10,0.4),
      0 0 20px rgba(255,159,10,0.2),
      inset 0 1px 0 rgba(255,255,255,0.2);
  }
  50% {
    box-shadow: 
      0 4px 20px rgba(255,159,10,0.6),
      0 0 30px rgba(255,159,10,0.4),
      inset 0 1px 0 rgba(255,255,255,0.2);
  }
}

.sound-btn.playing {
  animation: none;
  background: linear-gradient(135deg, #00d4aa 0%, #00a884 100%);
  box-shadow: 
    0 4px 15px rgba(0,212,170,0.4),
    0 0 20px rgba(0,212,170,0.2),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.sound-btn.playing:hover {
  background: linear-gradient(135deg, #00c49a 0%, #009874 100%);
  box-shadow: 
    0 6px 25px rgba(0,212,170,0.6),
    0 0 30px rgba(0,212,170,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ===== Close Button ===== */
.close-btn {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 9999;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(223, 204, 203, 0.9);
  border-color: rgba(255,255,255,0.4);
  transform: scale(1.15) rotate(90deg);
  box-shadow: 
    0 6px 20px rgba(255,59,48,0.4),
    0 0 30px rgba(255,59,48,0.3);
}

.close-btn:active {
  transform: scale(1.1) rotate(90deg);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; padding: 0 20px; }
  .hero p { font-size: 1rem; }
  #counter { font-size: 2rem; }
  .recent { padding: 0 12px; }
}

@media (max-width: 640px) {
  .float { width: 140px; }
  
  .sound-btn {
    right: 12px;
    bottom: 12px;
    padding: 12px 20px;
    font-size: 0.95rem;
  }
  
  .close-btn {
    right: 12px;
    top: 12px;
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }
  
  .btn:hover {
    transform: translateY(-2px) scale(1.03);
  }
  
  .design:hover {
    transform: scale(1.05) translateY(-3px);
  }
}