* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

/* Vue 挂载完成前隐藏整个应用，防止弹层/内容初始化闪现 */
[v-cloak] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #ffecd2 0%, #fcb69f 100%);
  min-height: 100dvh;
  /* display: flex; */
  justify-content: center;
}

.phone {
  width: 100%;
  max-width: 520px;
  min-height: 100dvh;
  background: #fdf8f3;
  box-shadow: 0 0 40px rgba(0,0,0,.12);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.header {
  background: linear-gradient(135deg, #ff9a56 0%, #ff6b81 100%);
  color: #fff;
  padding: calc(20px + env(safe-area-inset-top)) 20px 20px;
  border-radius: 0 0 24px 24px;
}
.header h1 { font-size: clamp(20px, 5.5vw, 26px); }
.subtitle { margin-top: 6px; font-size: clamp(12px, 3.4vw, 14px); opacity: .9; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 16px 4px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fdf8f3;
}
.tabs button {
  flex: 1;
  min-width: 0;
  border: none;
  background: #fff;
  color: #8a6f5c;
  padding: 11px 4px;
  border-radius: 14px;
  font-size: clamp(13px, 3.6vw, 15px);
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.tabs button.active {
  background: #ff6b81;
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,107,129,.4);
}

.page {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 14px;
}

.card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(120, 80, 60, .08);
  min-width: 0;
}
.card-title { font-size: clamp(14px, 3.8vw, 16px); font-weight: 700; color: #5b4636; margin-bottom: 12px; }

/* 天气 */
.weather-chip {
  border: 2px solid #f0e2d6;
  background: #fff;
  border-radius: 20px;
  padding: 8px 8px;
  font-size: clamp(12px, 3.4vw, 14px);
  cursor: pointer;
  transition: all .15s;
}
.weather-chip.active {
  border-color: #ff9a56;
  background: #fff3e8;
}
.weather-row { display: flex; flex-wrap: wrap; gap: 8px; }
.weather-hint { margin-top: 10px; font-size: 12px; color: #a08a78; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.city-select {
  border: 1px solid #f0e2d6;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: #5b4636;
  max-width: 90px;
}
.auto-indoor {
  margin-top: 10px;
  font-size: clamp(12px, 3.4vw, 14px);
  color: #5b4636;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* 抽奖 */
.scope-row { display: flex; align-items: center; gap: 8px; font-size: clamp(12px, 3.4vw, 13px); color: #8a6f5c; margin-bottom: 14px; flex-wrap: wrap; }
.scope-chip {
  border: 2px solid #f0e2d6;
  background: #fff;
  border-radius: 18px;
  padding: 7px 14px;
  font-size: clamp(12px, 3.4vw, 13px);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.scope-chip.active { border-color: #ff6b81; background: #fff0f2; color: #ff6b81; }

/* 弹层（转盘 / 结果 / 确认成功均在此展示） */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(70, 45, 30, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px 20px;
}
.modal {
  background: #fdf8f3;
  border-radius: 24px;
  padding: 24px 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  animation: modalpop .28s cubic-bezier(.34,1.56,.64,1);
  position: relative;
  text-align: center;
}
@keyframes modalpop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 15px; font-weight: 700; color: #8a6f5c; margin-bottom: 14px; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  border: none;
  background: #f0e2d6;
  color: #8a6f5c;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
}
.modal-close:hover { background: #ffdddd; color: #ff6b81; }

.slot {
  background: linear-gradient(160deg, #fff8ef, #ffeeda);
  border: 3px dashed #ffc49b;
  border-radius: 20px;
  padding: 28px 14px;
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot.spinning { animation: shake .12s infinite; }
@keyframes shake {
  0%, 100% { transform: translate(0,0); }
  25% { transform: translate(1.5px,-1.5px); }
  75% { transform: translate(-1.5px,1.5px); }
}
.slot-name {
  font-size: clamp(18px, 6vw, 26px);
  font-weight: 800;
  color: #5b4636;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.pop-enter-active { animation: popin .18s; }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.slide-enter-active, .slide-leave-active { transition: all .3s; }
.slide-enter-from, .slide-leave-to { opacity: 0; transform: translateY(12px); }

.result-card {
  margin-top: 14px;
  background: linear-gradient(160deg, #fff, #fff4ec);
  border: 2px solid #ffd9b8;
  border-radius: 16px;
  padding: 18px 14px;
}
.result-name { font-size: clamp(20px, 6.4vw, 28px); font-weight: 800; color: #5b4636; margin: 4px 0 10px; overflow-wrap: anywhere; line-height: 1.3; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; font-size: clamp(12px, 3.4vw, 13px); color: #8a6f5c; }
.result-meta span { max-width: 100%; overflow-wrap: anywhere; }
.result-tags { margin-top: 8px; font-size: 12px; color: #b09582; overflow-wrap: anywhere; }
.result-btns { margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.result-btns .btn { flex: 1 1 auto; min-width: 130px; }

/* 确认成功大卡片（弹层内，冲击力优先） */
.confirmed-modal {
  background: linear-gradient(160deg, #fffdf5 0%, #fff1cf 55%, #ffe3c2 100%);
  border: 3px solid #ffd166;
  overflow: hidden;
  padding-top: 32px;
}
.confirmed-card { padding: 4px; }
.confirmed-emoji {
  font-size: 64px;
  line-height: 1;
  animation: bigbounce .7s cubic-bezier(.34,1.56,.64,1);
  filter: drop-shadow(0 8px 16px rgba(255,170,60,.45));
}
@keyframes bigbounce {
  0% { transform: scale(0) rotate(-30deg); }
  60% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
.confirmed-title {
  margin-top: 14px;
  font-size: 19px;
  font-weight: 800;
  color: #d98324;
  letter-spacing: 2px;
}
.confirmed-name {
  margin-top: 10px;
  font-size: clamp(22px, 7vw, 30px);
  font-weight: 900;
  color: #5b4636;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.confirmed-meta { margin-top: 10px; font-size: 13px; color: #a08a78; }
.confirmed-sub { margin-top: 8px; font-size: 12px; color: #27ae60; font-weight: 700; }

.candidate-hint { margin-top: 12px; font-size: 12px; color: #b09582; }

/* 按钮 */
.btn {
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-size: clamp(14px, 3.8vw, 15px);
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.96); }
.btn.big {
  margin-top: 18px;
  width: 100%;
  padding: 16px;
  font-size: clamp(16px, 4.6vw, 18px);
  background: linear-gradient(135deg, #ff9a56, #ff6b81);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255,107,129,.4);
}
.btn.primary { background: #ff6b81; color: #fff; }
.btn.ghost { background: #fff; color: #8a6f5c; border: 2px solid #f0e2d6; }

/* 表单（移动端 input ≥16px 防止 iOS 聚焦自动放大） */
.form { display: flex; flex-direction: column; gap: 10px; }
.form input, .form select {
  border: 2px solid #f0e2d6;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
  transition: border-color .15s;
  width: 100%;
  font-family: inherit;
}
.form input:focus { border-color: #ff9a56; }
.form-row { display: flex; gap: 8px; }
.form-row .scope-chip { flex: 1; }
.form-btns { display: flex; gap: 10px; }
.form-btns .btn { flex: 1; }

/* 地点 & 记录列表 */
.place-item, .record-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid #f7efe7;
}
.place-item:last-child, .record-item:last-child { border-bottom: none; }
.place-main, .record-main { flex: 1; min-width: 0; }
.place-name, .record-name {
  font-size: clamp(14px, 3.9vw, 15px);
  font-weight: 700;
  color: #5b4636;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
.place-meta, .record-meta { margin-top: 4px; font-size: clamp(11px, 3.2vw, 12px); color: #a08a78; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.place-meta span, .record-meta span { overflow-wrap: anywhere; }
.place-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  border: none;
  background: #fdf3ea;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
  touch-action: manipulation;
}
.icon-btn:hover { background: #ffeee0; }

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.tag-in { background: #e8f4ff; color: #3a7bd5; }
.tag-out { background: #eafff0; color: #27ae60; }

.record-emoji {
  width: 42px; height: 42px;
  background: #fff3e8;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.empty { text-align: center; color: #b09582; font-size: 13px; padding: 20px 0; }

/* ============ 大屏适配 ============ */

/* 平板 / 桌面：加宽容器，所有页面共用同一套双栏网格（一套代码，行为一致） */
@media (min-width: 768px) {
  .phone { max-width: 860px; }

  /* 两张卡片的页面（盲选/管理）→ 左右等宽双栏；单卡页面（记录）自动占满整行，宽度与其他页面一致 */
  .page { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .page > :only-child { grid-column: 1 / -1; }

  .header { display: flex; align-items: baseline; justify-content: space-between; padding: 24px 28px 20px; }
  .subtitle { margin-top: 0; }

  .card { padding: 20px; }
  .form input, .form select { font-size: 14px; }
}

/* 手机横屏（高度较小时收紧留白） */
@media (max-height: 480px) and (orientation: landscape) {
  .header { padding: 12px 20px; border-radius: 0 0 16px 16px; }
  .tabs { padding: 8px 16px 2px; }
  .slot { min-height: 72px; padding: 14px; }
  .page { gap: 10px; }
}

/* 超小屏（< 340px）进一步收紧 */
@media (max-width: 339px) {
  .tabs { gap: 6px; padding: 12px 12px 4px; }
  .page { padding: 10px 12px; }
  .weather-row { gap: 6px; }
  .weather-chip { padding: 7px 9px; }
  .result-btns { flex-direction: column; }
  .result-btns .btn { width: 100%; min-width: 0; }
}
