body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: radial-gradient(circle at top, #1b2430, #090b10 70%);
  color: #eee;
  overflow: hidden;
}

.layout {
  display: flex;
  gap: 0;
  padding: 8px;
  height: 100vh;
  box-sizing: border-box;
  overflow: hidden;
}

.gamePane {
  position: relative;
  flex: 1;
  min-width: 0;
}
.xpPopups {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.xpPopup {
  position: absolute;
  left: 50%;
  top: 130px;
  color: #ffc44a;
  font-weight: 700;
  font-size: 22px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  gap: 8px;
}
.xpRing {
  width: 26px;
  height: 26px;
  margin: 0;
}
.xpRing .skillIcon {
  width: 20px;
  height: 20px;
  font-size: 13px;
}
#miniMapCanvas {
  width: 100%;
  height: auto;
  border: 1px solid #505a73;
  background: #111723;
  display: block;
}

#gameCanvas {
  border: 2px solid #666;
  background: #1e2a1e;
  image-rendering: pixelated;
  height: calc(100vh - 16px);
  width: auto;
  max-width: calc(100vw - 392px);
  touch-action: manipulation;
}

.overlay {
  position: absolute;
  background: rgba(20, 20, 28, 0.92);
  border: 1px solid #57627c;
  border-radius: 8px;
  padding: 8px;
}

.panel {
  resize: both;
  overflow: auto;
  min-width: 220px;
  min-height: 140px;
}

.panelHeader {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  cursor: move;
  color: #cfe0ff;
}

.inventoryPanel {
  width: 100%;
}

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

