/* =========================
   Base layout
========================= */
/* ✅ 禁止 iframe 內水平捲軸 */
html {
  overflow-x: hidden;
  max-width: 100%;
}
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: auto;
  width: 100%;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  box-sizing: border-box;
  background-image: url('images/move.webp');
  background-size: 70%;
  background-position: center 20%;
  background-repeat: no-repeat;

  position: relative;
}

.rotating-gif-container{
  position: absolute;
  left: 50%;
  top: 68%;
  width: 150px;
  height: 150px;
  transform: translate(-50%, -50%);

  background-image: url('images/Blue.png');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;

  animation: none;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
}

@keyframes spin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 700px) and (pointer: fine){
  body{
    background-size: 90%;
    background-position: center 50%;
  }
}

@media (max-width: 600px) and (pointer: coarse){
  body{
    background-size: 110%;
    background-position: center 48%;
  }
}

/* =========================
   Declaration
========================= */
.declaration {
  text-align: center;
  margin: 20px;
  font-size: 14px;
  color: #333;
  font-weight: bold;
}

.declaration p {
  max-width: 290px;
  margin: 0 auto;
  line-height: 1.5;
}

/* =========================
   Input
========================= */
.input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
}

#inputText {
  width: 100%;
  height: 100px;
  box-sizing: border-box;
  font-size: 16px;
  padding-top: 20px;
}

.input-container textarea {
  width: 100%;
  max-width: 100%;
  height: 200px;
  font-size: 14px;
  padding: 1px;
  box-sizing: border-box;
  resize: none;
  background-position: top center;
  background-repeat: no-repeat;
  padding-top: 0px;
}

/* =========================
   Buttons
========================= */
.button-container {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  justify-content: center;
  z-index: 1;
  width: 100%;
}

button {
  font-size: 16px;
  padding: 6px 16px;
  margin: 0;
  cursor: pointer;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  transition: background-color 0.3s;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

button:hover {
  background-color: #45a049;
}

@media (max-width: 300px) {
  button {
    font-size: 14px;
    padding: 6px 12px;
  }
  .button-container {
    gap: 6px;
  }
}

/* =========================
   Board
========================= */
.board {
  position: relative;
  width: 140px;
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
   top: 10px;
}

.cell {
  position: absolute;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-size: cover;
  background-color: transparent;
  border: none;
  outline: none;
}

.cell img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: none;
  outline: none;
  display: block;
}

/* =========================
   Tablet coarse
========================= */
@media (min-width: 601px) and (max-width: 1024px) and (pointer: coarse) {
  body {
    background-size: 88%;
    background-position: center 18%;
  }
}



/* =========================
   手機直立六格縮小
========================= */
@media (max-width: 480px) {
  .input-container textarea {
    height: 80px;
    font-size: 11px;
  }

  button {
    font-size: 13px;
    padding: 5px 8px;
  }

  .board {
    width: 140px;
    height: 180px;
    transform: scale(0.7);
    transform-origin: top center;
  }
}

/* =========================
   最終停止覆蓋印章
========================= */
#finalCover {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 130px;
  transform: translate(-50%, -50%) scale(0.6);
  background: url('images/circle.png') no-repeat center center;
  background-size: contain;
  opacity: 0;
  z-index: 99;
  pointer-events: none;
}

#finalCover.show {
  animation: finalStamp 0.65s cubic-bezier(.2, .8, .3, 1) forwards;
  filter: drop-shadow(0 0 14px rgba(255, 120, 160, 0.65));
}

.cell.piece-hidden img {
  filter: blur(10px);
  opacity: 0.08;
}

@keyframes finalStamp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }

  55% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (min-width: 481px) {
  .board {
    transform: scale(0.8);
    transform-origin: top center;
  }
}