/* 全局响应式优化 */
* {
  box-sizing: border-box;
}

body {
  overflow-y: scroll;
  font-family: "LXGW WenKai Screen";
  font-weight: normal;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 10px;
  background-color: #f9f9f9;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 5px; /* 垂直滚动条宽度 */
  height: 5px; /* 水平滚动条高度 */
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.container {
  position: relative;
  text-align: center;
  background-color: #ffebcd;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 450px;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
}

h1 {
  color: #ff69b4;
  font-size: clamp(1.5rem, 5vw, 2rem);
  margin: 10px 0;
}

.collapsible {
  font-family: "LXGW WenKai Screen";
  font-weight: normal;
  background-color: #ff69b4;
  color: white;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: center;
  outline: none;
  font-size: 15px;
  border-radius: 5px;
}

.collapsible:hover {
  background-color: #ff1493;
}

.content {
  padding: 0 18px;
  display: none;
  overflow: hidden;
  background-color: #f9f9f9;
  border-radius: 0 0 5px 5px;
  margin-bottom: 20px;
}

ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  margin-bottom: 20px;
}

li {
  background-color: #ffe4e1;
  margin: 5px 0;
  padding: 10px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

button,
input[type="text"] {
  font-family: "LXGW WenKai Screen";
  font-weight: normal;
  border: none;
  padding: 10px;
  border-radius: 5px;
  margin: 5px;
  box-sizing: border-box;
}

button {
  background-color: #ff69b4;
  color: white;
  cursor: pointer;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  margin-right: 10px;
  background-color: #ffe4e1;
  color: #333;
}

button:hover {
  background-color: #ff1493;
}

.dog-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 20px auto;
  display: block;
}

.winner {
  margin-top: 20px;
  padding: 20px;
  background-color: #fff0f5;
  border: 2px solid #ff69b4;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  color: #ff1493;
  font-size: clamp(1rem, 3vw, 1.2em);
  position: relative;
  overflow: hidden;
  word-wrap: break-word;
}

.confetti {
  position: absolute;
  opacity: 0.7;
  z-index: 10;
  pointer-events: none;
  font-size: 20px;
  color: #ff69b4;
}

@keyframes confetti-explosion {
  0% {
    transform: translate(0, 0) scale(0.3) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translate(var(--x), var(--y)) scale(1.2) rotate(360deg);
    opacity: 0;
  }
}

#appreciate-button {
  background-color: #ff69b4;
  color: white;
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 20px;
}

#appreciate-button:hover {
  background-color: #ff1493;
}

#appreciation-code {
  margin-top: 10px;
  text-align: center;
  display: none;
}

#appreciation-code img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 400px;
  display: block;
  margin: 0 auto;
}

#share-button {
  background-color: #ff69b4;
  color: white;
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 20px;
  margin-left: 10px;
}

#share-button:hover {
  background-color: #ff1493;
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.toast.show {
  opacity: 1;
}

/* 图标样式 */
.button-icon {
  margin-right: 8px;
  font-size: 16px;
}

.button-group {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.action-button {
  background-color: #ff69b4;
  color: white;
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-button:hover {
  background-color: #ff1493;
}

.action-button i {
  margin-right: 8px;
}

#reset-button {
  background-color: #ffa07a;
}

#reset-button:hover {
  background-color: #ff7f50;
}

/* 通用图标按钮样式 */
.icon-button {
  background: none;
  border: none;
  color: #ff69b4;
  cursor: pointer;
  padding: 12px;
  font-size: 20px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  margin: 5px;
}

.icon-button:hover {
  background-color: #ff69b4;
  color: white;
}

/* 确认对话框样式 */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.dialog-content {
  background: #ffebcd;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  max-width: 90%;
  width: 300px;
  font-family: "LXGW WenKai Screen";
  box-sizing: border-box;
}

.dialog-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.dialog-button {
  padding: 8px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: "LXGW WenKai Screen";
}

.dialog-confirm {
  background-color: #ff69b4;
  color: white;
}

.dialog-cancel {
  background-color: #ffa07a;
  color: white;
}

/* 食物列表项样式修 */
.food-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.food-text {
  flex-grow: 1;
  margin-right: 10px;
}

.add-food-container {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 10px 0;
  padding: 0 10px;
  width: calc(100% - 20px);
  box-sizing: border-box;
}

/* 主操作按钮容器 */
.main-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin: 20px 0;
}

/* 次要操作按钮容器 */
.secondary-controls {
  position: sticky;
  bottom: 0;
  background-color: #ffebcd;
  padding: 10px 0;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  width: 100%;
  z-index: 100;
}

.content,
#appreciation-code {
  margin-top: 10px;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 5px;
}

/* 确保图标按钮大小合适 */
.icon-button {
  min-width: 35px;
  min-height: 35px;
  padding: 8px;
  margin: 0;
}

/* 超小屏幕（手机竖屏） */
@media screen and (max-width: 480px) {
  body {
    padding: 10px 5px;
  }

  .container {
    padding: 15px;
    border-radius: 8px;
  }

  h1 {
    font-size: 1.5rem;
    margin: 5px 0;
  }

  .dog-image {
    max-width: 150px;
    margin: 15px auto;
  }

  .add-food-container {
    margin: 5px 0;
    padding: 0 5px;
  }

  input[type="text"] {
    font-size: 16px;
    padding: 8px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
    font-size: 18px;
    padding: 8px;
  }

  .main-controls {
    gap: 10px;
    margin: 15px 0;
  }

  .secondary-controls {
    gap: 5px;
    padding: 8px 0;
  }

  .floating-controls {
    right: 5px;
    top: 5px;
    gap: 5px;
  }

  .winner {
    padding: 15px;
    font-size: 1.1em;
  }

  .dialog-content {
    max-width: 85%;
    padding: 15px;
  }

  li {
    padding: 8px;
    font-size: 0.95em;
  }
}

/* 小屏幕（手机横屏和小平板） */
@media screen and (min-width: 481px) and (max-width: 768px) {
  .container {
    max-width: 500px;
    padding: 25px;
  }

  .dog-image {
    max-width: 180px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }
}

/* 平板设备 */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 550px;
    padding: 30px;
  }

  .dog-image {
    max-width: 220px;
  }

  h1 {
    font-size: 2rem;
  }
}

/* 大屏幕 */
@media screen and (min-width: 1025px) {
  .container {
    max-width: 600px;
    padding: 35px;
  }

  .dog-image {
    max-width: 250px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .winner {
    font-size: 1.3em;
  }
}

/* 横屏优化 */
@media screen and (max-height: 600px) and (orientation: landscape) {
  body {
    padding: 10px;
  }

  .dog-image {
    max-width: 120px;
    margin: 10px auto;
  }

  .container {
    padding: 15px;
  }

  h1 {
    font-size: 1.3rem;
    margin: 5px 0;
  }
}

.loading {
  position: relative;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
}

textarea {
  font-family: "LXGW WenKai Screen";
  border: 1px solid #ddd;
  border-radius: 5px;
  resize: vertical;
  background-color: #fff;
}

.dialog-content {
  max-height: 90vh;
  overflow-y: auto;
}

.floating-controls {
  position: absolute;
  right: 20px;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

