:root {
  --bg: #10151e;
  --panel: #16202d;
  --panel-border: #2c3c50;
  --text: #e6edf3;
  --accent: #58a6ff;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #0b0f14, #16202b);
}

.hidden {
  display: none !important;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 300px;
  gap: 14px;
  height: 100vh;
  padding: 14px;
  overflow: hidden;
}

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(22, 32, 45, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 14px;
  backdrop-filter: blur(8px);
}

.panel h1,
.panel h2 {
  margin: 0 0 10px;
}

.panel.left {
  overflow: auto;
  scrollbar-width: thin;
}

.panel.right {
  overflow: auto;
}

.panel label {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: #b7c3d0;
}

.panel input,
.panel button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #34465a;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 14px;
}

.panel input {
  background: #0f1722;
  color: #fff;
}

.panel button {
  background: linear-gradient(180deg, #2f81f7, #1f6feb);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.hud-card,
.inventory-card {
  margin-top: 12px;
  border-radius: 14px;
  background: #0f1722;
  border: 1px solid #243244;
  padding: 10px;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: 14px;
}

.hp-head {
  margin-top: 6px;
}

.hp-bar,
.cooldown-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
}

.hp-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--danger), #f97316);
  transition: width 0.15s ease;
}

.cooldown-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transition: width 0.08s linear;
}

.inventory-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: #cbd5e1;
}

