@font-face{
  font-family: "WenQuanYi Bitmap Song 12px";
  src: url("./WenQuanYi Bitmap Song 12px.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root{
  /* 道林纸系底色 */
  --bg: #f4efdf;
  --paper: #f8f3e7;
  --paper-deep: #efe7d4;

  /* 复古绿体系 */
  --green-900: #1f3a2e;
  --green-800: #2d4a3a;
  --green-700: #3e604c;
  --green-600: #557765;
  --green-500: #6f947f;
  --green-400: #97b29f;
  --green-300: #bfd0c1;

  /* 文字与辅助色 */
  --text: #213328;
  --muted: #5f7265;
  --line: #355342;
  --chip: #edf3ea;
  --chip-border: #557765;
  --danger: #b45757;
  --shadow: #9cad9f;

  /* 像素尺寸 */
  --border: 2px;
  --shadow-step: 4px;

  /* 标签尺寸估算：给 JS 排布用 */
  --chip-font-size: 16.5px;
  --chip-padding-x: 18px;
  --chip-padding-y: 15px;
}

*{
  box-sizing: border-box;
}

html,
body{
  height: 100%;
}

html{
  background: var(--bg);
}

body{
  margin: 0;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.18), rgba(255,255,255,0)) no-repeat,
    var(--bg);
  color: var(--text);
  font-family:
    "WenQuanYi Bitmap Song 12px",
    "Press Start 2P",
    "PixelMplus12",
    "Fusion Pixel 12px Proportional CN",
    "zpix",
    monospace,
    system-ui,
    sans-serif;
  font-smooth: never;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
  letter-spacing: 0;
}

button,
input,
textarea,
select{
  font: inherit;
}

#app{
  height: 100%;
}

/* 通用视图布局 */
.view{
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

/* 开始页：只做上下居中 */
.startView{
  justify-content: center;
}

.startView .card{
  width: 100%;
}

.startView .h1{
  font-size: 32px;
  line-height: 1.5;
}

.startView .p{
  font-size: 24px;
  line-height: 1.8;
}

.startView .btn{
  font-size: 24px;
  line-height: 1.5;
  padding: 16px 20px;
  min-height: 60px;
  align-self: flex-start;
}

.startLogo{
  width: min(320px, 72vw);
  height: auto;
  display: block;
  margin: 0 auto 8px auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.quitView{
  justify-content: center;
}

.quitView .card{
  width: 100%;
}

.quitView .h1{
  font-size: 20px;
  line-height: 1.6;
}

.quitView .p{
  font-size: 16px;
  line-height: 1.9;
}

/* 像素窗口 */
.card{
  position: relative;
  background: var(--paper);
  border: var(--border) solid var(--line);
  border-radius: 0;
  padding: 14px;
  box-shadow: var(--shadow-step) var(--shadow-step) 0 0 var(--shadow);
}

/* 让卡片更像游戏窗口 */
.card::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    to right,
    var(--green-700) 0 8px,
    var(--green-500) 8px 16px
  );
  border-bottom: var(--border) solid var(--line);
}

.card > *:first-child{
  margin-top: 10px;
}

.h1{
  font-size: 16px;
  line-height: 1.5;
  margin: 0 0 8px 0;
  color: var(--green-900);
}

.p{
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 12px;
}

.summaryAwardTitle{
  font-size: 28px;
  line-height: 1.6;
  color: var(--green-900);
}

.summaryView .h1{
  font-size: 18px;
  line-height: 1.7;
}

.summaryView .p{
  font-size: 14px;
  line-height: 1.9;
}

.summaryView .btn{
  font-size: 14px;
  line-height: 1.6;
}

.summaryView .summaryAwardTitle{
  font-size: 30px;
  line-height: 1.7;
}

/* 按钮 */
.btn{
  appearance: none;
  border: var(--border) solid var(--chip-border);
  background: var(--chip);
  color: var(--green-900);
  padding: 12px 14px;
  border-radius: 0;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  box-shadow: 3px 3px 0 0 var(--shadow);
  transition: none;
  min-height: 44px;
}

