:root {
  color-scheme: dark;
  --bg: #101312;
  --panel: #1b211f;
  --panel-2: #242c28;
  --text: #edf5e8;
  --muted: #9fb0a4;
  --accent: #e7b85d;
  --danger: #d95555;
  --green: #68bd78;
  --blue: #69a7d8;
  --crystal: #9b7cff;
  --line: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  touch-action: manipulation;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: #2d342f;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: #39423b;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-shell {
  position: relative;
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(155, 124, 255, 0.12), transparent 32%),
    linear-gradient(225deg, rgba(231, 184, 93, 0.11), transparent 36%),
    rgba(8, 10, 9, 0.96);
}

.auth-card {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  background: rgba(27, 33, 31, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

.auth-card p {
  color: var(--muted);
  font-size: 13px;
}

#gateLoginForm,
#characterForm {
  display: grid;
  gap: 12px;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: rgba(27, 33, 31, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 210px;
}

.mark {
  width: 30px;
  height: 30px;
  display: block;
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 42%, #281d35 43% 57%, transparent 58%),
    radial-gradient(circle at 50% 35%, #9b7cff 0 18%, #e7b85d 19% 38%, #4b342c 39% 70%, transparent 71%),
    #232b27;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 16px;
}

h2 {
  font-size: 15px;
}

h3 {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--accent);
}

.brand p,
.tips p,
#zoneDetailText {
  color: var(--muted);
  font-size: 13px;
}

.brand-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.brand-title h1,
.brand-title p {
  white-space: nowrap;
}

.brand-title p {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.meters {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(118px, 0.8fr) minmax(88px, 0.45fr);
  gap: 6px;
}

.meter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 7px;
  background: rgba(36, 44, 40, 0.9);
  border-radius: 7px;
}

.power-meter {
  grid-template-columns: auto 1fr;
}

.meter span,
.meter strong {
  font-size: 11px;
  white-space: nowrap;
}

.plain-stat {
  color: var(--crystal);
  text-align: right;
}

.bar {
  height: 7px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 999px;
}

.bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--danger);
}

.bar.stamina i {
  background: var(--blue);
}

.menu-toggle {
  min-width: 70px;
  min-height: 34px;
}

.play-area {
  position: relative;
}

canvas {
  width: 100%;
  height: min(78vh, 820px);
  min-height: 560px;
  display: block;
  image-rendering: pixelated;
  background: #242927;
  border: 1px solid var(--line);
  border-radius: 8px;
  touch-action: none;
}

.panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  width: min(330px, calc(100vw - 34px));
  max-height: min(76vh, 680px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 12px;
  background: rgba(27, 33, 31, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
}

.panel.hidden {
  display: none;
}

.status-card,
.inventory,
.crafting,
.account,
.tips {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.admin-panel,
.character-info-panel,
.equipment-panel,
.shop-panel,
.map-panel,
.boss-log-panel,
.camp-panel,
.gem-panel,
.super-auto-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  width: min(620px, calc(100vw - 34px));
  max-height: min(78vh, 760px);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(20, 25, 23, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.admin-section {
  display: grid;
  gap: 10px;
  padding: 0;
  background: #151d19;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-section summary {
  cursor: pointer;
  padding: 12px;
  color: var(--accent);
  font-weight: 800;
  list-style-position: inside;
}

.admin-section > :not(summary) {
  margin: 0 10px 10px;
}

.shop-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.shop-tabs button {
  min-width: 0;
  padding: 8px 10px;
  color: var(--muted);
}

.shop-tabs button.active {
  color: #171c19;
  background: var(--accent);
  border-color: var(--accent);
}

.character-info-list {
  display: grid;
  gap: 8px;
}

.character-info-row,
.character-info-equipped {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  background: #17201b;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.character-info-row span,
.character-info-equipped span {
  color: var(--muted);
}

.character-info-row strong,
.character-info-equipped strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.equipment-panel {
  width: min(760px, calc(100vw - 34px));
}

.map-panel {
  width: min(820px, calc(100vw - 34px));
}

.boss-log-panel {
  width: min(720px, calc(100vw - 34px));
}

.gem-panel {
  width: min(780px, calc(100vw - 34px));
}

.super-auto-panel {
  width: min(560px, calc(100vw - 34px));
}

.death-panel {
  position: absolute;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 7, 0.58);
  pointer-events: auto;
}

.death-panel.hidden {
  display: none;
}

.death-card {
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid rgba(231, 184, 93, 0.55);
  border-radius: 8px;
  background: #151c18;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.death-card h2 {
  margin: 0 0 8px;
  color: var(--gold);
}

.death-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.death-actions {
  display: grid;
  gap: 10px;
}

.welcome-notice-panel {
  position: absolute;
  inset: 0;
  z-index: 27;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 7, 0.54);
}

.welcome-notice-panel.hidden {
  display: none;
}

.welcome-notice-card {
  width: min(560px, calc(100vw - 32px));
  max-height: min(78vh, 620px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151c18;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

.welcome-notice-list,
.announcement-admin-list {
  display: grid;
  gap: 10px;
}

.welcome-notice-item,
.announcement-admin-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #18201b;
}

.welcome-notice-item h3 {
  margin: 0 0 6px;
  color: var(--gold);
}

.welcome-notice-item p {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.45;
}

.welcome-notice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.welcome-notice-actions a {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid rgba(112, 214, 255, 0.48);
  border-radius: 8px;
  background: #1e3a42;
  color: #d8f7ff;
  font-weight: 700;
  text-decoration: none;
}

.announcement-admin-card {
  display: grid;
  gap: 8px;
}

.announcement-admin-card textarea {
  min-height: 90px;
  resize: vertical;
}

.super-auto-status,
.super-auto-note {
  padding: 9px 10px;
  color: var(--muted);
  background: #17201b;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.super-auto-status strong {
  color: var(--accent);
}

.gem-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(280px, 1fr);
  gap: 10px;
}

.gem-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #17201b;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gem-tab-panel {
  min-height: 270px;
}

.gem-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.gem-tabs button {
  min-width: 0;
  color: var(--muted);
}

.gem-tabs button.active {
  color: #171c19;
  background: var(--accent);
  border-color: var(--accent);
}

.gem-wallet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gem-wallet div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 10px;
  background: #202722;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gem-wallet span,
.gem-preview span {
  color: var(--muted);
  font-size: 12px;
}

.gem-preview {
  display: grid;
  gap: 6px;
  padding: 9px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gem-preview div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gem-preview strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.gem-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.gem-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gem-chip,
.gem-row {
  padding: 7px 9px;
  background: #202722;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.gem-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gem-chip strong {
  color: var(--accent);
}

.gem-row {
  display: grid;
  gap: 6px;
}

.gem-row span,
.gem-chip-list > span {
  color: var(--muted);
}

.socket-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.socket-dots i {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: rgba(237, 245, 232, 0.45);
  background: #111614;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-style: normal;
  font-size: 11px;
}

.socket-dots i.atk {
  color: #2a1414;
  background: #d95555;
}

.socket-dots i.hp {
  color: #102016;
  background: #68bd78;
}

#worldMap {
  width: 100%;
  aspect-ratio: 19 / 13;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101613;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.map-controls {
  display: grid;
  grid-template-columns: 42px 72px 42px;
  align-items: center;
  gap: 8px;
  width: max-content;
}

.map-jump-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-jump-controls button {
  min-height: 32px;
  padding: 6px 10px;
  color: #171c19;
  background: var(--accent);
  border-color: rgba(255, 240, 194, 0.5);
}

.map-focus-info {
  padding: 8px 10px;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(231, 184, 93, 0.28);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.map-controls button {
  min-width: 42px;
  height: 34px;
  padding: 0;
}

.map-controls strong {
  text-align: center;
  color: var(--gold);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend.village { background: #e7b85d; }
.legend.player { background: #70d6ff; }
.legend.monster { background: #d95555; }
.legend.boss { background: #9b7cff; }
.legend.outpost { background: #e7b85d; border-radius: 2px; }

.admin-header,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.admin-header button,
.panel-header button {
  min-width: 70px;
}

.equipment-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(260px, 1fr);
  gap: 14px;
}

.paper-doll-panel {
  position: relative;
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(231, 184, 93, 0.06), transparent 42%),
    #171d1a;
}

.paper-doll-avatar {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 104px;
  height: 180px;
  transform: translate(-50%, -50%);
}

.avatar-head,
.avatar-body,
.avatar-leg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  border: 2px solid rgba(0, 0, 0, 0.26);
}

.avatar-head {
  top: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e0b462;
}

.avatar-body {
  top: 50px;
  width: 60px;
  height: 78px;
  border-radius: 8px;
  background: #47625a;
}

.avatar-leg {
  top: 130px;
  width: 20px;
  height: 46px;
  border-radius: 6px;
  background: #473a28;
}

.avatar-leg.left {
  margin-left: -15px;
}

.avatar-leg.right {
  margin-left: 15px;
}

.equipment-slots {
  position: absolute;
  inset: 10px;
}

.bag-panel {
  min-width: 0;
}

.bag-list,
.shop-list,
.boss-log-list {
  display: grid;
  gap: 8px;
}

.boss-log-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #202722;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.boss-log-main,
.boss-log-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.boss-log-main span,
.boss-log-reward,
.boss-log-top {
  color: var(--muted);
  font-size: 12px;
}

.boss-log-top {
  display: grid;
  gap: 5px;
}

.boss-log-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: #171d1a;
  border-radius: 6px;
}

.boss-log-rank {
  color: var(--gold);
  font-weight: 800;
}

.shop-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  background: #202722;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.equipment-slot {
  position: absolute;
  width: 76px;
  min-height: 76px;
  display: grid;
  grid-template-rows: 34px auto auto;
  justify-items: center;
  gap: 2px;
  padding: 6px;
  background: #202722;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.equipment-slot:disabled {
  opacity: 1;
}

.equipment-slot-hat {
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
}

.equipment-slot-shirt {
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
}

.equipment-slot-pants {
  left: 50%;
  top: 180px;
  transform: translateX(-50%);
}

.equipment-slot-shoes {
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
}

.equipment-slot-weapon {
  right: 18px;
  top: 126px;
}

.equipment-slot-back {
  left: 18px;
  top: 126px;
}

.equipment-slot-pet {
  right: 18px;
  bottom: 8px;
}

.equipment-slot-mount {
  left: 18px;
  bottom: 8px;
}

.equipment-slot-title {
  left: 18px;
  top: 28px;
}

.equipment-slot-aura {
  right: 18px;
  top: 28px;
}

.equipment-slot-core {
  left: 18px;
  top: 230px;
}

.equipment-slot-accessory {
  right: 18px;
  top: 230px;
}

.slot-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #171c19;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.image-slot-icon {
  background-color: #151b18;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.slot-name,
.slot-item {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.slot-name {
  color: var(--text);
  font-weight: 800;
}

.slot-item {
  color: var(--muted);
}

.bag-list {
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  align-content: start;
}

.bag-item {
  min-height: 124px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  padding: 6px;
  background: #202722;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bag-item-main {
  min-width: 0;
  min-height: 80px;
  display: grid;
  grid-template-rows: 38px auto auto;
  justify-items: center;
  gap: 4px;
  padding: 0;
  background: transparent;
  border: 0;
}

.bag-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.bag-use-btn,
.bag-drop-btn {
  min-width: 0;
  padding: 5px 6px;
  font-size: 11px;
}

.bag-use-btn {
  color: #dff5e4;
  background: rgba(104, 189, 120, 0.14);
  border-color: rgba(104, 189, 120, 0.36);
}

.bag-drop-btn {
  color: #ffb199;
  background: rgba(217, 85, 85, 0.14);
  border-color: rgba(217, 85, 85, 0.32);
}

.bag-item-main strong,
.shop-item strong,
.bag-item-main span,
.shop-item span {
  display: block;
  font-size: 12px;
}

.bag-item-main span,
.shop-item span {
  color: var(--muted);
}

.shop-item button {
  min-width: 58px;
}

.bag-item-main strong,
.bag-item-main span {
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bag-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 130px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.shop-wallet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.redeem-card {
  display: grid;
  gap: 8px;
}

.redeem-row {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px;
}

.camp-actions {
  display: grid;
  gap: 8px;
}

.tips {
  border-bottom: 0;
}

.resource {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
  background: #202722;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: #151b18;
  font: inherit;
}

textarea {
  resize: vertical;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.asset-list {
  display: grid;
  gap: 8px;
}

.admin-item-form,
.admin-costume-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-item-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-item-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: #17201b;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-item-thumb {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #171c19;
  background: #232b25;
  border-radius: 8px;
  font-weight: 800;
}

.admin-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.admin-item-card strong,
.admin-item-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-item-card span {
  color: var(--muted);
  font-size: 12px;
}

.admin-code-form,
.admin-costume-form,
.code-list {
  display: grid;
  gap: 8px;
}

.admin-costume-form {
  padding: 10px;
  background: #18201b;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-costume-form h4 {
  margin: 0;
  color: var(--gold);
}

.admin-costume-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.admin-debug-grid,
.admin-debug-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-debug-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.debug-log {
  max-height: 140px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111714;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.debug-log div {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px 0;
}

.security-event-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.security-event-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #18201b;
  font-size: 12px;
}

.security-event-card span {
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.check-row input {
  width: auto;
}

.monster-settings-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.monster-setting-card {
  display: grid;
  grid-template-columns: 46px repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  background: #202722;
  border-radius: 8px;
}

.monster-setting-card strong {
  align-self: center;
  font-size: 12px;
}

.monster-setting-card label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
}

.monster-setting-card input {
  min-width: 0;
  padding: 7px 6px;
  font-size: 12px;
}

.monster-setting-card button {
  grid-column: 1 / -1;
}

.asset-card,
.code-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #202722;
  border-radius: 8px;
}

.code-card {
  grid-template-columns: 1fr auto;
}

.asset-card img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  image-rendering: pixelated;
  background: #111614;
  border-radius: 6px;
}

.asset-card strong,
.asset-card span,
.code-card strong,
.code-card span {
  display: block;
  font-size: 12px;
}

.asset-card span,
.code-card span {
  color: var(--muted);
}

.asset-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.crafting {
  display: grid;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 7;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 14px;
  color: #19140f;
  background: var(--accent);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.toast.show {
  opacity: 1;
}

.mobile-controls {
  position: fixed;
  inset: auto 18px 18px 18px;
  z-index: 5;
  display: none;
  align-items: end;
  justify-content: space-between;
  pointer-events: none;
}

.joystick,
.attack-touch,
.auto-touch {
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(27, 33, 31, 0.72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.attack-control {
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: auto;
}

.auto-touch {
  width: 62px;
  height: 34px;
  border-radius: 18px;
  color: #dbe6dc;
  font-size: 12px;
  font-weight: 800;
}

.auto-touch.on {
  color: #12221d;
  background: rgba(112, 214, 255, 0.92);
  border-color: rgba(230, 251, 255, 0.65);
  box-shadow: 0 0 18px rgba(112, 214, 255, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

.auto-desktop {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  width: 72px;
  height: 34px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #dbe6dc;
  background: rgba(27, 33, 31, 0.76);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.auto-desktop.on {
  color: #12221d;
  background: rgba(112, 214, 255, 0.92);
  border-color: rgba(230, 251, 255, 0.65);
}

.joystick {
  position: relative;
  width: 138px;
  height: 138px;
  border-radius: 50%;
}

.joystick::before {
  content: "";
  position: absolute;
  inset: 43px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(231, 184, 93, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.attack-touch {
  position: relative;
  overflow: hidden;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  color: #1b130c;
  background: rgba(231, 184, 93, 0.9);
  font-size: 18px;
  font-weight: 800;
}

.attack-cooldown-fill {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(22, 27, 24, 0.5), rgba(9, 12, 10, 0.68));
  transform: translateY(100%);
  transition: transform 80ms linear;
}

.attack-touch-label {
  position: relative;
  z-index: 1;
  font-weight: 800;
}

.attack-touch.cooling {
  color: #f7e9bf;
  border-color: rgba(247, 233, 191, 0.42);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), inset 0 0 0 2px rgba(247, 233, 191, 0.18);
}

.attack-touch.queued {
  border-color: rgba(112, 214, 255, 0.58);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), 0 0 18px rgba(112, 214, 255, 0.22), inset 0 0 0 2px rgba(112, 214, 255, 0.2);
}

.attack-touch.pending {
  color: #dff8ff;
  border-color: rgba(112, 214, 255, 0.7);
}

.attack-touch.tired {
  color: rgba(247, 233, 191, 0.72);
  background: rgba(66, 72, 66, 0.72);
}

.quickbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(10, 42px);
  gap: 5px;
  pointer-events: auto;
}

.quick-slot {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(16, 22, 19, 0.76);
  color: var(--muted);
  padding: 0;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.quick-slot .slot-icon {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.quick-slot > span:last-child {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 10px;
  font-weight: 800;
  color: #edf5e8;
  text-shadow: 0 1px 2px #000;
}

.quick-slot:disabled {
  opacity: 0.52;
}

.attack-touch:disabled {
  cursor: not-allowed;
}

.attack-touch:active,
.attack-touch.active {
  background: #ffd27b;
}

@media (max-width: 900px) {
  .game-shell {
    width: 100%;
    padding: 6px 6px 156px;
  }

  .topbar {
    top: 6px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 5px 6px;
  }

  .brand {
    min-width: 0;
  }

  .brand .mark {
    display: none;
  }

  h1 {
    font-size: 14px;
  }

  .meters {
    grid-column: 1 / -1;
    grid-template-columns: minmax(112px, 1fr) minmax(96px, 0.8fr) minmax(76px, 0.48fr);
    gap: 5px;
    order: 3;
  }

  .meter {
    grid-template-columns: auto 1fr auto;
    gap: 4px;
    min-height: 28px;
    padding: 4px 5px;
  }

  .meter span,
  .meter strong {
    font-size: 10px;
  }

  .bar {
    height: 6px;
  }

  canvas {
    height: calc(100vh - 154px);
    min-height: 460px;
  }

  .panel {
    position: fixed;
    inset: 78px 10px auto 10px;
    width: auto;
    max-height: calc(100vh - 270px);
  }

  .admin-panel,
  .equipment-panel,
  .shop-panel,
  .map-panel,
  .boss-log-panel,
  .camp-panel,
  .gem-panel,
  .super-auto-panel {
    position: fixed;
    inset: 78px 10px auto 10px;
    width: auto;
    max-height: calc(100vh - 220px);
  }

  .equipment-layout {
    grid-template-columns: 1fr;
  }

  .gem-layout,
  .gem-wallet,
  .gem-tabs {
    grid-template-columns: 1fr;
  }

  .paper-doll-panel {
    min-height: 390px;
  }

  .admin-debug-grid,
  .admin-debug-actions {
    grid-template-columns: 1fr;
  }

  .equipment-slot {
    width: 68px;
    min-height: 68px;
  }

  .equipment-slot-weapon,
  .equipment-slot-back {
    top: 112px;
  }

  .equipment-slot-core,
  .equipment-slot-accessory {
    top: 214px;
  }

  .bag-list {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  }

  .mobile-controls {
    display: flex;
  }

  .auto-desktop {
    display: none;
  }

  .quickbar {
    left: 50%;
    right: auto;
    bottom: 16px;
    width: min(330px, calc(100vw - 280px));
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 3px;
  }

  .quick-slot {
    width: 100%;
    height: 30px;
    border-radius: 6px;
  }

  .toast {
    bottom: 154px;
  }
}

@media (max-width: 420px) {
  .brand-title {
    gap: 5px;
  }

  .brand-title h1 {
    font-size: 13px;
  }

  .brand-title p {
    font-size: 11px;
  }

  .meters {
    grid-template-columns: 1fr 0.9fr;
  }

  .power-meter {
    grid-column: 1 / -1;
  }

  .quickbar {
    width: min(220px, calc(100vw - 190px));
    grid-template-columns: repeat(5, minmax(0, 1fr));
    bottom: 12px;
  }

  .quick-slot {
    height: 28px;
  }
}

@media (pointer: coarse) {
  .mobile-controls {
    display: flex;
  }
}
