/* ============================================
   勇气救援队 · 儿童卡通风格样式
   ============================================ */
:root {
  --sky-top: #aee7ff;
  --sky-bottom: #e8fbff;
  --red: #ff6b6b;
  --red-dark: #e05252;
  --green: #51cf66;
  --green-dark: #37b24d;
  --blue: #4dabf7;
  --blue-dark: #339af0;
  --orange: #ffa94d;
  --orange-dark: #f76707;
  --yellow: #ffd43b;
  --purple: #b197fc;
  --ink: #4a3f6b;
  --card-border: #ffffff;
  --font-fun: "Comic Sans MS", "YouYuan", "幼圆", "Yuanti SC", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; }

body {
  font-family: var(--font-fun);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 45%, #fff6d8 100%);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 40px;
}

/* ---------- 背景装饰 ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.cloud { position: absolute; font-size: 64px; opacity: .8; animation: drift 40s linear infinite; }
.cloud-1 { top: 6%; left: -80px; animation-duration: 46s; }
.cloud-2 { top: 18%; left: -80px; font-size: 46px; animation-duration: 60s; animation-delay: -20s; }
.cloud-3 { top: 32%; left: -80px; font-size: 54px; animation-duration: 52s; animation-delay: -35s; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(110vw); } }

.float-emoji { position: absolute; font-size: 34px; animation: bob 4s ease-in-out infinite; opacity: .85; }
.fe-1 { top: 12%; right: 8%; }
.fe-2 { top: 40%; right: 4%; animation-delay: -1s; }
.fe-3 { top: 66%; left: 3%; animation-delay: -2s; }
.fe-4 { top: 82%; right: 10%; animation-delay: -3s; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-16px) rotate(6deg); } }

header, main, .score-board, .foot-note { position: relative; z-index: 1; }

/* ---------- 顶栏 ---------- */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  max-width: 1180px; margin: 0 auto; padding: 18px 20px 6px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mascot {
  font-size: 56px; display: inline-block;
  animation: mascotJump 2.4s ease-in-out infinite;
  filter: drop-shadow(0 6px 4px rgba(74,63,107,.2));
}
@keyframes mascotJump { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(5deg); } }
.brand-text h1 {
  font-size: 2rem; letter-spacing: 2px; color: #ff922b;
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(74,63,107,.15);
}
.subtitle { font-size: .95rem; color: #7c6fa0; margin-top: 2px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 3px solid #fff;
  background: #ffe8cc; font-size: 22px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(74,63,107,.18); transition: transform .12s;
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.parent-btn {
  border: 3px solid #fff; border-radius: 999px; padding: 10px 20px;
  background: linear-gradient(180deg, #b197fc, #9775fa); color: #fff;
  font-family: var(--font-fun); font-size: 1rem; font-weight: bold; cursor: pointer;
  box-shadow: 0 5px 0 #7950f2; transition: transform .12s, box-shadow .12s;
}
.parent-btn:hover { transform: translateY(-2px); }
.parent-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7950f2; }

/* ---------- 积分面板 ---------- */
.score-board {
  position: relative;
  max-width: 560px; margin: 14px auto 26px; text-align: center;
  background: linear-gradient(180deg, #fff9db, #fff3bf);
  border: 5px solid #fff; border-radius: 32px;
  padding: 20px 26px 24px;
  box-shadow: 0 10px 0 rgba(74,63,107,.12), 0 18px 30px rgba(74,63,107,.12);
}
.score-label { font-size: 1.05rem; font-weight: bold; color: #f08c00; letter-spacing: 3px; }
.score-value {
  font-size: 4rem; font-weight: bold; line-height: 1.15; color: #4a3f6b;
  text-shadow: 3px 3px 0 #fff;
  transition: color .3s;
}
.score-value.positive { color: #2b8a3e; }
.score-value.negative { color: #e03131; }
.score-value.pop { animation: scorePop .5s ease; }
@keyframes scorePop { 0% { transform: scale(1); } 40% { transform: scale(1.28) rotate(-3deg); } 100% { transform: scale(1); } }
.level-badge {
  display: inline-block; margin-top: 4px; padding: 6px 18px;
  background: linear-gradient(180deg, #ffd43b, #fab005);
  border: 3px solid #fff; border-radius: 999px;
  font-weight: bold; color: #5c3d00; box-shadow: 0 3px 0 rgba(74,63,107,.15);
}
.score-hint { margin-top: 10px; font-size: .92rem; color: #8a7fb0; }

/* 转盘入口圆球按钮（完全位于积分面板内右侧） */
.wheel-fab {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 82px; height: 82px; border-radius: 50%;
  border: 4px solid #fff; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ffdeeb, #f783ac 75%);
  font-size: 34px; line-height: 1; color: #a61e4d;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 6px 0 #d6336c, 0 12px 20px rgba(214,51,108,.3);
  animation: fabPulse 2.2s ease-in-out infinite;
  transition: transform .15s;
}
.wheel-fab span { font-size: .78rem; font-weight: bold; font-family: var(--font-fun); }
.wheel-fab:hover { transform: translateY(-50%) scale(1.1) rotate(8deg); }
.wheel-fab:active { transform: translateY(-46%) scale(.96); box-shadow: 0 2px 0 #d6336c; }
@keyframes fabPulse {
  0%,100% { box-shadow: 0 6px 0 #d6336c, 0 0 0 0 rgba(247,131,172,.55); }
  50% { box-shadow: 0 6px 0 #d6336c, 0 0 0 14px rgba(247,131,172,0); }
}

/* ---------- 主区域 ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.items-zone {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.item-col {
  border-radius: 26px; padding: 18px 16px 20px;
  border: 4px solid #fff;
  box-shadow: 0 8px 0 rgba(74,63,107,.10);
}
.col-forbidden { background: linear-gradient(180deg, #ffe3e3, #ffc9c9); }
.col-allowed   { background: linear-gradient(180deg, #d3f9d8, #b2f2bb); }
.col-required  { background: linear-gradient(180deg, #d0ebff, #a5d8ff); }
.col-title { text-align: center; font-size: 1.35rem; letter-spacing: 1px; }
.col-forbidden .col-title { color: #c92a2a; }
.col-allowed .col-title { color: #2b8a3e; }
.col-required .col-title { color: #1971c2; }
.col-desc { text-align: center; font-size: .85rem; color: #8a7fb0; margin: 4px 0 14px; }

.item-list { display: flex; flex-direction: column; gap: 12px; }
.item-card {
  background: #fff; border-radius: 20px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border: 3px solid rgba(74,63,107,.08);
  box-shadow: 0 4px 0 rgba(74,63,107,.10);
  transition: transform .15s;
}
.item-card:hover { transform: translateY(-3px) rotate(-.5deg); }
.item-emoji { font-size: 34px; flex-shrink: 0; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: bold; font-size: .98rem; word-break: break-all; }
.item-points { font-size: .85rem; font-weight: bold; margin-top: 2px; }
.item-points.plus { color: #2b8a3e; }
.item-points.minus { color: #e03131; }
.item-btn {
  flex-shrink: 0; border: none; border-radius: 999px; padding: 9px 13px;
  font-family: var(--font-fun); font-size: .85rem; font-weight: bold;
  color: #fff; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.item-btn.plus { background: linear-gradient(180deg, #69db7c, #40c057); box-shadow: 0 4px 0 #2b8a3e; }
.item-btn.minus { background: linear-gradient(180deg, #ff8787, #fa5252); box-shadow: 0 4px 0 #c92a2a; }
.item-btn:active { transform: translateY(3px); box-shadow: none; }
.item-btn:disabled {
  background: linear-gradient(180deg, #ced4da, #adb5bd);
  box-shadow: 0 4px 0 #868e96; cursor: not-allowed; transform: none;
}
.item-limit { font-size: .74rem; color: #8a7fb0; margin-top: 3px; }
.item-limit.done { color: #2b8a3e; font-weight: bold; }
.empty-tip { text-align: center; color: #8a7fb0; font-size: .9rem; padding: 16px 0; }

/* ---------- 转盘区（弹窗内） ---------- */
.wheel-zone { text-align: center; }
.zone-title { font-size: 1.5rem; color: #d6336c; letter-spacing: 2px; }
.zone-desc { color: #8a7fb0; font-size: .92rem; margin: 6px 0 16px; }
.wheel-wrap { position: relative; width: min(420px, 100%); margin: 0 auto; }
#wheel {
  width: 100%; height: auto; display: block;
  filter: drop-shadow(0 10px 14px rgba(74,63,107,.25));
  will-change: transform;
}
.wheel-pointer {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 40px; z-index: 3; filter: drop-shadow(0 3px 2px rgba(0,0,0,.25));
}
.wheel-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd43b 70%);
  border: 4px solid #fff; display: flex; align-items: center; justify-content: center;
  font-size: 34px; z-index: 2; box-shadow: 0 4px 8px rgba(74,63,107,.3);
}
.spin-btn {
  margin-top: 20px; border: 4px solid #fff; border-radius: 999px;
  padding: 14px 44px; font-family: var(--font-fun); font-size: 1.25rem; font-weight: bold;
  color: #fff; cursor: pointer; letter-spacing: 2px;
  background: linear-gradient(180deg, #ffa94d, #f76707);
  box-shadow: 0 6px 0 #d9480f; transition: transform .12s, box-shadow .12s;
}
.spin-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); }
.spin-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #d9480f; }
.spin-btn:disabled { background: linear-gradient(180deg, #ced4da, #adb5bd); box-shadow: 0 6px 0 #868e96; cursor: not-allowed; }
.spin-status { margin-top: 12px; font-size: .95rem; font-weight: bold; color: #d6336c; min-height: 1.4em; }

/* ---------- 日志 ---------- */
.history-zone {
  margin-top: 30px; background: #fff; border: 4px solid #fff; border-radius: 26px;
  padding: 20px 22px; box-shadow: 0 8px 0 rgba(74,63,107,.10);
  background: linear-gradient(180deg, #ffffff, #f3f0ff);
}
.history-zone .zone-title { color: #7048e8; font-size: 1.3rem; }
.history-list { list-style: none; margin-top: 12px; max-height: 300px; overflow-y: auto; }
.history-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 14px; font-size: .92rem;
}
.history-list li:nth-child(odd) { background: rgba(177,151,252,.10); }
.h-time { color: #8a7fb0; font-size: .8rem; flex-shrink: 0; }
.h-name { flex: 1; word-break: break-all; }
.h-delta { font-weight: bold; flex-shrink: 0; }
.h-delta.plus { color: #2b8a3e; }
.h-delta.minus { color: #e03131; }
.h-delta.zero { color: #868e96; }

.foot-note { text-align: center; margin-top: 28px; color: #8a7fb0; font-size: .85rem; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(74,63,107,.45);
  backdrop-filter: blur(3px); z-index: 50; display: none;
}
.overlay.show { display: block; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.8);
  z-index: 60; width: min(420px, 92vw); max-height: 88vh; overflow-y: auto;
  background: #fffdf5; border: 5px solid #fff; border-radius: 28px;
  padding: 26px 24px; text-align: center;
  box-shadow: 0 16px 40px rgba(74,63,107,.35);
  display: none; opacity: 0; transition: opacity .2s, transform .2s;
}
.modal.show { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
#resultModal { z-index: 70; } /* 结果弹窗盖在转盘弹窗之上 */
.modal-wide { width: min(640px, 94vw); text-align: left; }
.modal h3 { font-size: 1.35rem; color: #4a3f6b; margin-bottom: 8px; text-align: center; }
.modal-emoji { font-size: 60px; animation: bob 2.5s ease-in-out infinite; }
.modal-desc { color: #8a7fb0; font-size: .95rem; margin-bottom: 14px; line-height: 1.6; }
.modal-input {
  width: 100%; padding: 12px 16px; margin: 6px 0;
  border: 3px solid #d0bfff; border-radius: 16px;
  font-family: var(--font-fun); font-size: 1.05rem; text-align: center;
  outline: none; background: #fff;
}
.modal-input:focus { border-color: #9775fa; }
.modal-error { color: #e03131; font-size: .88rem; min-height: 1.3em; margin: 4px 0; }
.forgot-link {
  display: inline-block; margin-top: 2px; font-size: .85rem; color: #9775fa;
  cursor: pointer; text-decoration: underline dotted;
}
.forgot-link:hover { color: #7048e8; }
.modal-btns { display: flex; gap: 12px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.btn {
  border: 3px solid #fff; border-radius: 999px; padding: 10px 24px;
  font-family: var(--font-fun); font-size: 1rem; font-weight: bold; color: #fff;
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: translateY(3px); box-shadow: none !important; }
.btn-blue { background: linear-gradient(180deg, #74c0fc, #339af0); box-shadow: 0 4px 0 #1971c2; }
.btn-green { background: linear-gradient(180deg, #69db7c, #40c057); box-shadow: 0 4px 0 #2b8a3e; }
.btn-red { background: linear-gradient(180deg, #ff8787, #fa5252); box-shadow: 0 4px 0 #c92a2a; }
.btn-orange { background: linear-gradient(180deg, #ffc078, #f76707); box-shadow: 0 4px 0 #d9480f; }
.btn-gray { background: linear-gradient(180deg, #ced4da, #adb5bd); box-shadow: 0 4px 0 #868e96; }
.hidden { display: none !important; }

.result-delta { font-size: 2.4rem; font-weight: bold; margin: 8px 0; }
.result-delta.plus { color: #2b8a3e; }
.result-delta.minus { color: #e03131; }
.result-delta.zero { color: #868e96; }

/* ---------- 管理面板 ---------- */
.admin-tabs { display: flex; gap: 8px; margin: 12px 0 16px; flex-wrap: wrap; }
.tab-btn {
  flex: 1; min-width: 130px; border: 3px solid #e5dbff; border-radius: 14px;
  padding: 9px 8px; background: #fff; font-family: var(--font-fun);
  font-size: .92rem; font-weight: bold; color: #7c6fa0; cursor: pointer;
}
.tab-btn.active { background: linear-gradient(180deg, #b197fc, #9775fa); color: #fff; border-color: #fff; }
.admin-item-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.admin-row {
  display: flex; align-items: center; gap: 8px; background: #fff;
  border: 2px solid #e5dbff; border-radius: 14px; padding: 8px 10px; font-size: .9rem;
}
.admin-row .a-name { flex: 1; word-break: break-all; }
.admin-row .a-tag { font-size: .75rem; padding: 2px 8px; border-radius: 999px; color: #fff; flex-shrink: 0; }
.a-tag.forbidden { background: #fa5252; }
.a-tag.allowed { background: #40c057; }
.a-tag.required { background: #339af0; }
.admin-row .a-points { font-weight: bold; flex-shrink: 0; }
.admin-row .a-limit {
  font-size: .72rem; color: #7048e8; background: #f3f0ff;
  border-radius: 999px; padding: 2px 8px; flex-shrink: 0;
}
.mini-btn {
  border: none; border-radius: 10px; padding: 5px 10px; cursor: pointer;
  font-family: var(--font-fun); font-size: .8rem; color: #fff; flex-shrink: 0;
}
.mini-edit { background: #339af0; }
.mini-del { background: #fa5252; }
.item-form { background: #f8f5ff; border: 2px dashed #b197fc; border-radius: 18px; padding: 14px; }
.item-form h4 { margin-bottom: 10px; color: #7048e8; }
.form-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.form-row label { width: 52px; font-weight: bold; font-size: .92rem; flex-shrink: 0; }
.form-row input[type="text"], .form-row input[type="number"], .form-row input[type="password"], .form-row select {
  flex: 1; min-width: 120px; padding: 9px 12px; border: 2px solid #d0bfff;
  border-radius: 12px; font-family: var(--font-fun); font-size: .95rem; outline: none; background: #fff;
}
.form-row input:focus, .form-row select:focus { border-color: #9775fa; }
.form-tip { font-size: .78rem; color: #8a7fb0; }
.emoji-suggest { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; padding-left: 62px; }
.emoji-suggest span { cursor: pointer; font-size: 22px; padding: 2px; border-radius: 8px; }
.emoji-suggest span:hover { background: #e5dbff; transform: scale(1.2); }
.danger-zone { margin-top: 22px; padding-top: 14px; border-top: 2px dashed #ffc9c9; display: flex; gap: 12px; flex-wrap: wrap; }
.safe-note { margin-top: 18px; background: #e7f5ff; border-radius: 14px; padding: 12px; font-size: .85rem; color: #1971c2; line-height: 1.7; }

/* ---------- Toast & 彩纸 ---------- */
.toast {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #4a3f6b; color: #fff; padding: 12px 26px; border-radius: 999px;
  font-size: 1rem; font-weight: bold; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; box-shadow: 0 8px 20px rgba(0,0,0,.25);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti {
  position: absolute; top: -24px; width: 12px; height: 16px; border-radius: 4px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .6; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .items-zone { grid-template-columns: 1fr; }
  .brand-text h1 { font-size: 1.6rem; }
  .score-value { font-size: 3.2rem; }
}
@media (max-width: 480px) {
  .top-bar { padding-top: 12px; }
  .mascot { font-size: 44px; }
  .parent-btn { padding: 8px 14px; font-size: .9rem; }
  .modal { padding: 20px 16px; }
  .emoji-suggest { padding-left: 0; }
  .wheel-fab {
    right: 10px; top: 10px; transform: none;
    width: 58px; height: 58px; font-size: 24px;
  }
  .wheel-fab span { font-size: .62rem; }
  .wheel-fab:hover { transform: scale(1.08) rotate(8deg); }
  .wheel-fab:active { transform: scale(.94); box-shadow: 0 2px 0 #d6336c; }
}