:root {
  --ink: #241416;
  --paper: #fff5d9;
  --paper-light: #fffdf4;
  --gold: #ffcf5a;
  --orange: #ff7a32;
  --red: #d92839;
  --green: #2ab86f;
  --blue: #2f82e8;
  --shadow: rgba(0, 0, 0, .42);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #071728;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100vw;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(5, 9, 17, .78), rgba(5, 9, 17, .12) 46%, rgba(5, 9, 17, .74)),
    radial-gradient(circle at 21% 76%, rgba(255, 123, 42, .56), transparent 18%),
    radial-gradient(circle at 70% 18%, rgba(135, 109, 255, .5), transparent 28%),
    linear-gradient(125deg, #071728 0%, #11375d 36%, #2b2051 68%, #130b22 100%);
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(90deg, rgba(3, 9, 17, .76), transparent 30%, transparent 68%, rgba(9, 6, 17, .82)),
    url("assets/battle-background.png");
  background-size: cover;
  background-position: center;
  opacity: .88;
}

.battlefield,
.diagnosis-panel {
  position: relative;
  z-index: 1;
}

.battlefield {
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
}

.scene-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-backdrop::before {
  content: none;
  position: absolute;
  left: 32%;
  top: 8%;
  width: min(30vw, 450px);
  height: 48vh;
  opacity: .68;
  filter: drop-shadow(0 0 38px rgba(255, 218, 141, .26));
  background:
    linear-gradient(#f6d3b7, #bba69f) 50% 72% / 46% 56% no-repeat,
    linear-gradient(#efb1a3, #b84c61) 50% 18% / 20% 32% no-repeat,
    linear-gradient(#edcfb5, #ae9d98) 18% 82% / 20% 42% no-repeat,
    linear-gradient(#cc5064, #8a3149) 18% 42% / 18% 24% no-repeat,
    linear-gradient(#edcfb5, #ae9d98) 82% 82% / 20% 42% no-repeat,
    linear-gradient(#cc5064, #8a3149) 82% 42% / 18% 24% no-repeat;
  border-radius: 20px;
  clip-path: polygon(50% 0, 58% 22%, 74% 21%, 69% 41%, 88% 42%, 88% 100%, 12% 100%, 12% 42%, 31% 41%, 26% 21%, 42% 22%);
}

.scene-backdrop::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 32vh;
  background:
    radial-gradient(ellipse at 18% 92%, rgba(255, 122, 45, .32), transparent 30%),
    linear-gradient(180deg, transparent, rgba(4, 10, 16, .76));
}

.game-header {
  position: absolute;
  left: clamp(18px, 3vw, 44px);
  top: clamp(16px, 3vh, 34px);
  z-index: 3;
}

.help-button {
  position: absolute;
  top: clamp(22px, 3.2vh, 38px);
  right: clamp(20px, 3vw, 44px);
  z-index: 8;
  width: 58px;
  height: 58px;
  border: 3px solid rgba(255, 207, 90, .9);
  border-radius: 50%;
  background: rgba(38, 20, 38, .78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .34), inset 0 0 0 2px rgba(255, 255, 255, .12);
  cursor: pointer;
}

.help-button::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 13px;
  width: 19px;
  height: 19px;
  border: 4px solid #fff4c9;
  border-radius: 50%;
}

.help-button::after {
  content: "";
  position: absolute;
  left: 33px;
  top: 34px;
  width: 18px;
  height: 5px;
  border-radius: 999px;
  background: #fff4c9;
  transform: rotate(45deg);
  transform-origin: left center;
}

.game-shell.is-panel-open .help-button {
  display: none;
}

.level-kicker {
  display: inline-flex;
  align-items: center;
  height: 34px;
  margin: 0 0 8px;
  padding: 0 16px;
  border: 2px solid rgba(255, 207, 90, .78);
  border-radius: 999px;
  color: #ffe695;
  font-size: clamp(16px, 1.3vw, 22px);
  font-weight: 900;
  background: rgba(38, 20, 38, .72);
}

h1 {
  margin: 0;
  max-width: 9em;
  color: #fffdf4;
  font-size: clamp(42px, 5.3vw, 82px);
  line-height: .96;
  font-weight: 1000;
  letter-spacing: 0;
  text-shadow: 0 5px 0 #9d2d1c, 0 12px 28px rgba(0, 0, 0, .54);
  -webkit-text-stroke: 2px #9d2d1c;
}

.monster-hud {
  position: absolute;
  left: clamp(18px, 3vw, 44px);
  top: clamp(155px, 23vh, 220px);
  z-index: 3;
  width: min(470px, 40vw);
  min-width: 330px;
  padding: 14px 16px 16px;
  border: 2px solid rgba(255, 207, 90, .78);
  border-radius: 14px;
  background: rgba(34, 15, 34, .76);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .34), inset 0 0 0 1px rgba(255, 255, 255, .15);
  backdrop-filter: blur(8px);
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.monster-name {
  color: #ffe695;
  font-size: clamp(17px, 1.5vw, 23px);
  font-weight: 1000;
}

.hp-text {
  color: #fff;
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 1000;
}

.hp-bar {
  height: 24px;
  margin-top: 11px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: #4b182c;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .42);
}

.hp-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff4055, #ffb341);
  box-shadow: 0 0 18px rgba(255, 85, 72, .88);
  transition: width .45s ease;
}

.attack-effect {
  position: absolute;
  left: 25%;
  bottom: 31%;
  z-index: 2;
  width: min(27vw, 430px);
  height: 18vh;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: rotate(-10deg) scale(.84);
  background: radial-gradient(circle, #fff6bd 0 14%, #ff982e 34%, rgba(255, 78, 28, .72) 56%, transparent 73%);
  filter: blur(2px);
}

.attack-effect.is-active {
  animation: blast .62s ease-out;
}

@keyframes blast {
  0% { opacity: 0; transform: rotate(-10deg) scale(.72); }
  42% { opacity: .95; transform: rotate(-10deg) scale(1.05); }
  100% { opacity: 0; transform: rotate(-10deg) scale(1.22); }
}

.hero {
  position: absolute;
  left: clamp(22px, 4vw, 74px);
  bottom: clamp(70px, 8vh, 110px);
  z-index: 4;
  width: min(270px, 22vw);
  min-width: 190px;
  aspect-ratio: .72;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, .38));
}

.hero-ear {
  position: absolute;
  top: 0;
  width: 18%;
  height: 34%;
  border: 5px solid #fff7e6;
  border-radius: 50% 50% 38% 38%;
  background: linear-gradient(#f2c4a3 16%, #ce8d5f 78%);
  z-index: 1;
}

.hero-ear::after {
  content: "";
  position: absolute;
  inset: 12% 24%;
  border-radius: inherit;
  background: #ffd8c8;
}

.hero-ear-left {
  left: 31%;
  transform: rotate(-10deg);
}

.hero-ear-right {
  right: 26%;
  transform: rotate(11deg);
}

.hero-head {
  position: absolute;
  left: 24%;
  top: 14%;
  z-index: 2;
  width: 54%;
  aspect-ratio: 1;
  border: 5px solid #fff7e6;
  border-radius: 46% 46% 42% 42%;
  background: radial-gradient(circle at 50% 60%, #f6d7bd 0 48%, #d39a64 49% 100%);
}

.hero-cap {
  position: absolute;
  left: 21%;
  top: 11%;
  z-index: 3;
  width: 62%;
  height: 17%;
  border: 4px solid #95171d;
  border-radius: 999px 999px 32px 32px;
  background: linear-gradient(#f74838, #c71827);
  transform: rotate(-8deg);
  box-shadow: inset 0 -8px 0 rgba(117, 0, 16, .18);
}

.hero-face {
  position: absolute;
  left: 31%;
  top: 28%;
  z-index: 4;
  width: 40%;
  height: 26%;
  border-radius: 50%;
  background: rgba(255, 237, 214, .8);
}

.hero-eye {
  position: absolute;
  z-index: 5;
  top: 34%;
  width: 11%;
  height: 13%;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #101010;
  box-shadow: inset 3px 0 0 #2d64d8;
}

.hero-eye-left { left: 39%; }
.hero-eye-right { left: 57%; }

.hero-nose {
  position: absolute;
  left: 50%;
  top: 45%;
  z-index: 5;
  width: 8%;
  height: 5%;
  border-radius: 50%;
  background: #16100f;
  transform: translateX(-50%);
}

.hero-teeth {
  position: absolute;
  left: 36%;
  top: 51%;
  z-index: 5;
  width: 30%;
  height: 10%;
  border-radius: 0 0 999px 999px;
  background:
    linear-gradient(135deg, transparent 0 42%, #fff 43% 56%, transparent 57%) 0 0 / 18px 100% repeat-x,
    #221514;
}

.hero-body {
  position: absolute;
  left: 29%;
  top: 57%;
  z-index: 2;
  width: 46%;
  height: 28%;
  border: 5px solid rgba(255, 255, 255, .76);
  border-radius: 28px 28px 18px 18px;
  background: linear-gradient(#2f82e8, #173c89);
}

.hero-body::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 17%;
  height: 23%;
  border: 3px solid rgba(255, 207, 90, .88);
  border-radius: 0 0 14px 14px;
  background: #9d6a36;
}

.hero-arm,
.hero-leg {
  position: absolute;
  z-index: 1;
  background: #d32b28;
  border: 4px solid rgba(255, 255, 255, .7);
}

.hero-arm {
  top: 61%;
  width: 18%;
  height: 13%;
  border-radius: 999px;
}

.hero-arm-left {
  left: 15%;
  transform: rotate(-22deg);
}

.hero-arm-right {
  right: 12%;
  transform: rotate(24deg);
}

.hero-leg {
  bottom: 0;
  width: 22%;
  height: 19%;
  border-radius: 12px 12px 999px 999px;
  background: #74432e;
}

.hero-leg-left { left: 30%; }
.hero-leg-right { right: 25%; }

.spider {
  position: absolute;
  left: min(43vw, 610px);
  top: clamp(190px, 31vh, 340px);
  z-index: 3;
  width: min(340px, 29vw);
  min-width: 280px;
  aspect-ratio: 1.28;
  filter: drop-shadow(0 24px 20px rgba(0, 0, 0, .48));
}

.spider-body,
.spider-shell {
  position: absolute;
  left: 34%;
  top: 28%;
  width: 32%;
  height: 39%;
  border-radius: 50%;
}

.spider-body {
  z-index: 2;
  border: 4px solid #d7e1eb;
  background: linear-gradient(150deg, #eef4fb, #758190 58%, #252b35);
  box-shadow: inset -14px -14px 24px rgba(0, 0, 0, .36), 0 0 34px rgba(255, 55, 55, .35);
}

.spider-shell {
  z-index: 3;
  transform: translateY(-15%);
  clip-path: polygon(16% 42%, 50% 8%, 84% 42%, 70% 80%, 30% 80%);
  background: linear-gradient(#f8fbff, #8e9aa8 70%, #3c4552);
  opacity: .86;
}

.spider-eye {
  position: absolute;
  top: 43%;
  z-index: 4;
  width: 8%;
  height: 11%;
  border-radius: 50%;
  background: #ff202b;
  box-shadow: 0 0 18px #ff202b, inset 0 0 4px #fff;
}

.eye-left { left: 43%; }
.eye-right { left: 54%; }

.spider-leg {
  position: absolute;
  z-index: 1;
  width: 39%;
  height: 7%;
  border: 2px solid #293342;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0f5fb, #5e6977);
  transform-origin: center;
}

.leg-1 { left: 2%; top: 19%; transform: rotate(25deg); }
.leg-2 { left: -1%; top: 46%; transform: rotate(-5deg); }
.leg-3 { left: 7%; top: 71%; transform: rotate(-30deg); }
.leg-4 { right: 2%; top: 19%; transform: rotate(-25deg); }
.leg-5 { right: -1%; top: 46%; transform: rotate(5deg); }
.leg-6 { right: 7%; top: 71%; transform: rotate(30deg); }

.weakpoints {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.weakpoint {
  position: absolute;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 4px solid #fff;
  border-radius: 50%;
  color: #43110c;
  background: radial-gradient(circle, #fff475 0 28%, #ff742e 29% 62%, #c3202f 63%);
  box-shadow: 0 0 22px rgba(255, 236, 94, .86);
  font-size: 22px;
  font-weight: 1000;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
  animation: pulse 1.5s ease-in-out infinite;
}

.weakpoint:hover,
.weakpoint.is-selected {
  transform: scale(1.12);
  filter: brightness(1.15);
}

.weakpoint.is-solved {
  color: #edf2f7;
  background: linear-gradient(#7a8593, #3a414d);
  box-shadow: none;
  opacity: .82;
  animation: none;
}

.weakpoint.is-solved::after {
  content: "✓";
  position: absolute;
  font-size: 28px;
  color: #7dffb1;
}

.weakpoint-1 { left: 32%; top: 8%; }
.weakpoint-2 { right: 20%; top: 17%; }
.weakpoint-3 { left: 15%; bottom: 7%; }
.weakpoint-4 { right: 11%; bottom: 14%; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 236, 94, .72); }
  50% { box-shadow: 0 0 30px rgba(255, 236, 94, 1); }
}

.teacher-line {
  position: absolute;
  left: clamp(18px, 3vw, 44px);
  right: 32px;
  bottom: clamp(18px, 3vh, 34px);
  z-index: 5;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  color: #fff4cc;
  background: rgba(0, 0, 0, .36);
  font-size: clamp(15px, 1.25vw, 20px);
  font-weight: 900;
  text-align: center;
}

.diagnosis-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 12;
  width: min(450px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin: 0;
  overflow: hidden;
  border: 3px solid var(--gold);
  border-radius: 18px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 249, 232, .98), rgba(255, 239, 194, .97));
  box-shadow: 0 24px 58px rgba(0, 0, 0, .46);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 24px));
  transition: opacity .16s ease, transform .16s ease;
}

.game-shell.is-panel-open .diagnosis-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

#panelContent,
.challenge-panel,
.start-panel,
.complete-panel {
  height: 100%;
  min-height: 0;
}

.start-panel,
.complete-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px;
  text-align: center;
}

.start-panel h2,
.complete-panel h2 {
  margin: 0;
  color: #8b211c;
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 1.08;
}

.start-panel p,
.complete-panel p {
  margin: 0;
  color: #5f351f;
  font-size: clamp(18px, 1.6vw, 25px);
  line-height: 1.45;
  font-weight: 800;
}

.challenge-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(14px, 1.4vw, 22px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.challenge-panel::-webkit-scrollbar {
  width: 10px;
}

.challenge-panel::-webkit-scrollbar-track {
  background: rgba(139, 33, 28, .08);
  border-radius: 999px;
}

.challenge-panel::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 239, 194, .96);
  border-radius: 999px;
  background: rgba(51, 25, 45, .65);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title h2 {
  margin: 0;
  color: #8b211c;
  font-size: clamp(21px, 1.8vw, 28px);
  line-height: 1.1;
  font-weight: 1000;
}

.status-tag {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: #ffe695;
  background: #261426;
  font-size: clamp(13px, 1vw, 16px);
  font-weight: 1000;
  white-space: nowrap;
}

.wrong-card {
  flex: 0 0 auto;
  min-height: 150px;
  max-height: 260px;
  display: grid;
  place-items: center;
  padding: clamp(12px, 1.4vw, 20px);
  overflow: hidden;
  border: 2px dashed #b48956;
  border-radius: 12px;
  background: var(--paper-light);
  box-shadow: inset 0 0 0 5px #fff7e8;
}

.wrong-preview-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 150px;
  max-height: 230px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
}

.wrong-image {
  max-width: 100%;
  max-height: 230px;
  object-fit: contain;
}

.zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff7d1;
  background: rgba(51, 25, 45, .86);
  font-size: 14px;
  font-weight: 900;
}

.wrong-text {
  margin: 0;
  color: #1c2730;
  font-family: "Courier New", monospace;
  font-size: clamp(36px, 4.4vw, 62px);
  font-weight: 900;
  line-height: 1.04;
  white-space: pre;
}

.question-block {
  display: grid;
  gap: 8px;
}

.question-label {
  color: #6b351e;
  font-size: clamp(16px, 1.25vw, 20px);
  font-weight: 1000;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.choice-button {
  min-height: 46px;
  padding: 8px 10px;
  border: 2px solid #e2aa58;
  border-radius: 10px;
  color: #5e2a1b;
  background: #fff9e8;
  font-size: clamp(15px, 1.15vw, 19px);
  font-weight: 1000;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.choice-button:hover {
  transform: translateY(-1px);
  background: #fff0c8;
}

.choice-button.is-selected {
  border-color: var(--blue);
  background: #e7f1ff;
  color: #173c89;
  box-shadow: 0 0 0 3px rgba(47, 130, 232, .2);
}

.choice-button.is-correct {
  border-color: var(--green);
  background: #e6fff1;
  color: #14623a;
}

.choice-button.is-wrong {
  border-color: var(--red);
  background: #ffe8e8;
  color: #8b1d22;
}

.attack-button,
.reset-button {
  min-height: 56px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(180deg, #ff6a3d, #c7242e);
  box-shadow: 0 7px 0 #83151b, 0 14px 28px rgba(199, 36, 46, .34);
  font-size: clamp(22px, 2vw, 29px);
  font-weight: 1000;
  cursor: pointer;
}

.attack-button:disabled {
  cursor: not-allowed;
  filter: grayscale(.75);
  opacity: .62;
  box-shadow: none;
}

.reset-button {
  padding: 0 26px;
}

.feedback {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #fff7d1;
  background: #33192d;
  font-size: clamp(15px, 1.1vw, 18px);
  font-weight: 900;
}

.feedback strong {
  font-size: clamp(17px, 1.3vw, 21px);
}

.feedback.is-success {
  color: #eafff2;
  background: linear-gradient(90deg, #157343, #1fa864);
}

.feedback.is-error {
  color: #fff2ee;
  background: linear-gradient(90deg, #8b211c, #c53d2b);
}

.feedback.is-info {
  color: #fff7d1;
  background: #33192d;
}

.speech-support {
  padding: 10px 12px;
  border-radius: 10px;
  color: #fff7d1;
  background: #261426;
  font-size: clamp(15px, 1.1vw, 18px);
  font-weight: 900;
  line-height: 1.36;
  text-align: center;
}

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 8, 16, .68);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.intro-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.intro-card {
  position: relative;
  width: min(620px, calc(100vw - 48px));
  padding: 28px;
  border: 3px solid var(--gold);
  border-radius: 18px;
  color: var(--ink);
  background: linear-gradient(180deg, #fffdf7, #ffe7b8);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .48);
}

.intro-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fff8dc;
  background: #33192d;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.intro-kicker {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 6px 13px;
  border-radius: 999px;
  color: #fffbe8 !important;
  background: #33192d;
  font-size: 16px;
  font-weight: 1000;
}

.intro-card h2 {
  margin: 0 0 12px;
  color: #871717;
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.05;
}

.intro-card p {
  margin: 10px 0 0;
  color: #351b12;
  font-size: clamp(17px, 1.5vw, 22px);
  line-height: 1.45;
  font-weight: 850;
}

.intro-support {
  padding: 12px 14px;
  border-radius: 10px;
  color: #fff7d1 !important;
  background: #33192d;
}

.preview-panel {
  position: fixed;
  left: 24px;
  top: 160px;
  z-index: 11;
  width: min(44vw, 620px);
  max-width: calc(100vw - 560px);
  max-height: calc(100vh - 245px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}

.preview-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.preview-card {
  overflow: hidden;
  border: 3px solid var(--gold);
  border-radius: 16px;
  background: rgba(255, 250, 240, .98);
  box-shadow: 0 24px 58px rgba(0, 0, 0, .45);
}

.preview-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  color: #fff7d1;
  background: #33192d;
  font-size: clamp(18px, 1.6vw, 24px);
}

.preview-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #33192d;
  background: #ffe695;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.preview-media {
  display: grid;
  place-items: center;
  min-height: 360px;
  max-height: calc(100vh - 330px);
  padding: 18px;
  overflow: auto;
  background: #fffdf7;
}

.preview-image {
  max-width: 100%;
  max-height: calc(100vh - 370px);
  object-fit: contain;
}

.preview-text {
  margin: 0;
  color: #1c2730;
  font-family: "Courier New", monospace;
  font-size: clamp(54px, 7vw, 92px);
  font-weight: 900;
  line-height: 1.05;
  white-space: pre;
}

.success-modal {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 8, 16, .62);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

.success-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.success-card {
  width: min(680px, calc(100vw - 48px));
  padding: 30px;
  border: 3px solid var(--gold);
  border-radius: 20px;
  color: #30180f;
  background: linear-gradient(180deg, #fffdf7, #ffe4a8);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
  text-align: center;
}

.success-kicker {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 7px 15px;
  border-radius: 999px;
  color: #fff7d1;
  background: #1f7a4d;
  font-size: 17px;
  font-weight: 1000;
}

.success-card h2 {
  margin: 0;
  color: #871717;
  font-size: clamp(38px, 4vw, 58px);
  line-height: 1.08;
}

.success-card p {
  margin: 12px 0 0;
  font-size: clamp(20px, 1.8vw, 28px);
  line-height: 1.35;
  font-weight: 900;
}

.success-support {
  padding: 12px 14px;
  border-radius: 12px;
  color: #fff7d1;
  background: #33192d;
}

.hero {
  left: clamp(18px, 3.2vw, 58px);
  bottom: clamp(60px, 6.5vh, 88px);
  width: min(430px, 31vw);
  min-width: 260px;
  aspect-ratio: 1;
  filter: drop-shadow(0 20px 22px rgba(0, 0, 0, .55));
}

.hero-image,
.spider-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.spider {
  left: min(42vw, 600px);
  top: clamp(145px, 22vh, 240px);
  width: min(520px, 38vw);
  min-width: 360px;
  aspect-ratio: 1;
  filter: drop-shadow(0 26px 24px rgba(0, 0, 0, .58));
}

.spider.is-shaking {
  animation: spider-shake .72s cubic-bezier(.36, .07, .19, .97);
}

@keyframes spider-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  12% { transform: translateX(-8px) rotate(-2deg); }
  24% { transform: translateX(9px) rotate(2deg); }
  36% { transform: translateX(-7px) rotate(-1.4deg); }
  48% { transform: translateX(7px) rotate(1.4deg); }
  60% { transform: translateX(-4px) rotate(-.8deg); }
  72% { transform: translateX(4px) rotate(.8deg); }
  84% { transform: translateX(-2px) rotate(-.3deg); }
}

.weakpoint-1 { left: 33%; top: 20%; }
.weakpoint-2 { right: 22%; top: 27%; }
.weakpoint-3 { left: 20%; bottom: 20%; }
.weakpoint-4 { right: 29%; bottom: 18%; }

@media (max-width: 1180px) {
  .game-shell {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  body {
    overflow: auto;
  }

  .battlefield {
    min-height: 720px;
  }

  .diagnosis-panel {
    min-height: 760px;
    height: auto;
    top: auto;
    right: 16px;
    bottom: 16px;
    margin: 0;
  }

  .preview-panel {
    left: 16px;
    top: 120px;
    width: calc(100vw - 32px);
    max-width: none;
    max-height: 48vh;
  }

  .preview-media {
    min-height: 220px;
    max-height: 36vh;
  }

  .preview-image {
    max-height: 32vh;
  }

  .spider {
    left: 51%;
    transform: translateX(-15%);
    top: 235px;
    width: min(470px, 58vw);
  }
}

@media (max-width: 760px) {
  .battlefield {
    min-height: 660px;
  }

  .monster-hud {
    top: 148px;
    width: calc(100% - 32px);
    min-width: 0;
  }

  .hero {
    min-width: 220px;
    bottom: 72px;
  }

  .spider {
    min-width: 310px;
    top: 265px;
    left: 52%;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .teacher-line {
    border-radius: 16px;
  }
}
