/* World NPCs/chests stay below player sprites (2), effects (3) and HUD (5). */
.storage-money-dialog{text-align:center}.storage-money-dialog label{justify-content:center;flex-wrap:wrap}.storage-money-dialog .inventory-detail-actions button{flex:1}.storage-money-dialog .inventory-detail-error{min-height:1.5em}
.storage-world-actor{position:absolute;z-index:1;background:transparent!important;border:0!important;padding:0!important;margin:0!important;min-width:0!important;min-height:0!important;cursor:pointer}.storage-world-actor[hidden]{display:none}.storage-world-actor span{position:absolute;left:50%;top:-8px;transform:translate(-50%,-100%);white-space:nowrap;color:#fff;font:12px 'Phong Than PC v1.1';text-shadow:1px 1px #000,-1px -1px #000}
.character-storage{box-sizing:border-box;position:fixed;inset:0;margin:auto;width:min(720px,calc(100vw - 12px));max-height:calc(100dvh - 12px);padding:6px;color:#e4d5a4;background:#070906;border:1px solid #bd9a45;border-radius:3px;box-shadow:inset 0 0 0 3px #3d2c13,0 4px 15px #0009;font:12px/1.4 'Phong Than PC v1.1';text-align:center;text-shadow:1px 1px #000,-1px -1px #000}.character-storage[hidden]{display:none}.character-storage>header{display:flex;align-items:center;justify-content:center;position:relative;min-height:30px;padding:0 30px;border-bottom:1px solid #a8873e;background:linear-gradient(100deg,#20180d,#2a2114,#16130b);color:#e8d399}.character-storage>header .ui-close{position:absolute;right:0;top:0;width:28px;height:28px;margin:0;display:grid;place-items:center;font:inherit;color:#e4d5a4;background:#13140c;border:1px solid #68532e}.storage-pair{display:grid;grid-template-columns:minmax(0,1.08fr) minmax(0,1fr);gap:8px;max-height:calc(100dvh - 56px);overflow:auto;align-items:start;padding-top:6px}.character-storage:not(.storage-paired) .storage-pair{display:block}.storage-pane{min-width:0}.storage-section-title{margin:0 0 5px;padding:3px;font-size:13px;color:#e8d399;border-bottom:1px solid #a8873e;background:linear-gradient(100deg,#20180d,#2a2114,#16130b)}.storage-pane button,.storage-pane input{box-sizing:border-box;font:inherit;text-align:center;background:#13140c;color:#e4d5a4;border:1px solid #68532e;border-radius:0;padding:3px;min-height:24px;text-shadow:1px 1px #000;min-width:0}.storage-pane nav{display:grid;grid-template-columns:repeat(5,1fr);gap:3px;margin-bottom:6px}.storage-pane button[aria-pressed=true]{outline:1px solid #ffe080;outline-offset:-2px;background:#55421a}.character-storage-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:0}.storage-money{border-top:1px solid #68532e;margin-top:6px;padding-top:6px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}.storage-money output{grid-column:1/-1;display:block;padding:4px;min-width:0;border:1px solid #68532e;background:#0b0d08;color:#e4d5a4;text-align:center}.storage-pane label{display:flex;align-items:center;justify-content:center;gap:4px;min-width:0}.storage-pane input{width:54px}.storage-pane p{width:100%;margin:3px 0;overflow-wrap:anywhere}.storage-pane button:disabled{opacity:.45}[data-storage-inventory]{min-width:0;position:relative}[data-storage-inventory][hidden]{display:none}[data-storage-inventory] .inventory-in-upgrade{position:relative!important;left:0!important;right:auto!important;top:0!important;max-width:none;margin:0;z-index:auto}[data-storage-inventory] .inventory-window,[data-storage-inventory] .inventory-window button,[data-storage-inventory] .inventory-window output,[data-storage-inventory] .inventory-window h2{font-family:'Phong Than PC v1.1'!important}
@media(max-width:430px){.character-storage{font-size:11px}.storage-pair{gap:6px;grid-template-columns:minmax(0,1.08fr) minmax(0,1fr)}.storage-pane button,.storage-pane input{font-size:11px}.storage-section-title{font-size:12px}}

.storage-slot-surface{position:relative;margin:0 auto}.storage-slot-surface .character-storage-grid{position:absolute;left:0;top:0;gap:0;transform-origin:top left}

.storage-slot-surface button.inventory-cell{color:#e6d6a6;font-family:'Phong Than PC v1.1'!important;font-size:12px;line-height:1.25;margin:0;min-width:0;min-height:0;box-shadow:none;border-radius:0;text-shadow:0 1px #000}

/* The chest is a compact inventory extension, with its own close control. */
.character-storage.storage-paired>header{display:none}.character-storage.storage-paired{padding:5px}.storage-paired .storage-pair{padding-top:0;max-height:calc(100dvh - 24px)}.storage-paired .storage-pane{border:1px solid #a8873e;padding:3px;box-sizing:border-box}.storage-section-title{position:relative;display:grid;place-items:center;min-height:24px;padding:0 25px;box-sizing:border-box}.storage-section-title .ui-close{position:absolute;right:0;top:0;width:23px;height:23px;min-height:0;padding:0;display:grid;place-items:center;font-size:18px}.storage-money{margin-bottom:0}
/* Only large desktop windows with a mouse get the larger paired panel. */
@media(min-width:1000px) and (min-height:700px) and (hover:hover) and (pointer:fine){.character-storage.storage-paired{width:min(calc(100vw - 32px),calc((100dvh - 40px)*var(--storage-aspect,1)*2 + 36px));font-size:clamp(15px,1.5vmin,28px)}.storage-paired .storage-pane button:not(.inventory-cell){min-height:clamp(32px,3.6vmin,60px);font-size:inherit}.storage-paired .storage-section-title{font-size:clamp(17px,1.8vmin,32px);min-height:clamp(32px,3.6vmin,60px)}.storage-paired .storage-section-title .ui-close{min-height:0;height:100%;width:clamp(30px,3.4vmin,58px)}.storage-paired .storage-pair{gap:12px;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}

/* Both panels use native inventory units, then the exact same outer scale. */
.storage-paired .storage-pane{position:relative;padding:0;border:0;justify-self:center}
.storage-native{position:absolute;left:0;top:0;transform-origin:top left;box-sizing:border-box;padding:3px 12px 6px;border:1px solid #bd9a45;background:#070906;box-shadow:inset 0 0 0 3px #3d2c13;font:12px/1.4 'Phong Than PC v1.1'}
.storage-paired .storage-native .storage-section-title{height:26px;min-height:26px;margin:0 -9px 4px;padding:0 25px;font:600 17px/25px 'Phong Than PC v1.1';border:0;border-bottom:1px solid #a8873e;background:linear-gradient(100deg,#20180d,#2a2114,#16130b);color:#e8d399}
.storage-paired .storage-native nav{display:flex;justify-content:center;gap:5px;height:22px;margin:0 0 4px}
.storage-paired .storage-native nav button{width:27px;height:20px;min-height:0;padding:0;font:12px/1.25 'Phong Than PC v1.1';border:1px solid #68532e;background:#13140c;color:#e4d5a4}
.storage-paired .storage-native .storage-money{gap:5px;margin-top:6px;padding-top:6px}
.storage-paired .storage-native .storage-money button{height:28px;min-height:0;padding:0;border:1px solid #a8873e;border-radius:1px;background:linear-gradient(#2e2415,#17130a);color:#e4d5a4;font:14px/1.2 'Phong Than PC v1.1'}
.storage-paired .storage-native .storage-money output{box-sizing:border-box;display:flex;align-items:center;justify-content:center;height:26px;min-height:0;padding:0;border:1px solid #9d8748;background:#050904;color:#e8d8a4;font:14px/1.2 'Phong Than PC v1.1'}
.storage-paired .storage-native .storage-section-title .ui-close{top:1px;right:0;width:23px;height:23px;min-height:0;padding:0;border:1px solid #a8873e;border-radius:2px;background:#1b170d;color:#e6d6a6;font:23px/20px Georgia,serif!important}

/* Shared controls: dimensions are native units before either panel is scaled. */
.storage-paired .storage-native .storage-section-title,.storage-paired .inventory-heading{box-sizing:border-box;height:26px;min-height:26px;font-size:17px!important;line-height:1.2;font-weight:600;color:var(--ui-title,#ead392);background:linear-gradient(100deg,#20180d,#2a2114,#16130b);border-bottom:1px solid #a8873e;display:flex;align-items:center;justify-content:center}
.storage-paired .inventory-heading{font-size:12px!important;padding:0 26px 0 8px!important;white-space:nowrap;overflow:hidden}
.storage-paired .inventory-heading>span{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.storage-paired .storage-native nav button,.storage-paired .inventory-page-tabs button{box-sizing:border-box;width:27px;height:20px;min-height:0;font:12px/1.3 'Phong Than PC v1.1';color:var(--ui-text,#e4d5a4);border:1px solid var(--ui-border,#a8873e);border-radius:2px;background:var(--ui-control,#211a0f)}
.storage-paired .storage-native .storage-money{grid-template-columns:repeat(3,minmax(0,1fr));justify-content:center}
.storage-paired .storage-native .storage-money button,.storage-paired .inventory-actions button{box-sizing:border-box;height:28px;min-height:0;font:14px/1.3 'Phong Than PC v1.1';color:var(--ui-text,#e4d5a4);border:1px solid var(--ui-border,#a8873e);border-radius:2px;background:var(--ui-control,#211a0f)}
.storage-paired .storage-native .storage-money output{grid-column:1/-1;width:100%;justify-self:stretch}
.storage-paired .storage-native .storage-money output,.storage-paired .inventory-money output{box-sizing:border-box;height:26px;padding:0;font:14px/1.2 'Phong Than PC v1.1';color:#e8d8a4;border:1px solid #9d8748;border-radius:0;background:#050904;display:flex;align-items:center;justify-content:center}

.storage-paired .storage-pane .storage-native nav button{min-height:0;height:20px}.storage-paired .storage-pane .storage-native .storage-money button{min-height:0;height:28px}.storage-paired .storage-pane .storage-native .storage-section-title .ui-close{min-height:0;height:23px;width:23px}


/* Storage summons the existing inventory beside it; no shared visual window. */
.character-storage.storage-paired{background:transparent;border:0;border-radius:0;box-shadow:none;padding:0;overflow:visible;max-height:calc(100dvh - 12px)}
.character-storage.storage-paired::backdrop{background:transparent}
.storage-paired .storage-pair{padding:0;gap:12px;overflow:visible;max-height:none;align-items:start;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.storage-paired .storage-pane{justify-self:center}
@media(max-width:430px){.storage-paired .storage-pair{gap:8px}}

/* app.css gives generic dialogs a330px cap; paired inventory owns its viewport fit. */
.character-storage.storage-paired{max-width:calc(100vw - 12px)}


/* Shared ui-close already draws one SVG cross; never also render the × text. */
body.ingame .storage-paired .storage-native .storage-section-title button.ui-close{font-size:0!important;line-height:0!important}


/* --- KEEPER & TOP RACING DIALOG (DÙNG NGUYÊN BẢN 100% FORM CỦA NPC TÂN THỦ) --- */
.newcomer-dialog.keeper-table-dialog {
  width: min(520px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
}

.character-storage.storage-keeper > header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 30px !important;
  padding: 0 4px 0 8px !important;
  background: linear-gradient(100deg, #20180d, #2a2114, #16130b) !important;
  border-bottom: 1px solid #a8873e !important;
  color: #ead392 !important;
}
.character-storage.storage-keeper > header [data-storage-title] {
  color: #ead392 !important;
  font-size: 14px !important;
  font-weight: bold !important;
  text-shadow: 1px 1px #000 !important;
}
.character-storage.storage-keeper > header .ui-close {
  position: static !important;
  display: grid !important;
  place-items: center !important;
  width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #18150c !important;
  color: #f0cf83 !important;
  border: 1px solid #68532e !important;
  border-radius: 2px !important;
  font-size: 20px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  text-shadow: 1px 1px #000 !important;
  z-index: 10 !important;
}
.character-storage.storage-keeper > header .ui-close:hover {
  background: #3f2f16 !important;
  border-color: #fce072 !important;
  color: #fff !important;
}
.character-storage.storage-keeper .storage-pair {
  display: block !important;
  flex: 1 !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  overflow: visible !important;
}
.character-storage.storage-keeper .storage-pane {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
}

/* Container menu chuẩn NPC Tân Thủ */
.keeper-menu-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.keeper-options {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  padding: 5px 0 0 !important;
}
.keeper-options button {
  box-sizing: border-box;
  min-height: 32px !important;
  height: 32px !important;
  width: 100%;
  border: 1px solid #8f773b;
  border-radius: 2px;
  background: #211a0f;
  color: #e4d5a4;
  font: inherit;
  font-size: 13px;
  padding: 0 10px;
  cursor: pointer;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}
.keeper-options button:hover {
  background: #3b2c15;
  border-color: #ffd875;
  color: #fff;
}

.keeper-footer {
  margin-top: 5px !important;
  border-top: 1px solid #54452c !important;
  padding: 5px 0 0 !important;
}
.keeper-footer button {
  box-sizing: border-box;
  min-height: 28px !important;
  height: 28px !important;
  border: 1px solid #8f773b;
  border-radius: 2px;
  background: #211a0f;
  color: #d8c89d;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0 10px;
}
  border: 1px solid #8f773b;
  border-radius: 2px;
  background: #211a0f;
  color: #d8c89d;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0 14px;
}
.keeper-footer button:hover {
  background: #3b2c15;
  border-color: #ffd875;
  color: #fff;
}

.keeper-subhead {
  padding: 5px 8px;
  margin-bottom: 6px;
  background: #15190e;
  border: 1px solid #54452c;
  border-radius: 2px;
  color: #ffd875;
  font-weight: bold;
  font-size: 13px;
  text-align: center;
}

/* Bảng Đua Top dạng 3 cột theo đúng bản vẽ tay */
.keeper-table-scroll {
  flex: 1;
  min-height: 0;
  max-height: calc(100dvh - 180px);
  overflow-y: auto;
  overflow-x: hidden !important;
  scrollbar-width: thin;
  scrollbar-color: #8f773b #10120b;
  background: #080b07;
  border: 1px solid #483b23;
  margin-top: 5px;
  margin-bottom: 4px;
}
.keeper-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed !important;
  font: 12px/1.35 'Phong Than PC v1.1', 'TG Vietnamese Serif', Georgia, serif;
}
.keeper-table th {
  position: sticky;
  top: 0;
  background: #1a150c;
  color: #f0cf83;
  font-weight: bold;
  padding: 6px 8px;
  border-bottom: 1px solid #54452c;
  z-index: 2;
  text-shadow: 1px 1px #000;
}
.keeper-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #2e2617;
  vertical-align: middle;
  color: #e4d5a4;
  text-shadow: 1px 1px #000;
}
.keeper-table .col-rank {
  width: 55px !important;
  text-align: center;
  font-weight: bold;
  color: #ffd875;
}
.keeper-table .col-item {
  width: auto !important;
  text-align: left;
  padding: 6px 10px;
  color: #fce7b2;
  line-height: 1.4;
  word-break: break-word;
}
.keeper-table .col-action {
  width: 75px !important;
  text-align: center;
}
.keeper-table tr:hover td {
  background: #161b10;
}

/* Nút Nhận Quà */
.btn-top-claim {
  min-height: 24px !important;
  height: 24px !important;
  padding: 0 14px !important;
  font-size: 11px !important;
  font-family: inherit !important;
  background: #2b2012 !important;
  color: #ffd875 !important;
  border: 1px solid #8f773b !important;
  border-radius: 2px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-shadow: none !important;
}
.btn-top-claim:hover:not(:disabled) {
  border-color: #ffd875 !important;
  background: #534022 !important;
  color: #fff !important;
}
.btn-top-claim:disabled {
  opacity: 0.45 !important;
  cursor: default !important;
}

/* Chuẩn hiển thị cho bảng Đua Top trên màn hình điện thoại */
@media (max-width: 520px) {
  .keeper-table-scroll {
    max-height: calc(100dvh - 130px);
  }
  .keeper-table {
    font-size: 11px;
  }
  .keeper-table th,
  .keeper-table td {
    padding: 4px 3px;
  }
  .keeper-table .col-rank {
    width: 44px;
    font-size: 10.5px;
  }
  .keeper-table .col-item {
    padding: 4px 5px;
    font-size: 11px;
    line-height: 1.35;
  }
  .keeper-table .col-action {
    width: 66px;
  }
  .btn-top-claim {
    min-height: 22px;
    height: 22px;
    padding: 0 4px;
    font-size: 10px;
  }
}