.inventory-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.weapon-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crafting-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.inventory-slot,
.craft-slot {
  border: 1px solid #314257;
  background: linear-gradient(180deg, rgba(26, 39, 56, 0.95), rgba(12, 20, 31, 0.95));
  border-radius: 12px;
  padding: 9px 8px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.inventory-slot:hover,
.craft-slot:hover {
  border-color: #58a6ff;
}

.craft-slot {
  cursor: pointer;
}

.craft-slot:disabled {
  cursor: not-allowed;
}

.inventory-slot.active,
.craft-slot.active {
  border-color: #f2cc60;
  box-shadow: 0 0 0 1px rgba(242, 204, 96, 0.35), inset 0 0 24px rgba(242, 204, 96, 0.08);
}

.inventory-slot.disabled,
.craft-slot.disabled {
  opacity: 0.5;
  filter: saturate(0.65);
}

.inventory-slot .slot-key {
  font-size: 11px;
  color: #93a4b8;
}

.inventory-slot .slot-name,
.craft-slot .slot-name {
  font-size: 13px;
  font-weight: 700;
}

.inventory-slot .slot-count,
.craft-slot .slot-count {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
}

.craft-slot .slot-cost {
  font-size: 12px;
  color: #9fb3c8;
}

.craft-slot .slot-hint {
  font-size: 12px;
  color: #f2cc60;
}

.craft-slot.ready {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: inset 0 0 20px rgba(52, 211, 153, 0.12);
}


.secondary-btn {
  width: auto;
  margin-top: 0;
  padding: 8px 12px;
  background: linear-gradient(180deg, #1e293b, #0f172a);
}

.craft-card {
  overflow: hidden;
}

.craft-wheel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.craft-wheel-toolbar strong {
  font-size: 12px;
  color: #cbd5e1;
}

.craft-wheel {
  position: relative;
  height: 250px;
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid #243244;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.98), rgba(9, 14, 24, 0.96));
  overflow: hidden;
}

.craft-wheel-center,
.craft-wheel-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid #314257;
  color: #fff;
}

.craft-wheel-center {
  width: 118px;
  height: 118px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #1d4ed8, #172554);
  box-shadow: 0 0 40px rgba(37, 99, 235, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}

.craft-wheel-center.ready {
  background: radial-gradient(circle at 30% 30%, #16a34a, #14532d);
}

.craft-wheel-center span {
  font-size: 13px;
}

.craft-wheel-center strong {
  font-size: 15px;
}

.craft-wheel-slot {
  width: 88px;
  min-height: 62px;
  padding: 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
  transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y)));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.craft-wheel-slot small {
  color: #9fb3c8;
  font-size: 11px;
}

.craft-wheel-slot.active {
  border-color: #f2cc60;
  box-shadow: 0 0 0 1px rgba(242, 204, 96, 0.35), inset 0 0 16px rgba(242, 204, 96, 0.1);
}

.craft-wheel-slot.ready {
  border-color: rgba(52, 211, 153, 0.6);
}

.craft-summary {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #dbeafe;
}

.recipe-icon {
  font-size: 22px;
  line-height: 1;
  color: var(--recipe-tint, #f8fafc);
  text-shadow: 0 0 12px color-mix(in srgb, var(--recipe-tint, #f8fafc) 40%, transparent);
}

.recipe-icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 18px;
  color: var(--recipe-tint, #f8fafc);
}

.craft-tooltip {
  position: absolute;
  left: var(--tooltip-left, 50%);
  top: var(--tooltip-top, 16px);
  transform: translate(-50%, -100%);
  min-width: 180px;
  max-width: 240px;
  z-index: 5;
  pointer-events: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(10, 15, 26, 0.96);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

.craft-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: rgba(10, 15, 26, 0.96);
  border-right: 1px solid rgba(96, 165, 250, 0.35);
  border-bottom: 1px solid rgba(96, 165, 250, 0.35);
  transform: translateX(-50%) rotate(45deg);
}

.craft-tooltip-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.craft-tooltip-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #93c5fd;
}

.craft-tooltip-lines {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  font-size: 12px;
  color: #e2e8f0;
}

.tutorial-card,
.backpack-card {
  flex: 0 0 auto;
}

.tutorial-list,
.backpack-list,
.adventure-goals {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.goal-card-wrap {
  border-color: rgba(96, 165, 250, 0.32);
  background: linear-gradient(180deg, rgba(8, 15, 28, 0.96), rgba(8, 12, 24, 0.92));
}

.adventure-goal {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(49, 66, 87, 0.95);
  background: linear-gradient(180deg, rgba(15, 23, 34, 0.96), rgba(11, 18, 28, 0.98));
  box-shadow: inset 0 0 16px rgba(15, 23, 42, 0.24);
}

.adventure-goal.ready {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12), inset 0 0 18px rgba(34, 197, 94, 0.09);
}

.adventure-goal-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adventure-goal-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--goal-tint, #60a5fa);
  background: color-mix(in srgb, var(--goal-tint, #60a5fa) 18%, rgba(15, 23, 42, 0.96));
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--goal-tint, #60a5fa) 16%, transparent);
}

.adventure-goal-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.adventure-goal-copy strong {
  font-size: 13px;
}

.adventure-goal-copy span {
  color: #93c5fd;
  font-size: 11px;
}

.adventure-goal p {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #dbeafe;
}

.tutorial-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #243244;
  background: #0f1722;
}

.tutorial-step.active {
  border-color: rgba(245, 204, 96, 0.5);
  box-shadow: inset 0 0 18px rgba(245, 204, 96, 0.08);
}

.tutorial-step.completed {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(20, 83, 45, 0.22);
}

.tutorial-index {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #1e293b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.tutorial-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tutorial-copy span {
  color: #93c5fd;
  font-size: 12px;
}

.tutorial-copy p {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.45;
}

.tutorial-step[data-active='true'] {
  position: relative;
}

.tutorial-step[data-active='true']::after {
  content: '当前';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #fde68a;
}

.tutorial-spotlight {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.spotlight-ring {
  position: absolute;
  left: var(--spot-x, 50%);
  top: var(--spot-y, 50%);
  width: calc(var(--spot-w, 120px) + 18px);
  height: calc(var(--spot-h, 48px) + 18px);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(250, 204, 21, 0.95);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(3, 7, 18, 0.28), 0 0 24px rgba(250, 204, 21, 0.35);
  animation: spotlightPulse 1.15s ease-in-out infinite;
}

.spotlight-arrow,
.spotlight-card {
  position: absolute;
  left: var(--spot-x, 50%);
  top: var(--spot-y, 50%);
}

.tutorial-spotlight.left .spotlight-arrow {
  width: 72px;
  height: 2px;
  background: linear-gradient(90deg, rgba(250, 204, 21, 0), rgba(250, 204, 21, 1));
  transform: translate(calc(-50% - var(--spot-w, 120px) / 2 - 62px), -50%);
}

.tutorial-spotlight.left .spotlight-arrow::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-top: 2px solid rgba(250, 204, 21, 1);
  border-right: 2px solid rgba(250, 204, 21, 1);
  transform: translateY(-50%) rotate(45deg);
}

.tutorial-spotlight.center .spotlight-arrow {
  display: none;
}

.spotlight-card {
  width: 230px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(250, 204, 21, 0.45);
  background: rgba(15, 23, 42, 0.94);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.tutorial-spotlight.left .spotlight-card {
  transform: translate(calc(-50% - var(--spot-w, 120px) / 2 - 300px), calc(-50% - 26px));
}

.tutorial-spotlight.center .spotlight-card {
  transform: translate(-50%, calc(-50% + var(--spot-h, 56px) / 2 + 28px));
}

.spotlight-card strong {
  display: block;
  font-size: 13px;
  color: #fde68a;
}

.spotlight-card p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #e2e8f0;
}

@keyframes spotlightPulse {
  0%,
  100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.02); }
}

.backpack-entry {
  text-align: left;
}

.appearance-group > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #cbd5e1;
}

.appearance-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.appearance-chip {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.15);
  background: #334155;
  cursor: pointer;
}

.appearance-chip.active {
  border-color: #f2cc60;
  box-shadow: 0 0 0 1px rgba(242, 204, 96, 0.35);
}

.text-options .appearance-chip {
  width: auto;
  min-width: 54px;
  height: 30px;
  padding: 0 8px;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
}

.game-wrap {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  width: min(100%, calc((100vh - 28px) * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 28px);
  border: 1px solid #334155;
  border-radius: 16px;
  background: #8fd3ff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.meta,
.motd {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #c9d1d9;
}

.events {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  font-size: 13px;
}

.event {
  padding: 8px 10px;
  border-radius: 10px;
  background: #0f1722;
  border: 1px solid #243244;
}

.event.warn {
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(127, 29, 29, 0.25);
}

.chest-bar .craft-slot {
  min-height: 58px;
}

.chest-bar .slot-hint {
  color: #93c5fd;
}

@media (max-width: 1500px) {
  .shell {
    grid-template-columns: 290px minmax(0, 1fr) 270px;
  }

  .inventory-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .panel.left,
  .panel.right {
    overflow: visible;
  }

  .panel.right {
    min-height: 240px;
  }

  #game {
    width: 100%;
    max-height: none;
  }
}
