.dungeon-cover {
  background: #e8decc;
}
.dungeon-cover b {
  position: absolute;
  font:
    48px/1 Georgia,
    serif;
  left: 9px;
  top: 12px;
  color: #755741;
}
.dungeon-cover i {
  position: absolute;
  right: 9px;
  top: 11px;
  width: 10px;
  height: 10px;
  background: #b77c40;
  transform: rotate(45deg);
  font-size: 0;
}
.defense-cover {
  background: #dfe8d8;
}
.defense-cover b {
  position: absolute;
  font:
    43px/1 Georgia,
    serif;
  left: 22px;
  top: 5px;
  color: #547c64;
}
.defense-cover i {
  position: absolute;
  bottom: 6px;
  left: 10px;
  font-size: 25px;
  color: #8e693f;
}
.blocks-cover {
  background: #dce4ef;
}
.blocks-cover b {
  position: absolute;
  background: #6878bb;
  width: 17px;
  height: 17px;
  box-shadow:
    0 19px #6878bb,
    19px 19px #6878bb,
    38px 19px #6878bb;
  font-size: 0;
  top: 9px;
  left: 9px;
}
.blocks-cover i {
  position: absolute;
  background: #498d9f;
  width: 36px;
  height: 10px;
  font-size: 0;
  bottom: 5px;
  right: 5px;
}
#extra-play {
  position: fixed;
  inset: 0;
  height: var(--extra-height, 100vh);
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
  background: #f6f2e9;
  color: #303730;
}
#extra-play .game-heading {
  background: #253c36;
  color: #edf3ee;
  flex: none;
}
#extra-play .game-heading h1 {
  font-size: 17px;
}
.extra-hud {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 7px 12px 2px;
  font-size: 12px;
  flex: none;
}
.extra-hud b {
  font-weight: 650;
}
.extra-message {
  flex: none;
  min-height: 28px;
  margin: 0;
  padding: 3px 12px 6px;
  font-size: 12px;
  line-height: 1.45;
}
.extra-save {
  flex: none;
  text-align: center;
  font-size: 11px;
  color: #73766e;
  margin: 3px 8px 5px;
}
.extra-actions {
  display: flex;
  gap: 8px;
  padding: 5px 10px 2px;
  flex: none;
}
.extra-actions button {
  min-height: 44px;
  padding: 7px 11px;
  font-size: 13px;
  background: #fffdf7;
  color: #34443a;
  border-color: #d9ddcf;
}
#dungeon-end {
  margin-left: auto;
  background: #355c49;
  color: #fff;
  border-color: #355c49;
  min-width: 110px;
}
.dungeon-area {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 4px 12px 10px;
  overscroll-behavior: contain;
}
.dungeon-area h2 {
  font-size: 21px;
  margin: 6px 0;
}
.dungeon-area p {
  margin: 6px 0;
  font-size: 13px;
  color: #606a5a;
}
.dungeon-lead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #e8e1d3;
  border: 1px solid #ddd4c3;
  border-radius: 12px;
  margin-bottom: 9px;
}
.dungeon-lead h2 {
  font-size: 20px;
}
.dungeon-emblem {
  font-size: 48px;
  line-height: 1;
  color: #7c6551;
}
.enemy-intent {
  color: #9e4538 !important;
  font-weight: 650;
}
.enemy-life {
  height: 5px;
  background: #d6c6b7;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.enemy-life i {
  display: block;
  height: 100%;
  background: #a96f5b;
}
.dungeon-hand {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-content: start;
}
.dungeon-card {
  position: relative;
  min-width: 0;
  min-height: 119px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  color: #354436;
  background: #fffdf5;
  border: 1px solid #d5dcc9;
  border-top: 4px solid #769177;
  border-radius: 8px;
}
.dungeon-card[data-type="攻击"] {
  border-top-color: #b58465;
}
.dungeon-card[data-type="技能"] {
  border-top-color: #8697b7;
}
.dungeon-card b {
  font-size: 15px;
  padding-right: 15px;
}
.dungeon-card small {
  font-size: 12px;
  line-height: 1.5;
}
.dungeon-card em {
  font-size: 10px;
  font-style: normal;
  color: #8a8c79;
}
.card-energy {
  position: absolute;
  top: 7px;
  right: 7px;
  color: #a16f27;
  font-size: 14px;
  font-weight: 700;
}
.dungeon-meta {
  font-size: 12px;
  margin: 4px 0 9px;
  color: #596e58;
}
.dungeon-log {
  border-top: 1px solid #dedfd2;
  margin-top: 10px;
  padding-top: 5px;
  color: #79786c;
  font-size: 11px;
  line-height: 1.7;
}
.dungeon-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 15px;
}
.dungeon-choice {
  min-height: 125px;
  padding: 17px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  text-align: left;
  color: #34493c;
  background: #fffdf5;
  border-color: #d7ddce;
}
.dungeon-choice b {
  font-size: 17px;
}
.dungeon-choice small {
  font-size: 12px;
  line-height: 1.6;
}
.dungeon-wide {
  grid-column: 1/-1;
  min-height: 60px;
}
.dungeon-result {
  padding: 25px 15px;
  text-align: center;
}
.dungeon-result strong {
  display: block;
  font-size: 40px;
  color: #92754d;
  margin: 15px 0;
}
.extra-arena {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0 8px;
  gap: 9px;
}
#extra-canvas {
  display: block;
  flex: none;
  min-width: 0;
  min-height: 0;
  touch-action: none;
  outline: none;
}
#extra-canvas:focus-visible {
  outline: 2px solid #b49660;
  outline-offset: -2px;
}
.extra-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  background: #142c32cc;
  color: white;
  padding: 20px;
}
.extra-overlay strong {
  font-size: 26px;
}
.extra-overlay p {
  font-size: 13px;
  max-width: 300px;
  margin: 0;
}
.extra-overlay button {
  background: #f6edda;
  color: #344337;
  min-width: 120px;
}
.defense-tools {
  padding: 5px 10px 0;
  flex: none;
}
.tower-types,
.defense-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 5px;
}
.defense-tools button {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 7px 4px;
  min-height: 44px;
  background: #fffdf4;
  color: #365540;
  border-color: #d5ddca;
}
.tower-types button[aria-pressed="true"] {
  background: #d5e3d0;
  border: 2px solid #5e7f5e;
}
.tower-types button:disabled {
  opacity: 0.5;
}
#defense-wave {
  flex: 1.7;
  background: #3e694f;
  color: white;
}
#extra-play[data-game="blocks"] {
  background: #182633;
  color: #e1e8ee;
}
#extra-play[data-game="blocks"] .game-heading {
  background: #121e29;
}
#extra-play[data-game="blocks"] .extra-save {
  color: #9aa8b6;
}
.blocks-side {
  flex: none;
  width: 68px;
  font-size: 11px;
  color: #a9b9c9;
  padding-top: 5px;
}
.mini-piece {
  display: grid;
  grid-template-columns: repeat(4, 12px);
  grid-template-rows: repeat(4, 12px);
  margin: 6px 0 12px;
}
.mini-piece i {
  border: 1px solid #263848;
  border-radius: 2px;
}
.blocks-side small {
  display: block;
  margin-top: 10px;
  line-height: 1.8;
}
#blocks-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 6px 10px 0;
  flex: none;
}
#blocks-controls button {
  min-width: 0;
  min-height: 44px;
  padding: 6px;
  color: #ecf1f7;
  background: #293e52;
  border-color: #405569;
  font-size: 14px;
  touch-action: none;
}
#blocks-controls [data-block="down"],
#blocks-controls [data-block="drop"] {
  grid-column: span 2;
}
#blocks-controls [data-block="drop"] {
  background: #44655f;
}
@media (min-width: 850px) and (min-height: 600px) {
  #extra-play {
    max-width: 1050px;
    margin: auto;
  }
  .dungeon-area {
    padding: 12px 40px;
  }
  .dungeon-hand {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .dungeon-card {
    min-height: 160px;
  }
  .dungeon-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (orientation: landscape) and (max-height: 550px) {
  #extra-play[data-game="defense"],
  #extra-play[data-game="blocks"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    grid-template-rows: 50px auto 1fr auto 20px;
    grid-template-areas: "head head" "arena hud" "arena tools" "arena actions" "save save";
  }
  #extra-play .game-heading {
    grid-area: head;
  }
  #extra-play .extra-arena {
    grid-area: arena;
  }
  #extra-play .extra-hud {
    grid-area: hud;
  }
  #extra-play .extra-actions {
    grid-area: actions;
  }
  #extra-play .extra-save {
    grid-area: save;
  }
  #extra-play[data-game="defense"] .extra-message,
  #extra-play[data-game="blocks"] .extra-message {
    display: none;
  }
  #defense-tools,
  #blocks-controls {
    grid-area: tools;
    align-content: start;
  }
  #extra-play[data-game="blocks"] .extra-actions {
    padding-bottom: 8px;
  }
  #extra-play[data-game="dungeon"] .dungeon-hand {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .dungeon-lead {
    padding: 8px 12px;
  }
  .dungeon-card {
    min-height: 110px;
  }
}
#extra-canvas {
  align-self: center;
}
@media (orientation: landscape) and (max-height: 550px) {
  .blocks-side {
    padding-top: 0;
  }
  .mini-piece {
    grid-template-columns: repeat(4, 8px);
    grid-template-rows: repeat(4, 8px);
    margin: 3px 0 5px;
  }
  .blocks-side small {
    margin-top: 4px;
  }
}
.dungeon-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 58px;
  border: 2px solid #b9a58b;
  border-radius: 12px 12px 24px 24px;
  font-size: 25px;
  flex: none;
}
#blocks-controls [data-block="down"] {
  grid-column: span 1;
}
#blocks-controls #extra-pause {
  grid-column: span 1;
  font-size: 13px;
}
#extra-canvas,
#blocks-controls button {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.dungeon-cover b,
.defense-cover b {
  font:
    600 32px/1 system-ui,
    sans-serif;
  left: 20px;
  top: 15px;
}
