:root {
  --ink: #3b2414;
  --wood: #c98743;
  --wood-dark: #a9692f;
  --paper: #fff6dc;
  --paper-2: #ffeebb;
  --red: #e8402a;
  --red-dark: #a82315;
  --yellow: #ffd21f;
  --yellow-dark: #c79500;
  --green: #6cc12b;
  --green-dark: #3f8d14;
  --sky-1: #4fc3f7;
  --sky-2: #c9f0ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Arial Rounded MT Bold", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-weight: 700;
  color: var(--ink);
  background: var(--sky-2);
  line-height: 1.5;
}

/* ---------- 场景 ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: linear-gradient(var(--sky-1), var(--sky-2) 70%); }
.sun { position: absolute; top: 6vh; right: 8vw; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(#fff7b0, #ffd21f 60%); box-shadow: 0 0 0 18px rgba(255, 233, 120, .35), 0 0 0 40px rgba(255, 233, 120, .18); }
.cloud { position: absolute; width: 160px; height: 50px; border-radius: 50px; background: #fff;
  box-shadow: 40px -22px 0 4px #fff, 86px -8px 0 -2px #fff; opacity: .95; animation: drift linear infinite; }
.c1 { top: 12vh; animation-duration: 70s; }
.c2 { top: 26vh; transform: scale(.7); animation-duration: 95s; animation-delay: -40s; }
.c3 { top: 40vh; transform: scale(1.2); animation-duration: 120s; animation-delay: -80s; opacity: .8; }
@keyframes drift { from { left: -260px; } to { left: 105vw; } }
.hill { position: absolute; bottom: 40px; border-radius: 50%; border: 5px solid var(--green-dark); }
.h1 { left: -10vw; width: 70vw; height: 300px; bottom: -140px; background: #86d43f; }
.h2 { right: -15vw; width: 80vw; height: 360px; bottom: -200px; background: var(--green); }
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: #8a5a2b;
  border-top: 14px solid var(--green-dark); }

/* ---------- 布局 ---------- */
#app { max-width: 980px; margin: 0 auto; padding: 20px 16px 110px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.logo { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.logo svg { width: 54px; height: 54px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .2)); }
.title { font-size: 30px; margin: 0; color: #fff; letter-spacing: 2px; paint-order: stroke fill;
  -webkit-text-stroke: 7px var(--ink); text-shadow: 0 5px 0 var(--ink); }
.chip { background: var(--paper); border: 4px solid var(--ink); border-radius: 999px; padding: 4px 14px; }

.plank { background: repeating-linear-gradient(180deg, var(--wood) 0 46px, var(--wood-dark) 46px 50px);
  border: 5px solid var(--ink); border-radius: 18px; padding: 16px; box-shadow: 0 8px 0 rgba(59, 36, 20, .35);
  position: relative; }
.plank::before, .plank::after { content: ""; position: absolute; top: 10px; width: 12px; height: 12px;
  border-radius: 50%; background: #6b4423; border: 3px solid var(--ink); }
.plank::before { left: 10px; } .plank::after { right: 10px; }
.paper { background: var(--paper); border: 4px solid var(--ink); border-radius: 14px; padding: 18px; }
.paper + .paper { margin-top: 14px; }
h2 { margin: 0 0 12px; font-size: 21px; }
h3 { margin: 0 0 8px; font-size: 17px; }
.muted { color: #7a5a3c; font-weight: 400; font-size: 14px; }

/* ---------- 表单 ---------- */
label { display: block; margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; font: inherit; font-weight: 400; color: var(--ink); background: #fff;
  border: 4px solid var(--ink); border-radius: 12px; padding: 10px 12px; outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px var(--yellow); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 22px; height: 22px; flex: none; }

.btn { font: inherit; cursor: pointer; color: #fff; background: var(--red); border: 4px solid var(--ink);
  border-radius: 14px; padding: 9px 20px; box-shadow: 0 6px 0 var(--red-dark), 0 6px 0 4px var(--ink);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35); transition: transform .06s, box-shadow .06s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--red-dark), 0 1px 0 4px var(--ink); }