.btn:hover{
  background: var(--paper-deep);
}

.btn:active{
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 0 var(--shadow);
}

.btn.primary{
  background: var(--green-700);
  border-color: var(--green-900);
  color: var(--paper);
}

.btn.primary:hover{
  background: var(--green-800);
}

.btn:disabled{
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btnRow{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 顶部区域 */
.levelTop{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 进度条 */
.progressWrap{
  height: 14px;
  background: var(--paper-deep);
  border: var(--border) solid var(--line);
  border-radius: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 var(--border) rgba(255,255,255,0.12);
}

.progressBar{
  height: 100%;
  width: 0%;
  background:
    repeating-linear-gradient(
      to right,
      var(--green-700) 0 12px,
      var(--green-500) 12px 24px
    );
  transition: width 120ms linear;
}

.progressBar.danger{
  background:
    repeating-linear-gradient(
      to right,
      #b45757 0 12px,
      #d27a7a 12px 24px
    );
}

/* 标签区域 */
.tagArea{
  position: relative;
  flex: 1;
  min-height: 420px;
  background:
    linear-gradient(rgba(62,96,76,0.05), rgba(62,96,76,0.05)),
    var(--paper);
  border: var(--border) solid var(--line);
  border-radius: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18);
  padding: 16px;
}

/* 像素网格感 */
.tagArea::before{
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(53,83,66,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53,83,66,0.06) 1px, transparent 1px);
  background-size: 12px 12px;
  pointer-events: none;
  opacity: 0.6;
}

/* 标签按钮：整体放大 1.5 倍 */
.chip{
  position: absolute;
  padding: 15px 18px;
  border-radius: 0;
  border: var(--border) solid var(--chip-border);
  background: var(--chip);
  color: var(--green-900);
  font-size: 16.5px;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: 2px 2px 0 0 var(--shadow);
  transition: none;
  z-index: 1;
}

.chip:hover{
  background: #e7efe4;
}

.chip:active{
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 0 var(--shadow);
}

/* 标签池里的结束按钮：固定右下角 */
.tagAreaEndBtn{
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  display: none;
}

.tagAreaEndBtn.show{
  display: inline-block;
}

/* 底部提示区 */
.hint{
  min-height: 108px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 2;
  padding: 14px 16px;
}

/* 弹窗 */
.modalMask{
  position: fixed;
  inset: 0;
  background: rgba(33, 51, 40, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal{
  width: min(520px, 100%);
  background: var(--paper);
  border: var(--border) solid var(--line);
  border-radius: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 5px 5px 0 0 var(--shadow);
  position: relative;
}

.modal::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    to right,
    var(--green-700) 0 8px,
    var(--green-500) 8px 16px
  );
  border-bottom: var(--border) solid var(--line);
}

.modal > *:first-child{
  margin-top: 10px;
}

.modalTitle{
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--green-900);
}

.modalBody{
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 12px;
}

/* 强调 */
b,
strong{
  color: var(--green-900);
  font-weight: 700;
}

.p[style*="opacity"]{
  color: #7b8c80 !important;
}

/* 移动端 */
@media (max-width: 640px){
  .view{
    padding: 12px;
    gap: 10px;
  }

  .card{
    padding: 12px;
  }

  .startView .h1{
    font-size: 32px;
  }

  .startView .p{
    font-size: 24px;
  }

  .startView .btn{
    font-size: 24px;
    padding: 16px 20px;
  }

  .chip{
    font-size: 16.5px;
    padding: 15px 18px;
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tagArea{
    min-height: 380px;
    padding: 14px;
  }

  .hint{
    min-height: 108px;
    font-size: 16px;
    line-height: 2;
    padding: 14px 16px;
  }

  .tagAreaEndBtn{
    right: 14px;
    bottom: 14px;
  }
}

/* 横屏 */
@media (orientation: landscape) and (max-height: 520px){
  .tagArea{
    min-height: 260px;
  }

  .view{
    gap: 8px;
  }

  .hint{
    min-height: 72px;
    font-size: 14px;
    line-height: 1.8;
    padding: 10px 12px;
  }
}
