:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html,
body {
  width: 100%;
  min-width: 960px;
  min-height: 690px;
  margin: 0;
  overflow: hidden;
  background: #080303;
}

button,
input,
select { font: inherit; }

html,
body { cursor: url('/assets/ui/cursor-default.png') 2 2, default; }
button,
a[href],
select { cursor: url('/assets/ui/cursor-pointer.png') 2 2, pointer; }
input[type='text'],
input[type='password'],
input[type='number'],
input[type='search'] { cursor: text; }

.market-stage {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.market-window {
  position: relative;
  width: 960px;
  height: 690px;
  overflow: hidden;
  color: #f1e6c7;
  background: #350707 url('/assets/game-market/market_skin.png') no-repeat 0 0;
  text-shadow: 1px 1px 1px #000;
}

.game-button,
.account-button {
  height: 28px;
  padding: 0 9px;
  color: #ead69a;
  border: 1px solid #a87c2b;
  background: linear-gradient(#752317, #3e0d0b 48%, #230404 52%, #45100d);
  box-shadow: inset 0 0 0 1px rgba(255, 211, 103, .18), 0 1px 2px #090000;
  font-size: 11px;
  line-height: 26px;
  text-align: center;
  text-shadow: 1px 1px 1px #000;
  cursor: pointer;
}

.game-button:hover,
.game-button.is-active,
.account-button:hover {
  color: #fff3bd;
  border-color: #d2a64d;
  background: linear-gradient(#8e3020, #561310 48%, #310606 52%, #661712);
}

.game-button:disabled { cursor: not-allowed; filter: grayscale(.75); opacity: .58; }

.market-balance,
.market-status {
  position: absolute;
  z-index: 2;
  left: 600px;
  width: 300px;
  font-size: 12px;
}

.market-balance { top: 40px; color: #e8ca78; }
.market-status { top: 63px; color: #80ed83; }
.market-status.is-closed { color: #ff7070; }

.close-button {
  position: absolute;
  z-index: 10;
  top: 12px;
  left: 926px;
  width: 22px;
  height: 28px;
  padding: 0;
  color: #f4d792;
  font-weight: bold;
}

.top-menu {
  position: absolute;
  z-index: 3;
  top: 110px;
  left: 228px;
  display: flex;
  gap: 4px;
}

.top-menu .game-button:nth-child(1) { width: 86px; }
.top-menu .game-button:nth-child(2) { width: 94px; }
.top-menu .game-button:nth-child(3) { width: 112px; }
.top-menu .game-button:nth-child(4) { width: 96px; }
.top-menu .game-button.wide { width: 142px; }

.market-search {
  position: absolute;
  z-index: 4;
  top: 110px;
  left: 780px;
  display: flex;
  gap: 6px;
  width: 156px;
}

.market-search input {
  width: 100px;
  height: 24px;
  margin-top: 2px;
  padding: 2px 6px;
  color: #f2e6c5;
  border: 1px solid #8c6323;
  outline: none;
  background: rgba(28, 3, 3, .82);
  font-size: 10px;
}

.market-search input:focus { border-color: #d0aa58; }
.market-search .game-button { width: 50px; padding: 0; }

.category-menu {
  position: absolute;
  z-index: 2;
  top: 115px;
  left: 22px;
  width: 184px;
}

.category-menu button {
  display: block;
  width: 184px;
  margin: 0 0 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.category-menu button.subcategory {
  width: 176px;
  height: 24px;
  margin: -2px 0 5px 8px;
  color: #cab77f;
  line-height: 22px;
  background: linear-gradient(#4b1510, #250504);
}

.wheel-menu {
  position: absolute;
  z-index: 2;
  top: 608px;
  left: 28px;
  width: 174px;
}

.market-content {
  position: absolute;
  top: 146px;
  left: 230px;
  width: 704px;
  height: 518px;
}

.content-heading {
  display: flex;
  height: 27px;
  align-items: flex-start;
  justify-content: space-between;
}

.content-heading h1 {
  margin: 0;
  color: #e8ca78;
  font: normal 12px/24px Arial, sans-serif;
  text-shadow: 1px 1px #000;
}

.account-button {
  height: 22px;
  margin-right: 8px;
  padding: 0 9px;
  line-height: 20px;
}

.market-notice {
  position: absolute;
  z-index: 6;
  top: 30px;
  left: 0;
  width: 704px;
  margin: 0;
  padding: 7px 10px;
  color: #f5d98c;
  border: 1px solid #a87c2b;
  background: rgba(38, 4, 4, .94);
  font-size: 11px;
  text-align: center;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 230px);
  grid-auto-rows: 106px;
  gap: 6px 7px;
}

.product-card {
  position: relative;
  width: 230px;
  height: 106px;
  overflow: hidden;
  color: #eee3c8;
  border: 1px solid #a87c2b;
  background: rgba(43, 8, 8, .90);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .46);
}

.product-card h2 {
  height: 31px;
  margin: 0;
  padding: 4px 5px 0;
  overflow: hidden;
  color: #e8ca78;
  font: normal 11px/14px Arial, sans-serif;
}

.product-card img {
  position: absolute;
  top: 35px;
  left: 7px;
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(1px 2px 2px #000);
}

.product-count {
  position: absolute;
  top: 38px;
  left: 48px;
  margin: 0;
  color: #eee3c8;
  font-size: 10px;
}

.product-vnum {
  position: absolute;
  top: 54px;
  left: 48px;
  margin: 0;
  color: #9f8962;
  font-size: 9px;
}

.product-buy {
  position: absolute;
  top: 76px;
  left: 27px;
  width: 176px;
  height: 25px;
  padding: 0 5px;
  line-height: 23px;
}

.pager {
  position: absolute;
  top: 486px;
  left: 0;
  display: grid;
  width: 704px;
  grid-template-columns: 40px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  text-align: center;
}

.pager .game-button { width: 100%; padding: 0; }

.history-view {
  height: 460px;
  overflow: auto;
  border-top: 1px solid rgba(168, 124, 43, .55);
}

.history-row {
  display: grid;
  min-height: 28px;
  padding: 6px 7px;
  grid-template-columns: 130px 1fr 92px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(168, 124, 43, .42);
  background: rgba(43, 8, 8, .70);
  font-size: 10px;
}

.history-row:nth-child(even) { background: rgba(32, 5, 5, .70); }
.history-row strong { color: #e8ca78; }
.history-row .history-price { color: #e8ca78; text-align: right; }

.information-view {
  min-height: 180px;
  padding: 36px 22px;
  color: #f0e3c4;
  border: 1px solid rgba(168, 124, 43, .65);
  background: rgba(43, 8, 8, .78);
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

.information-view h2 { margin: 0 0 15px; color: #e8ca78; font: normal 15px Georgia, serif; }
.empty-state { padding: 48px 10px; color: #d7c69f; text-align: center; }

.dialog-backdrop {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  background: rgba(0, 0, 0, .62);
  place-items: center;
}

.market-dialog {
  position: relative;
  width: 360px;
  min-height: 250px;
  padding: 22px 28px;
  color: #eee2c6;
  border: 2px solid #a87c2b;
  outline: 1px solid #3f0c08;
  background: radial-gradient(circle at 50% 0, #5a1310, #280505 72%);
  box-shadow: 0 12px 40px #000, inset 0 0 28px rgba(0, 0, 0, .7);
}

.market-dialog h2 {
  margin: 0 0 18px;
  color: #e8ca78;
  font: normal 17px Georgia, serif;
  text-align: center;
}

.market-dialog label { display: block; margin: 9px 0 4px; color: #d9c690; font-size: 11px; }
.market-dialog input,
.market-dialog select {
  width: 100%;
  height: 28px;
  padding: 3px 7px;
  color: #f7eaca;
  border: 1px solid #926b2c;
  outline: none;
  background: #220505;
}

.market-dialog select { margin-bottom: 8px; }
.dialog-primary { width: 100%; margin-top: 14px; }
.dialog-link { display: block; margin-top: 12px; color: #e8ca78; font-size: 10px; text-align: center; }
.dialog-close { position: absolute; top: 4px; right: 8px; color: #d8bd75; border: 0; background: transparent; font-size: 22px; cursor: pointer; }
.dialog-message { min-height: 16px; margin: 12px 0 0; color: #ff8880; font-size: 10px; text-align: center; }
.dialog-message.is-success { color: #80ed83; }
.account-name { color: #e8ca78; font-weight: bold; }
.purchase-dialog { width: 420px; }
.purchase-product { min-height: 56px; padding: 9px; border: 1px solid rgba(168, 124, 43, .55); background: rgba(24, 2, 2, .62); }
.purchase-product img { float: left; width: 38px; height: 38px; margin: 0 12px 4px 0; object-fit: contain; }
.purchase-product strong { display: block; color: #e8ca78; }
.dialog-actions { display: flex; gap: 9px; }
.dialog-actions .game-button { flex: 1; }

.market-toast {
  position: absolute;
  z-index: 40;
  right: 24px;
  bottom: 24px;
  max-width: 390px;
  padding: 10px 14px;
  color: #f4e6c4;
  border: 1px solid #a87c2b;
  background: rgba(29, 3, 3, .96);
  box-shadow: 0 4px 15px #000;
  font-size: 11px;
}

@media (max-width: 959px), (max-height: 689px) {
  html,
  body { overflow: auto; }
}
