/* ============ 投屏码票板 · 暖黄童趣主题 ============ */
@font-face {
  font-family: 'ZCOOLKuaiLe';
  src: url('../assets/ZCOOLKuaiLe.woff2') format('woff2');
  font-display: swap;
}

:root {
  --cream: #fff8e9;
  --milk: #fffdf6;
  --butter: #ffe9b0;
  --honey: #ffd371;
  --sun: #ffc14d;
  --amber: #f0a93e;
  --caramel: #d18a34;
  --brown: #9a6428;
  --darkbrown: #6b4423;
  --softbrown: #b98a52;
  --blush: #ff9f7d;
  --leaf: #8fbf7a;
  --shadow: rgba(143, 92, 28, 0.18);
  --line: #e3b96b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'ZCOOLKuaiLe', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--darkbrown);
}

body {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 211, 113, 0.35), transparent 40%),
    radial-gradient(circle at 88% 82%, rgba(255, 159, 125, 0.28), transparent 42%),
    var(--cream);
}

.board {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 14px;
  overflow: hidden;
}

/* ============ 顶部信息条 ============ */
.top-bar {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.anchor-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 26px;
  background: linear-gradient(180deg, #fff3d2 0%, #ffe0a0 100%);
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--line), 0 10px 18px var(--shadow);
  min-width: 180px;
}
.anchor-tag { font-size: 14px; color: var(--softbrown); }
.anchor-name { font-size: 30px; color: var(--darkbrown); letter-spacing: 1px; }