.btn:disabled { filter: grayscale(.8); cursor: not-allowed; }
.btn.yellow { background: var(--yellow); color: var(--ink); text-shadow: none;
  box-shadow: 0 6px 0 var(--yellow-dark), 0 6px 0 4px var(--ink); }
.btn.green { background: var(--green); box-shadow: 0 6px 0 var(--green-dark), 0 6px 0 4px var(--ink); }
.btn.small { padding: 3px 12px; border-width: 3px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 4px 0 var(--yellow-dark), 0 4px 0 3px var(--ink); }
.btn.big { font-size: 22px; padding: 12px 34px; }

.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { font: inherit; cursor: pointer; background: var(--paper-2); color: var(--ink); border: 4px solid var(--ink);
  border-radius: 14px 14px 6px 6px; padding: 8px 18px; box-shadow: 0 5px 0 rgba(59, 36, 20, .35); }
.tab[aria-selected="true"] { background: var(--yellow); transform: translateY(-3px); }

/* ---------- 登录 ---------- */
.login { max-width: 420px; margin: 6vh auto 0; }
.login .hero { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin-bottom: -8px; }
.login .hero .b { width: 96px; height: 96px; animation: bob 1.6s ease-in-out infinite; }
.login .hero .s { width: 60px; height: 105px; }
@keyframes bob { 50% { transform: translateY(-9px) rotate(-4deg); } }
.login .title { text-align: center; margin-bottom: 14px; }
.error { color: var(--red-dark); min-height: 22px; margin: 10px 0 0; }

/* ---------- 发射场 ---------- */
.range { position: relative; height: 150px; margin: 4px 0 6px; overflow: hidden; }
.range .s { position: absolute; left: 22px; bottom: 0; width: 64px; height: 112px; }
.range .b { position: absolute; left: 24px; bottom: 74px; width: 60px; height: 60px; z-index: 2; }
.range .k { position: absolute; right: 26px; bottom: 0; width: 84px; height: 84px; }
.range.fire .b { animation: fly .9s cubic-bezier(.3, .1, .6, 1) forwards; }
.range.fire .k { animation: pop .35s .8s ease-out forwards; }
@keyframes fly {
  0% { transform: translate(-16px, 14px) rotate(0); }
  12% { transform: translate(-30px, 26px) rotate(-12deg); }
  55% { transform: translate(calc(var(--dx) * .55), -64px) rotate(300deg); }
  100% { transform: translate(var(--dx), 54px) rotate(700deg); opacity: 0; }
}
@keyframes pop { 40% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(0) rotate(40deg); opacity: 0; } }
.stock { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.tag { background: var(--paper-2); border: 3px solid var(--ink); border-radius: 999px; padding: 1px 12px; font-size: 14px; }
.tag.empty { background: #e9dcc3; color: #8a765c; }

.loot { margin-top: 14px; background: var(--paper-2); animation: drop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes drop { from { transform: scale(.6); opacity: 0; } }
.code { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px dashed var(--ink);
  border-radius: 12px; padding: 8px 12px; margin-top: 8px; }
.code code { flex: 1; font: 700 16px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }

/* ---------- 记录 ---------- */
.item { border-top: 3px dashed #c9a877; padding: 12px 0; }
.item:first-of-type { border-top: 0; }
.item .head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item .reason { margin: 6px 0 2px; font-weight: 400; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-note { text-align: center; padding: 22px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 3px dashed #c9a877; font-weight: 400; }
th { font-weight: 700; }
td .btn { margin: 2px 4px 6px 0; }
.scroll { overflow-x: auto; }

#toast { position: fixed; left: 50%; bottom: 76px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 20px; transition: .2s; z-index: 9; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 560px) {
  .title { font-size: 23px; -webkit-text-stroke-width: 5px; }
  .paper { padding: 14px; }
  .plank { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .cloud, .login .hero .b { animation: none; }
  .cloud { left: 20vw; }
  .range.fire .b, .range.fire .k, .loot { animation-duration: .01s; }
}
