﻿@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap");

:root {
  --bg-dark: #1e1912;
  --bg-mid: #2f2619;
  --panel: #3f3525;
  --panel-soft: #4c402d;
  --text: #f2e8cf;
  --muted: #c8b995;
  --accent: #8fbf5a;
  --accent-2: #688a3f;
  --danger: #bc5c3b;
  --line: #5b4d37;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 18% 12%, rgba(119, 151, 75, 0.25), transparent 32%),
    radial-gradient(circle at 82% 80%, rgba(94, 72, 45, 0.25), transparent 35%),
    linear-gradient(180deg, #18130d 0%, var(--bg-dark) 38%, #151109 100%);
  color: var(--text);
  font-family: "VT323", monospace;
  letter-spacing: 0.3px;
}

#gameFrame {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, label, .pixel-btn, .badge {
  font-family: "Press Start 2P", monospace;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(28, 22, 14, 0.85);
  border-bottom: 3px solid var(--line);
}

.left-actions { display: flex; gap: 10px; }
.right-actions { display: flex; align-items: center; gap: 10px; }

.discord-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.badge {
  font-size: 11px;
  background: #2f3a22;
  color: #e2f0c6;
  border: 2px solid #5f7f36;
  padding: 8px 10px;
}

.hidden { display: none !important; }

.layout {
  flex: 1;
  display: flex;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.panel {
  flex: 0 0 295px;
  background: linear-gradient(180deg, var(--panel) 0%, #352c1f 100%);
  border: 3px solid var(--line);
  box-shadow: inset 0 0 0 2px #2b2318;
  padding: 12px;
  overflow: auto;
  min-height: 0;
}

.panel h2, .panel h3 {
  margin: 8px 0 10px;
  color: #d7f0ac;
  font-size: 12px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 24px;
  padding: 5px 0;
  border-bottom: 1px dashed #6c5c43;
}

.row strong {
  color: #edf7d8;
}

.row-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  vertical-align: middle;
}

.icon.small {
  width: 24px;
  height: 24px;
}

.boss-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 0;
}

.boss-card {
  width: min(820px, 100%);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #3a301f 0%, #2c2418 100%);
  border: 3px solid var(--line);
  box-shadow: inset 0 0 0 2px #251f15;
  padding: 14px;
  min-height: 0;
}

.boss-stage {
  position: relative;
  height: 280px;
  border: 3px solid #556d39;
  background:
    linear-gradient(0deg, rgba(31, 43, 22, 0.7), rgba(58, 80, 36, 0.6)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 8px, transparent 8px 16px);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

#bossCanvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#bossName {
  margin: 12px 0 8px;
  font-size: 20px;
  color: #e6f5c5;
}

.hp-wrap {
  width: 100%;
  height: 24px;
  border: 2px solid #725637;
  background: #1d150d;
  overflow: hidden;
}

.hp-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #943f2a 0%, var(--danger) 50%, #d67e44 100%);
  transition: width 0.15s linear;
}

.boss-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 28px;
  color: var(--muted);
}

.event-feed {
  margin-top: 12px;
  min-height: 88px;
  max-height: 170px;
  overflow: auto;
  border: 2px solid #5c4b35;
  background: rgba(14, 18, 10, 0.45);
  padding: 8px;
  font-size: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: #7ea24c #2a2216;
}

.event-feed::-webkit-scrollbar {
  width: 12px;
}

.event-feed::-webkit-scrollbar-track {
  background: #2a2216;
  border-left: 1px solid #5a4a35;
}

.event-feed::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #95ba5f 0%, #607d36 100%);
  border: 2px solid #2a2216;
}

.event-feed::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a7cc73 0%, #6f8f42 100%);
}

.event-line {
  color: #dbeec0;
  line-height: 1.2;
}

.event-line.error {
  color: #ffb59e;
}

.event-inline-icon {
  width: 16px;
  height: 16px;
  margin: 0 2px;
  vertical-align: middle;
  image-rendering: pixelated;
}