.inventorySlot {
  border: 1px solid #666;
  background: #10141e;
  border-radius: 6px;
  padding: 4px;
  font-size: 12px;
  color: #eef3ff;
  min-height: 64px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.coinPile {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 18px;
  margin-bottom: 2px;
}
.coinStack {
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 14px;
  background: linear-gradient(180deg, #f5d55b, #b98b1d);
  border: 1px solid #7a5b10;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 238, 167, 0.45);
}
.coinStack::after {
  content: '';
  position: absolute;
  left: 1px;
  right: 1px;
  top: 2px;
  border-top: 1px solid rgba(255, 236, 154, 0.65);
}
.coinStack.s1 { left: 0; height: 11px; z-index: 1; }
.coinStack.s2 { left: 7px; height: 13px; z-index: 2; }
.coinStack.s3 { left: 14px; height: 15px; z-index: 3; }
.coinStack.s4 { left: 21px; height: 17px; z-index: 4; }
.itemIcon { width: 40px; height: 40px; display:block; image-rendering: pixelated; }
.itemEmoji { font-size: 30px; line-height: 1; }
.oreFrag {
  width: 36px;
  height: 36px;
  display: inline-block;
  border-radius: 6px;
  background:
    radial-gradient(circle at 25% 30%, var(--ore) 0 23%, transparent 24%),
    radial-gradient(circle at 68% 22%, color-mix(in srgb, var(--ore) 78%, #111) 0 20%, transparent 21%),
    radial-gradient(circle at 52% 62%, color-mix(in srgb, var(--ore) 85%, #fff 15%) 0 26%, transparent 27%),
    radial-gradient(circle at 18% 70%, color-mix(in srgb, var(--ore) 65%, #000) 0 17%, transparent 18%),
    radial-gradient(circle at 78% 68%, color-mix(in srgb, var(--ore) 70%, #000) 0 14%, transparent 15%),
    #2a2724;
  border: 1px solid rgba(20, 20, 20, 0.7);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35);
}
.itemQtyBadge {
  position: absolute;
  right: 3px;
  bottom: 2px;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 11px;
}

.inventorySlot:hover { border-color: #88a7ff; }
.contextMenu {
  position: absolute;
  background: #1d212d;
  border: 1px solid #7781a3;
  border-radius: 6px;
  min-width: 150px;
  z-index: 50;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.contextMenu button {
  width: 100%;
  background: none;
  color: #eef;
  border: none;
  text-align: left;
  padding: 8px;
  cursor: pointer;
}

.contextMenu button:hover { background: #334066; }
.hidden { display: none !important; }

.hud {
  width: 360px;
  background: #202020;
  border: 1px solid #555;
  padding: 8px;
  overflow: hidden;
  height: calc(100vh - 16px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.hudTop {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
}
.hudTop.singleColumn {
  grid-template-columns: 1fr;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.minimapCard {
  background: #11182a;
  border: 1px solid #5e6a89;
  border-radius: 10px;
  padding: 6px;
  flex: 0 0 auto;
}
.solidPanel {
  background: #11182a;
  border: 1px solid #5e6a89;
  border-radius: 10px;
  padding: 7px;
  resize: none;
}
.minimapHeader {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.hudInfo {
  border: 1px solid #4a4e58;
  padding: 10px;
  border-radius: 8px;
}

.authCard {
  background: linear-gradient(180deg, #1f2535, #151a24);
  border: 1px solid #4f5f8d;
  border-radius: 10px;
  padding: 10px;
}

.authSub {
  color: #a9b4d8;
  margin: 0 0 8px;
  font-size: 12px;
}

h1, h2, h3, h4 { margin: 0 0 8px; }
input, button { margin: 2px 0; }

.row { display: flex; gap: 6px; flex-wrap: wrap; }
ul { margin: 4px 0 12px; padding-left: 20px; }

.modal {
  position: fixed;
  inset: 0;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

.modalBody {
  pointer-events: auto;
  width: min(680px, 92vw);
  background: #151924;
  border: 1px solid #7082b6;
  border-radius: 10px;
  padding: 14px;
}

.tradeColumns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.tradeBox {
  min-height: 120px;
  border: 1px solid #59678d;
  background: #0f1320;
  border-radius: 8px;
  padding: 6px;
}
.tradeItem {
  border: 1px solid #4b5880;
  margin: 4px 0;
  border-radius: 6px;
  padding: 4px;
  background: #1a2238;
  color: #f3f7ff;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.hint { color: #b8bfd8; font-size: 12px; }

.hudChat {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 340px;
  margin-top: 0;
  background: #11182a;
  border: 1px solid #5e6a89;
  border-radius: 10px;
  padding: 7px;
}
.pickupHint {
  color: #94a0c8;
  font-size: 11px;
}

.chatLog {
  height: 130px;
  overflow-y: auto;
  border: 1px solid #4a5372;
  background: #0d1220;
  border-radius: 6px;
  margin-bottom: 6px;
  padding: 4px;
  font-size: 12px;
}

.chatLine { margin: 2px 0; }
.chatLine.system { color: #ffdf8a; }
.chatLine.request {
  color: #8ad0ff;
  cursor: pointer;
  text-decoration: underline;
}
.chatLine.pm {
  color: #f5b8ff;
}
#chatInput { flex: 1; }

.tabRow { margin-bottom: 6px; }
.tabBtn { padding: 4px 8px; }
.tabBtn.active { background: #3b4e86; color: #fff; }
.tabContent { margin-top: 4px; }
.tabContent:not(.hidden) { display: block; flex: 1 1 auto; min-height: 0; }
.questHeaderRow {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.questHeaderRow input {
  flex: 1;
}
.questLayout {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) 1fr;
  gap: 8px;
  max-height: 290px;
  min-height: 220px;
}
#questsTab {
  overflow: hidden;
}
#questList,
#questDetails {
  max-height: 290px;
  overflow-y: auto;
}
.questListBtn {
  width: 100%;
  text-align: left;
}
.questListBtn.done {
  opacity: 0.65;
}
.questListBtn.active {
  border-color: #7cc57e;
}
#questTrackerPanel {
  left: 18px;
  top: 18px;
  width: 280px;
  max-height: 320px;
  resize: both;
  overflow: auto;
}
.equipmentGrid {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  grid-template-rows: repeat(5, 40px);
  justify-content: center;
  gap: 6px;
  grid-template-areas:
    ". aura head ammo ."
    ". cape neck ammo ."
    "weapon . chest shield ."
    ". hands legs ring ."
    ". . feet . .";
}
.equipSlot {
  min-height: 40px;
  border: 1px solid #5d6886;
  border-radius: 6px;
  background: #0f1525;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.equipSlot[data-slot="aura"] { grid-area: aura; }
.equipSlot[data-slot="head"] { grid-area: head; }
.equipSlot[data-slot="ammo"] { grid-area: ammo; }
.equipSlot[data-slot="cape"] { grid-area: cape; }
.equipSlot[data-slot="neck"] { grid-area: neck; }
.equipSlot[data-slot="ammo"] { grid-area: ammo; }
.equipSlot[data-slot="weapon"] { grid-area: weapon; }
.equipSlot[data-slot="chest"] { grid-area: chest; }
.equipSlot[data-slot="shield"] { grid-area: shield; }
.equipSlot[data-slot="hands"] { grid-area: hands; }
.equipSlot[data-slot="legs"] { grid-area: legs; }
.equipSlot[data-slot="ring"] { grid-area: ring; }
.equipSlot[data-slot="feet"] { grid-area: feet; }
.equipSlot.empty::after {
  content: attr(data-slot);
  position: absolute;
  font-size: 10px;
  color: #9aa6c7;
  bottom: 3px;
}
.dialogRow {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.dialogRow.player {
  grid-template-columns: 1fr 54px;
}
.dialogPortrait {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #232c44;
  border: 1px solid #5f6d9a;
  font-size: 28px;
}
.dialogBubble {
  background: #10172a;
  border: 1px solid #51608b;
  border-radius: 8px;
  padding: 10px;
}
.dialogAnswerRow {
  margin-top: 8px;
}
.skillsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 4px;
}
.lootGrid {
  display: grid;
  gap: 6px;
}
.lootEntry {
  border: 1px solid #4f5e86;
  border-radius: 6px;
  padding: 6px;
  background: #10192b;
  font-size: 12px;
  color: #eef3ff;
}
.lootEntry button {
  margin-top: 4px;
  font-size: 11px;
}
.bankGrid {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) 1fr;
  gap: 10px;
}
.bankModalBody {
  width: min(1080px, 97vw);
  max-height: 90vh;
  overflow: hidden;
  background: linear-gradient(180deg, #2e2519, #17120d);
  border: 2px solid #76592f;
  box-shadow: inset 0 0 0 1px rgba(255, 216, 135, 0.16), 0 14px 40px rgba(0, 0, 0, 0.58);
  color: #f4dc9c;
  padding: 8px;
}
.bankTopBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 8px;
}
.bankTopBar #bankCloseBtn {
  min-width: 34px;
  font-weight: 700;
}
.bankTabBarWrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 8px;
}
.bankTabBar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 34px;
}
.bankTabBtn,
.bankPlusTab {
  background: linear-gradient(180deg, #4b3720, #2a1f13);
  border: 1px solid #8f6e3f;
  color: #f6d37b;
  border-radius: 4px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}
.bankTabBtn.active {
  border-color: #d3ae62;
  box-shadow: inset 0 0 0 1px rgba(255, 225, 149, 0.4);
  background: linear-gradient(180deg, #6a4b26, #3b2b17);
}
.bankPlusTab.dragOver {
  border-color: #f0cf87;
  box-shadow: 0 0 12px rgba(247, 212, 123, 0.4);
}
.bankSearchRow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 8px;
}
.bankSearchInput {
  flex: 1;
  min-width: 180px;
  background: #111721;
  border: 1px solid #7c6137;
  border-radius: 4px;
  color: #f0e4be;
  font-size: 14px;
  padding: 7px 10px;
}
.bankCountLabel {
  min-width: 92px;
  text-align: center;
  background: #231b12;
  border: 1px solid #7f6135;
  border-radius: 4px;
  font-size: 13px;
  color: #e0bf79;
  padding: 6px 8px;
}
.bankTitle {
  margin: 0;
  color: #ddbf7d;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 24px;
}
.bankPane {
  border: 1px solid #6f5430;
  border-radius: 4px;
  background: linear-gradient(180deg, #1f1811, #16110d);
  padding: 6px;
  min-height: 240px;
}
.bankPaneTitle {
  margin: 0 0 6px;
  color: #d7ba7b;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}
.bankItemGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 4px;
}
.bankModalBody .lootEntry {
  background: #2a241c;
  border-color: #826a44;
}
.shopGrid {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 6px;
  background: #130f0a;
  border: 1px solid #5f4a2c;
  border-radius: 6px;
}
.shopStockTile {
  position: relative;
  min-height: 72px;
}
.shopPriceBadge {
  position: absolute;
  bottom: 2px;
  left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #f4d37d;
}
@media (max-width: 960px) {
  .bankGrid {
    grid-template-columns: 1fr;
  }
}
/* Smithing modal - polished RuneScape-style layout */
.smithingModalBody {
  width: min(1040px, 96vw);
  max-height: 92vh;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #2a221a 0%, #1b1610 100%);
  border: 2px solid #6a5331;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 214, 141, 0.08);
  color: #e8dcc1;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}
.smithingTitleBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: linear-gradient(180deg, #3a2e1e, #261e13);
  border-bottom: 1px solid #6a5331;
  box-shadow: inset 0 -1px 0 rgba(255, 214, 141, 0.1);
}
.smithingTitleBar h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 2px;
  color: #f5d992;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.smithingTitleActions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.smithingTitleActions button {
  background: linear-gradient(180deg, #4a3a22, #2b2114);
  border: 1px solid #6a5331;
  color: #e8dcc1;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}
.smithingTitleActions button:hover {
  background: linear-gradient(180deg, #5a4528, #362819);
  border-color: #8a6f42;
}
.smithingCloseBtn {
  min-width: 28px;
  font-weight: 700;
}
.smithingLayout {
  display: grid;
  grid-template-columns: 200px 1fr 270px;
  gap: 0;
  min-height: 480px;
  max-height: calc(92vh - 48px);
}
.smithingLeft {
  background: #18130c;
  border-right: 1px solid #5a4428;
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.smithingMiddle {
  background: #0e0b07;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.smithingRight {
  background: #18130c;
  border-left: 1px solid #5a4428;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.smithingSection {
  border: 1px solid #5a4428;
  border-radius: 4px;
  background: linear-gradient(180deg, #22180d, #150f07);
}
.smithingSectionHeader {
  background: linear-gradient(180deg, #3a2d1b, #24180c);
  color: #f5d992;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  border-bottom: 1px solid #5a4428;
  border-radius: 3px 3px 0 0;
}
.metalBarGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  min-height: 40px;
}
.metalBarTile {
  aspect-ratio: 1 / 1;
  border: 1px solid #4a3a22;
  background: #0c0a06;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 2px;
  position: relative;
  font-size: 10px;
  color: #ffcf7a;
  transition: all 0.1s ease;
}
.metalBarTile:hover {
  border-color: #c99a50;
}
.metalBarTile.active {
  border-color: #f5c869;
  box-shadow: 0 0 0 1px rgba(245, 200, 105, 0.4), inset 0 0 6px rgba(245, 200, 105, 0.25);
  background: #1e1608;
}
.metalBarTile.locked {
  opacity: 0.32;
  cursor: default;
  filter: grayscale(0.85);
}
.metalBarTile .barIcon {
  position: absolute;
  inset: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.metalBarTile .barCount {
  position: absolute;
  left: 2px;
  top: 1px;
  font-size: 10px;
  font-weight: 700;
  color: #ffd270;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.9);
}
.smithingLeftFooter {
  margin-top: auto;
  border-top: 1px dashed #5a4428;
  padding-top: 6px;
}
.smithingLeftInvTitle {
  font-size: 10px;
  color: #b9a67a;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.metalInventoryGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.metalInventoryGrid .inventorySlot {
  min-height: 46px;
  background: #0c0a06;
  border: 1px solid #4a3a22;
}
.smithingGroup {
  border: 1px solid #5a4428;
  border-radius: 4px;
  background: linear-gradient(180deg, #1e1609, #130e06);
}
.smithingGroupHeader {
  background: linear-gradient(180deg, #3a2d1b, #24180c);
  color: #f5d992;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid #5a4428;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 3px 3px 0 0;
}
.smithingGroupHeader .groupHint {
  font-weight: 400;
  color: #b9a67a;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}
.smithingGroupGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 62px);
  gap: 6px;
  padding: 8px;
  justify-content: start;
}
.smithItemTile {
  width: 62px;
  height: 62px;
  border: 1px solid #4a3a22;
  background: radial-gradient(circle at 30% 30%, #261c10, #0b0806);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.1s ease;
  padding: 0;
  color: inherit;
  font-family: inherit;
}
.smithItemTile .smithItemIcon {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}
.smithItemTile .smithItemIcon img {
  width: 42px;
  height: 42px;
  image-rendering: pixelated;
}
.smithItemTile:hover {
  border-color: #c99a50;
  background: radial-gradient(circle at 30% 30%, #352613, #0e0a06);
}
.smithItemTile.active {
  border-color: #f5c869;
  box-shadow: 0 0 0 2px rgba(245, 200, 105, 0.45), inset 0 0 8px rgba(245, 200, 105, 0.2);
}
.smithItemTile.locked {
  opacity: 0.38;
  filter: grayscale(0.8);
  cursor: not-allowed;
}
.smithItemTile.missingMats {
  filter: saturate(0.6);
}
.smithItemTile.missingMats::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 60, 60, 0), rgba(255, 60, 60, 0.12));
  pointer-events: none;
}
.smithItemTile .tileLevel {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 10px;
  color: #ffd270;
  font-weight: 700;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.9);
}
.smithItemTile .tileCount {
  position: absolute;
  bottom: 1px;
  right: 3px;
  font-size: 10px;
  color: #e9e3cf;
  background: rgba(0, 0, 0, 0.55);
  padding: 0 3px;
  border-radius: 3px;
}
.smithingGroupEmpty {
  padding: 10px;
  color: #7a6c4f;
  font-style: italic;
  font-size: 11px;
}
/* Right pane: details */
.smithingDetails {
  background: linear-gradient(180deg, #16100a, #0b0805);
  border: 1px solid #5a4428;
  border-radius: 4px;
  padding: 10px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 220px;
}
.smithingDetailsTitle {
  color: #f5d992;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: left;
}
.smithingDetailsIcon {
  float: right;
  width: 36px;
  height: 36px;
  border: 1px solid #5a4428;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0805;
  font-size: 22px;
}
.smithingDetailsSection {
  margin-top: 8px;
  clear: both;
}
.smithingDetailsSection h5 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #b9a67a;
  margin: 0 0 4px;
  font-weight: 700;
}
.smithingValueRow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 10px;
  color: #d5c79e;
}
.smithingValueRow .valueCell {
  background: #0b0805;
  border: 1px solid #3b2e18;
  border-radius: 3px;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.smithingValueRow .valueCell .valueIcon {
  font-size: 14px;
  color: #f5c869;
}
.smithingValueRow .valueCell .valueNum {
  font-size: 11px;
  color: #f5eccb;
  font-weight: 700;
}
.smithingReqRow {
  font-size: 11px;
  color: #d5c79e;
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.smithingReqRow .reqMark {
  font-weight: 700;
}
.smithingReqRow.ok .reqMark { color: #6bd07c; }
.smithingReqRow.missing .reqMark { color: #ff6060; }
.smithingReqRow.missing { color: #ff9d9d; }
.smithingProgressWrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.smithProgressBar {
  height: 14px;
  background: #0b0805;
  border: 1px solid #5a4428;
  border-radius: 3px;
  overflow: hidden;
}
.smithProgressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a26a22, #f5c869);
  transition: width 0.2s ease;
}
.smithProgressLabel {
  font-size: 10px;
  text-align: center;
  color: #b9a67a;
}
.smithingQuantityRow {
  display: grid;
  grid-template-columns: 28px 1fr 28px 56px;
  gap: 4px;
  align-items: center;
}
.smithQtyStep {
  background: linear-gradient(180deg, #4a3a22, #2b2114);
  border: 1px solid #6a5331;
  color: #e8dcc1;
  font-size: 14px;
  border-radius: 3px;
  cursor: pointer;
  height: 26px;
  padding: 0;
}
.smithQtyStep:hover { background: linear-gradient(180deg, #5a4528, #362819); }
.smithQtySlider {
  width: 100%;
  accent-color: #f5c869;
}
.smithQtyInput {
  background: #0b0805;
  border: 1px solid #5a4428;
  color: #f5eccb;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 3px;
  text-align: right;
  height: 26px;
  box-sizing: border-box;
}
.smithBeginBtn {
  background: linear-gradient(180deg, #f2c565, #a4751f);
  border: 1px solid #6a4c10;
  color: #1a1108;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 12px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.smithBeginBtn:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffd97a, #b9862a);
}
.smithBeginBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.smithingError {
  color: #ff8080;
  font-size: 11px;
  text-align: center;
  min-height: 14px;
}
.skillCard {
  border: 1px solid #6778a7;
  border-radius: 6px;
  background: #121a2d;
  text-align: center;
  padding: 2px 2px 3px;
  font-size: 9px;
  cursor: pointer;
  min-height: 38px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.skillCard.active {
  border-color: #d3b06a;
  background: linear-gradient(180deg, #1a233d, #111829);
  box-shadow: inset 0 0 0 1px rgba(222, 187, 113, 0.35);
}
.skillIcon { font-size: 16px; }
.skillIconRing {
  --pct: 0;
  width: 24px;
  height: 24px;
  margin: 0 auto 1px;
  border-radius: 50%;
  background: conic-gradient(#f1c55f calc(var(--pct) * 1%), #2d3550 0);
  display: flex;
  align-items: center;
  justify-content: center;
}
.skillIconRing .skillIcon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0f1629;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

#inventoryPanel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#skillsTab {
  max-height: none;
  overflow: visible;
  padding-right: 0;
  display: flex;
  flex-direction: column;
}
#totalLevelsRow {
  margin-top: auto;
  padding-top: 8px;
  text-align: center;
  font-weight: 700;
}
.goldTotal {
  color: #f2c45a;
}
.skillDetails {
  margin-top: 10px;
  border: 1px solid #5e6a89;
  border-radius: 10px;
  background: linear-gradient(180deg, #121826, #0d1220);
  padding: 10px;
}
.skillDetailsHeader {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.skillDetailsTitle {
  font-size: 16px;
  font-weight: 700;
  color: #f1d28a;
}
.skillDetailsLevel {
  font-size: 13px;
  color: #cdd7f7;
}
.skillDetailsSummary {
  margin: 8px 0 10px;
  color: #b7c2e8;
  font-size: 12px;
}
.skillUnlockList {
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}
.skillUnlockRow {
  display: grid;
  grid-template-columns: 56px 1fr 74px;
  gap: 8px;
  align-items: center;
  border: 1px solid #46557d;
  border-radius: 8px;
  padding: 6px;
  background: #10182b;
}
.skillUnlockRow.locked {
  filter: grayscale(0.8);
  opacity: 0.58;
}
.skillUnlockLevel {
  font-weight: 700;
  color: #d9bd7b;
}
.skillUnlockName {
  font-weight: 700;
  color: #e8ecff;
}
.skillUnlockDesc {
  font-size: 11px;
  color: #b4bfdd;
}
.skillUnlockState {
  text-align: right;
  font-size: 11px;
  color: #9cb0e5;
}
.skillUnlockRow.unlocked .skillUnlockState {
  color: #78d18f;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .hud {
    width: auto;
  }
  .hudTop {
    grid-template-columns: 1fr;
  }

  #gameCanvas {
    width: 100%;
  }

  .inventoryPanel,
  .chatPanel {
    width: min(96vw, 480px);
    min-width: 260px;
  }

  .contextMenu button,
  button,
  input {
    font-size: 16px;
  }

  .smithingLayout {
    grid-template-columns: 1fr;
  }
  .smithingLeft,
  .smithingRight {
    border-left: none;
    border-right: none;
    border-top: 1px solid #5a4428;
  }
}