.stat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 8px 14px;
  border-radius: 22px;
  border: 3px solid var(--line);
  background: var(--milk);
  box-shadow: 0 6px 0 var(--line), 0 10px 18px var(--shadow);
}
.stat-label { font-size: 16px; color: var(--softbrown); margin-bottom: 2px; }
.stat-card span:last-child,
.stat-card input {
  font-family: inherit;
  font-size: 38px;
  font-weight: bold;
  color: var(--darkbrown);
}
.stat-card.goal { background: linear-gradient(180deg, #fff6dd 0%, #ffecc0 100%); }
.stat-card.accum { background: linear-gradient(180deg, #fff0c4 0%, #ffdd92 100%); }
.stat-card.accum #totalScore { color: #e08a2b; }
.stat-card.diff { background: linear-gradient(180deg, #ffe9e2 0%, #ffd2c4 100%); }
.stat-card.diff #diffScore { color: #e06a4a; }
.stat-card.diff.reached { background: linear-gradient(180deg, #e9f7e2 0%, #cdecc0 100%); }
.stat-card.diff.reached #diffScore { color: #5fa04a; }

#goalInput {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font-size: 34px;
  color: #c97a24;
}
#goalInput::-webkit-outer-spin-button,
#goalInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.admin-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  font-size: 30px;
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--line), 0 10px 18px var(--shadow);
  text-decoration: none;
}
.admin-link:active { transform: translateY(3px); }

/* ============ 主体 ============ */
.main {
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0;
}

.panel-title {
  font-size: 22px;
  color: var(--darkbrown);
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.panel-title small { font-size: 14px; color: var(--softbrown); font-weight: normal; }

/* 礼物面板 */
.gift-panel {
  flex: 1;
  min-width: 0;
  background: rgba(255, 253, 246, 0.75);
  border: 3px solid var(--line);
  border-radius: 26px;
  padding: 18px 20px;
  box-shadow: 0 8px 20px var(--shadow);
  display: flex;
  flex-direction: column;
}

.gift-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 12px;
  min-height: 0;
}

.gift-card {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  background: var(--milk);
  border: 3px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--shadow);
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.gift-card:hover { transform: translateY(-3px); border-color: var(--honey); }
.gift-card:active { transform: translateY(1px); }
.gift-card.selected {
  border-color: var(--amber);
  background: linear-gradient(180deg, #fff4d6 0%, #ffe2a6 100%);
  box-shadow: 0 0 0 4px rgba(255, 193, 77, 0.35), 0 6px 14px var(--shadow);
}
.gift-card img { width: 52px; height: 52px; object-fit: contain; }
.gift-card .g-name {
  font-size: 15px;
  color: var(--darkbrown);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-card .g-score { font-size: 14px; color: var(--caramel); font-weight: bold; }

/* 计入区 */
.entry-panel {
  width: 340px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #fffaf0 0%, #fff3dd 100%);
  border: 3px solid var(--line);
  border-radius: 26px;
  padding: 18px 20px;
  box-shadow: 0 8px 20px var(--shadow);
  display: flex;
  flex-direction: column;
}

.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 16px; color: var(--softbrown); margin-bottom: 6px; }

.nick-input {
  width: 100%;
  font-family: inherit;
  font-size: 19px;
  padding: 12px 16px;
  color: var(--darkbrown);
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 16px;
  outline: none;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nick-input:focus { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(255, 193, 77, 0.25); }
.nick-input::placeholder { color: #d8b483; }

.picked-box {
  background: var(--milk);
  border: 3px dashed var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
}
.picked-empty { color: #d8b483; font-size: 15px; width: 100%; text-align: center; }
.picked-box img { width: 46px; height: 46px; object-fit: contain; }
.picked-info { flex: 1; min-width: 0; }
.picked-info .p-name { font-size: 17px; color: var(--darkbrown); }
.picked-info .p-score { font-size: 14px; color: var(--caramel); font-weight: bold; }

.count-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.count-btn {
  font-family: inherit;
  font-size: 22px;
  font-weight: bold;
  padding: 10px 0;
  color: var(--brown);
  background: linear-gradient(180deg, #fff3d2 0%, #ffe0a0 100%);
  border: 2px solid #fff;
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--line);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.count-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.count-btn.selected {
  background: linear-gradient(180deg, #ffd98a 0%, #f5b350 100%);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 193, 77, 0.4), 0 4px 0 var(--caramel);
}
.count-btn:disabled { opacity: 0.45; pointer-events: none; }

.subtotal {
  margin-top: auto;
  margin-bottom: 12px;
  font-size: 18px;
  color: var(--softbrown);
  text-align: center;
}
.subtotal b { font-size: 26px; color: #e08a2b; }

.commit-btn {
  font-family: inherit;
  font-size: 24px;
  letter-spacing: 2px;
  padding: 14px;
  color: #fff;
  background: linear-gradient(180deg, #ffc978 0%, #f0a53c 100%);
  border: 3px solid #fff;
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--caramel), 0 10px 18px var(--shadow);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.commit-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--caramel); }
.commit-btn:disabled { opacity: 0.6; pointer-events: none; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--darkbrown);
  color: #fff8e9;
  font-size: 18px;
  padding: 14px 28px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  z-index: 100;
}
.toast[hidden] { display: none; }

/* 小屏提示（投屏建议横屏） */
@media (max-aspect-ratio: 1/1) {
  .board { justify-content: center; }
  .main::after {
    content: '投屏请使用横屏哦～';
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--caramel);
    background: var(--cream);
    z-index: 200;
  }
}

/* ============ 后台页面 ============ */
.admin-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 22px 60px;
}

.admin-login {
  max-width: 420px;
  margin: 9vh auto 0;
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 26px;
  padding: 34px 30px;
  box-shadow: 0 10px 26px var(--shadow);
  text-align: center;
}
.admin-login h1 { font-size: 27px; margin-bottom: 6px; }
.admin-login p { color: var(--softbrown); font-size: 15px; margin-bottom: 20px; }
.admin-login .nick-input { margin-bottom: 14px; }
.admin-login .commit-btn { width: 100%; font-size: 20px; padding: 12px; }
.login-hint { font-size: 12.5px; color: var(--softbrown); margin-top: 16px; }

.admin-head { text-align: center; margin-bottom: 22px; }
.admin-head h1 { font-size: 30px; }
.admin-head p { color: var(--softbrown); margin-top: 4px; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.mini-stat {
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 5px 0 var(--line), 0 8px 16px var(--shadow);
}
.mini-stat .ms-icon { font-size: 26px; }
.mini-stat .ms-num { font-size: 26px; font-weight: bold; color: #e08a2b; margin-top: 2px; }
.mini-stat .ms-label { font-size: 13.5px; color: var(--softbrown); }

.admin-tools {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin-tools .search-box { flex: 1; min-width: 200px; position: relative; }
.admin-tools .search-box span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.admin-tools .search-box input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 11px 16px 11px 40px;
  border: 3px solid var(--line);
  border-radius: 16px;
  background: var(--milk);
  outline: none;
}
.admin-tools .search-box input:focus { border-color: var(--amber); }
.tool-btn {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 18px;
  border: 3px solid #fff;
  border-radius: 16px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #ffc978 0%, #f0a53c 100%);
  box-shadow: 0 4px 0 var(--caramel);
  white-space: nowrap;
}
.tool-btn.alt {
  color: var(--brown);
  background: linear-gradient(180deg, #fff3d2 0%, #ffe0a0 100%);
  box-shadow: 0 4px 0 var(--line);
}
.tool-btn:active { transform: translateY(3px); }

.table-wrap {
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 8px 20px var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 15px; }
thead th {
  background: linear-gradient(180deg, #ffe9b8 0%, #ffd98a 100%);
  color: var(--darkbrown);
  padding: 13px 12px;
  text-align: left;
  font-weight: normal;
  position: sticky;
  top: 0;
}
tbody td { padding: 11px 12px; border-top: 2px solid #f3e2bd; }
tbody tr:hover { background: #fff8e9; }
.cell-gift { display: flex; align-items: center; gap: 8px; }
.cell-gift img { width: 34px; height: 34px; object-fit: contain; }
.t-time { color: var(--softbrown); font-size: 13.5px; white-space: nowrap; }
.t-score { color: var(--caramel); font-weight: bold; }
.del-btn {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  color: #fff;
  background: linear-gradient(180deg, #ffb199 0%, #f07b58 100%);
  border: 2px solid #fff;
  border-radius: 12px;
  box-shadow: 0 3px 0 #cf623f;
  cursor: pointer;
}
.del-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #cf623f; }
.empty-tip { text-align: center; color: var(--softbrown); padding: 50px; font-size: 16px; }

/* ============ 确认弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(107, 68, 35, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 90;
}
.modal-mask[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 26px;
  padding: 30px 24px 26px;
  text-align: center;
  box-shadow: 0 14px 34px var(--shadow);
  animation: popIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-emoji { font-size: 48px; display: block; margin-bottom: 10px; }
.modal-card h3 { font-size: 20px; margin-bottom: 10px; }
.modal-card p { font-size: 14px; color: var(--softbrown); line-height: 1.6; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .tool-btn { flex: 1; text-align: center; }
.modal-actions .tool-btn.alt { flex: 1; }

@media (max-width: 720px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 13.5px; }
}