.chest-area {
  position: relative;
  min-height: 90px;
  margin-top: 8px;
  border: 2px dashed #5c4b35;
  background: rgba(20, 16, 10, 0.4);
  overflow: hidden;
}

.chest-btn {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.chest-btn img {
  width: 62px;
  height: 62px;
  image-rendering: pixelated;
}

.chest-btn.spawn {
  animation: chestJump 0.6s ease-out;
}

.chest-btn.opened img {
  filter: brightness(1.4) saturate(1.2);
}

.chest-loot {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.loot-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 2px solid #7e6a49;
  background: #2c2317;
  color: #f0e6ce;
  animation: lootPop 0.45s ease-out;
  font-size: 20px;
}

@keyframes chestJump {
  0% { transform: translate(-50%, 24px) scale(0.6); opacity: 0; }
  80% { transform: translate(-50%, -6px) scale(1.04); opacity: 1; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

@keyframes lootPop {
  0% { transform: translateY(12px) scale(0.5); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.actions {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 3px solid var(--line);
  background: rgba(33, 27, 18, 0.94);
  flex: 0 0 auto;
  overflow: visible;
}

.action-group {
  flex: 1;
  min-height: 160px;
  background: var(--panel-soft);
  border: 3px solid var(--line);
  box-shadow: inset 0 0 0 2px #3a3022;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}

.idle-collectors {
  display: flex;
  flex-direction: column;
  gap: 2px;
  
}

.collector-btn {
  width: 100%;
  max-height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
}

.collector-info {
  font-size: 18px;
  color: #d9cca8;
  min-height: 18px;
}

#gatherBtn {
  width: 100%;
  min-height: 38px;
  
}

.collector-btn.is-locked {
  border-color: #77644a;
  background: #2a2218;
  color: #baa98a;
}

.collector-btn.is-upgrade-ready {
  border-color: #90b75b;
  background: #324924;
  color: #ecffd3;
}

.collector-btn:disabled {
  cursor: default;
  opacity: 1;
}

.collector-lock {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 10px;
  margin-left: 6px;
  border: 2px solid #92764f;
  background: linear-gradient(180deg, #5f4a30 0%, #4a3b29 100%);
  box-shadow: inset 0 0 0 1px #3b3022;
}

.collector-lock::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -8px;
  width: 7px;
  height: 8px;
  border: 2px solid #92764f;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
}

.action-group label {
  color: #d8f0a9;
  font-size: 11px;
}

.custom-select {
  position: relative;
  overflow: visible;
}

.select-trigger {
  width: 100%;
  text-align: left;
}

.select-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 30;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 2px solid #625136;
  background: #2a2216;
  max-height: min(40vh, 310px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #90b75b #2a2216;
}

.select-menu::-webkit-scrollbar {
  width: 10px;
}

.select-menu::-webkit-scrollbar-track {
  background: #2a2216;
}

.select-menu::-webkit-scrollbar-thumb {
  background: #6f8f42;
  border: 1px solid #2a2216;
}

.select-option {
  padding: 6px;
  cursor: pointer;
  color: #efe2c8;
  font-size: 24px;
}

.select-option:hover,
.select-option.active {
  background: #415a29;
  color: #ecffd3;
}

.weapon-info {
  min-height: 54px;
  border: 2px dashed #68573d;
  background: rgba(23, 19, 12, 0.6);
  color: #e8d8bd;
  font-size: 22px;
  padding: 8px;
}

.pixel-btn,
input[type="text"],
input[type="password"],
input[type="search"] {
  border: 2px solid #6e5c42;
  background: #2f261a;
  color: var(--text);
  padding: 8px 10px;
  font-size: 11px;
}

.pixel-btn {
  cursor: pointer;
}

.pixel-btn:hover {
  background: #3d3223;
  border-color: #8aa75b;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  font-family: "VT323", monospace;
  font-size: 30px;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(8, 6, 4, 0.8);
  z-index: 50;
}

.modal-card {
  position: relative;
  width: min(560px, 92vw);
  background: linear-gradient(180deg, #463926, #352c1f);
  border: 3px solid #736042;
  box-shadow: inset 0 0 0 2px #2b2216;
  padding: 16px;
}

.modal-card-small {
  width: min(420px, 92vw);
}

.modal-card h2 {
  margin-top: 8px;
  margin-right: 52px;
  margin-bottom: 12px;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.close-x {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 34px;
  height: 34px;
  border: 2px solid #8f774f;
  background: #2c2114;
  color: #f7e9cd;
  font-family: "Press Start 2P", monospace;
  cursor: pointer;
}

.guild-list {
  margin-top: 12px;
  max-height: 220px;
  overflow-y: auto;
  border: 2px solid #605038;
  padding: 8px;
  background: rgba(10, 8, 5, 0.28);
  scrollbar-width: thin;
  scrollbar-color: #7ea24c #2a2216;
}

.guild-list::-webkit-scrollbar {
  width: 12px;
}

.guild-list::-webkit-scrollbar-track {
  background: #2a2216;
  border-left: 1px solid #5a4a35;
}

.guild-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #95ba5f 0%, #607d36 100%);
  border: 2px solid #2a2216;
}

.guild-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a7cc73 0%, #6f8f42 100%);
}

.guild-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guild-list li {
  border-bottom: 1px dashed #675439;
  padding: 5px 0;
  font-size: 22px;
  color: #d8cca9;
}

.guild-lock-icon {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 9px;
  margin-left: 6px;
  top: 1px;
  border: 2px solid #92764f;
  background: linear-gradient(180deg, #5f4a30 0%, #4a3b29 100%);
  box-shadow: inset 0 0 0 1px #3b3022;
}

.guild-lock-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -8px;
  width: 6px;
  height: 7px;
  border: 2px solid #92764f;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.player-detail {
  border: 2px solid #605038;
  padding: 8px;
  font-size: 22px;
  background: rgba(10, 8, 5, 0.28);
  min-height: 90px;
}

.guild-detail-box {
  max-height: 270px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #7ea24c #2a2216;
}

.guild-detail-box::-webkit-scrollbar {
  width: 12px;
}

.guild-detail-box::-webkit-scrollbar-track {
  background: #2a2216;
  border-left: 1px solid #5a4a35;
}

.guild-detail-box::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #95ba5f 0%, #607d36 100%);
  border: 2px solid #2a2216;
}

.guild-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed #655339;
}

.guild-members {
  margin-top: 4px;
}

.guild-member-link {
  color: #dbeec0;
  cursor: pointer;
  text-decoration: underline;
}

.kick-btn {
  border: 2px solid #8d5a48;
  background: #3b251d;
  color: #ffd4c7;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  padding: 4px 6px;
  cursor: pointer;
}

.kick-btn:hover {
  background: #553126;
}

.checkbox-line {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 22px;
}

.checkbox-line input[type="checkbox"] {
  width: auto;
  transform: scale(1.2);
  accent-color: #7ea24c;
}

.ranking-search {
  margin-top: 4px;
  margin-bottom: 8px;
  font-size: 22px;
  padding: 6px 8px;
}

body.portrait-rotate #gameFrame {
  position: fixed;
  width: 100vh;
  height: 100vw;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
}

@media (max-width: 1100px) {
  .layout {
    gap: 10px;
    padding: 10px;
  }

  .panel {
    flex: 0 0 28%;
    min-width: 210px;
  }

  .boss-card {
    width: 100%;
  }

  .boss-stage {
    height: 210px;
  }

  .action-group {
    min-height: 130px;
  }
}

@media (max-width: 900px) {
  .topbar {
    padding: 8px;
  }
  .badge {
    font-size: 9px;
    padding: 6px 8px;
  }
  .layout {
    gap: 8px;
    padding: 8px;
  }
  .panel {
    flex: 0 0 30%;
    padding: 8px;
  }
  .row {
    font-size: 18px;
  }
  .actions {
    padding: 8px;
  }
  .weapon-info {
    font-size: 18px;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  body {
    overflow: hidden;
  }
}
