/* Phone content for the shared #dialog on the Android layout (android/mobile-*.js):
   NPC pages, trade, bookmarks, polymorph and the message box. Built on the .mw-*
   kit (mobile-ui.css). The #dialog shell itself (size, position, header) is styled
   elsewhere; these rules only shape what goes inside it. Sizes that the generic
   Android dialog rule (#dialogbody button{min-height:44px;font-size:17px}) or
   style.css (#dialogbody button{margin:4px}) would override carry !important. */

/* Shared: sticky full-width action bar and hover that matches the kit's colours. */
.mw-dlg-actions{position:sticky;bottom:0;z-index:1;display:flex;gap:10px;padding:10px 0 2px;margin-top:8px;background:linear-gradient(rgba(23,21,18,0),rgba(23,21,18,.97) 12px)}
#dialog .mw-dlg-actions .mw-button{flex:1;min-height:52px!important;margin:0!important;font-size:17px!important;border-radius:6px;box-shadow:none}
#dialog :is(.mw-dlg-npc,.mw-dlg-trade,.mw-dlg-bookmark,.mw-dlg-poly) :is(.mw-button,.mw-tile,.mw-row-main){box-shadow:none;border-radius:6px}
#dialog :is(.mw-dlg-npc,.mw-dlg-trade,.mw-dlg-bookmark,.mw-dlg-poly) .mw-button:not(.primary):not(.danger){background:#302820;border:1px solid #8d7248;color:#eee8dc}
#dialog :is(.mw-dlg-npc,.mw-dlg-trade,.mw-dlg-bookmark,.mw-dlg-poly) .mw-button.primary{background:#6b5226;border:1px solid #d0a95c;color:#fff4d6}
#dialog :is(.mw-dlg-npc,.mw-dlg-trade,.mw-dlg-bookmark,.mw-dlg-poly) .mw-button.danger{background:#302820;border:1px solid #8a4a3f;color:#f3c0b5}
#dialog :is(.mw-dlg-npc,.mw-dlg-trade,.mw-dlg-bookmark,.mw-dlg-poly) :is(.mw-button,.mw-row-main,.mw-tile):active:not(:disabled){background:#59472c;color:#fff}
#dialog :is(.mw-dlg-npc,.mw-dlg-trade,.mw-dlg-bookmark,.mw-dlg-poly) .mw-button.selected{background:#59472c;color:#fff}
#dialog :is(.mw-dlg-npc,.mw-dlg-trade,.mw-dlg-bookmark,.mw-dlg-poly) :disabled{opacity:.45}

/* NPC / HTML pages: readable text, links as gold words, actions as one list. */
.mw-dlg-npc{display:flex;flex-direction:column;gap:14px;color:#eee8dc;font:16px/1.6 "Microsoft JhengHei","PingFang TC",sans-serif}
#dialog .mw-dlg-npc .pc-npc-body{min-height:0;font:inherit;line-height:1.6;color:inherit;white-space:normal;overflow-wrap:anywhere;word-break:break-word;user-select:text;-webkit-user-select:text}
#dialog .mw-dlg-npc .pc-npc-body p{margin:0 0 8px}
.mw-dlg-npc-link{color:#ffd78a;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.mw-dlg-npc-link.disabled{color:#9a9486;text-decoration:none;cursor:default}
.mw-dlg-npc-actions{display:flex;flex-direction:column;gap:8px}
.mw-dlg-npc-actions:empty{display:none}
#dialog .mw-dlg-npc .mw-dlg-npc-action,#dialog.mw-dlg-talk #dialogbody>button{display:flex;align-items:center;gap:12px;width:100%;min-height:52px!important;margin:0!important;padding:6px 16px;text-align:left;font:16px/1.3 "Microsoft JhengHei","PingFang TC",sans-serif!important;white-space:normal;border-radius:6px;box-shadow:none;background:#302820;border:1px solid #8d7248;color:#eee8dc}
#dialog.mw-dlg-talk #dialogbody>button{justify-content:center;margin-top:8px!important}
.mw-dlg-npc-action-icon{flex:0 0 auto;max-height:32px;max-width:48px;image-rendering:pixelated}
.mw-dlg-npc-action-label{flex:1;min-width:0}
.mw-dlg-npc-action-detail{flex:0 1 auto;max-width:45%;font-size:14px;color:#ffd78a;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#dialog.mw-dlg-talk #dialogbody>p{font-size:15px;color:#c8b58c}
/* Forms the NPC flows append (inn key count, etc.). */
#dialog.mw-dlg-talk #dialogbody>form{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:10px;font-size:16px;line-height:1.5}
#dialog.mw-dlg-talk #dialogbody>form label{flex:1 1 100%;display:flex;flex-wrap:wrap;align-items:center;gap:8px}
#dialog.mw-dlg-talk #dialogbody>form input:not([type=checkbox]):not([type=radio]){min-height:48px!important;min-width:96px;box-sizing:border-box;padding:0 12px;border:1px solid #8d7248;border-radius:6px;background:#000;color:#fff;font-size:18px!important}
#dialog.mw-dlg-talk #dialogbody>form input:is([type=checkbox],[type=radio]){width:24px;height:24px}
#dialog.mw-dlg-talk #dialogbody>form button{flex:1;min-height:52px!important;margin:0!important;font-size:16px!important;border-radius:6px;box-shadow:none;background:#302820;border:1px solid #8d7248;color:#eee8dc}
#dialog.mw-dlg-talk #dialogbody>form button[type=submit]{background:#6b5226;border-color:#d0a95c;color:#fff4d6}

/* Trade: 我方 / 對方 columns of tiles, detail line, 加入物品 list, action bar. */
.mw-dlg-trade{display:flex;flex-direction:column;gap:8px;color:#eee8dc;font:15px/1.4 "Microsoft JhengHei","PingFang TC",sans-serif}
.mw-dlg-trade [hidden]{display:none!important}
.mw-dlg-trade-columns{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.mw-dlg-trade-side{min-width:0;padding:6px 8px 8px;border:1px solid #5d4a2f;border-radius:6px;background:rgba(0,0,0,.28)}
.mw-dlg-trade-side[data-trade-side="1"]{border-color:#5a5446}
#dialog .mw-dlg-trade-head{margin:0 0 6px;font-size:15px;color:#ffd78a}
.mw-dlg-trade-grid{max-height:196px;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;touch-action:pan-y;grid-template-columns:repeat(auto-fill,minmax(64px,1fr))}
#dialog .mw-dlg-trade .mw-tile{min-height:86px!important;margin:0!important;padding:6px 2px;font-size:12px!important;background:#141210;border:1px solid #5d4a2f;color:#eee8dc;line-height:1.2}
#dialog .mw-dlg-trade .mw-tile.selected{border-color:#ffd78a;box-shadow:0 0 0 1px #ffd78a inset;background:#2c2416}
.mw-dlg-trade-empty{grid-column:1/-1;margin:10px 0;text-align:center}
.mw-dlg-trade-detail{margin:0;font-size:15px;overflow-wrap:anywhere}
.mw-dlg-trade-notices p{margin:0;font-size:14px;color:#c8b58c}
#dialog .mw-dlg-trade-offer{display:flex;align-items:center;gap:8px;min-height:60px;padding:6px 8px;margin:0;border:1px solid #5d4a2f;border-radius:6px;background:#141210}
.mw-dlg-trade-offer-name{flex:1;min-width:0;font-size:16px;overflow-wrap:anywhere}
#dialog .mw-dlg-trade-offer input{flex:0 0 96px;width:96px;min-height:48px!important;box-sizing:border-box;padding:0 10px;border:1px solid #8d7248;border-radius:6px;background:#000;color:#fff;font-size:18px!important}
#dialog .mw-dlg-trade-offer .mw-button{flex:0 0 auto;min-height:48px!important;min-width:64px;margin:0!important;font-size:16px!important}
.mw-dlg-trade-actions .mw-dlg-trade-add{order:0}
.mw-dlg-trade-actions .mw-dlg-trade-cancel{order:1}
.mw-dlg-trade-actions .mw-dlg-trade-confirm{order:2}

/* Bookmarks and polymorph: big selectable rows. */
.mw-dlg-bookmark,.mw-dlg-poly{display:flex;flex-direction:column;gap:8px;color:#eee8dc;font:15px/1.4 "Microsoft JhengHei","PingFang TC",sans-serif}
#dialog :is(.mw-dlg-bookmark,.mw-dlg-poly) .mw-note{margin:0}
#dialog :is(.mw-dlg-bookmark,.mw-dlg-poly) .mw-row-main{min-height:56px!important;margin:0!important;padding:4px 14px;font-size:16px!important;line-height:1.3;background:#141210;border:1px solid #5d4a2f;color:#eee8dc;text-align:left}
#dialog :is(.mw-dlg-bookmark,.mw-dlg-poly) .mw-row.selected .mw-row-main{border-color:#ffd78a;box-shadow:0 0 0 1px #ffd78a inset;background:#2c2416}
#dialog :is(.mw-dlg-bookmark,.mw-dlg-poly) .mw-row-main:disabled .mw-row-detail{color:#d59a8c}
.mw-dlg-bookmark .mw-dlg-random .mw-row-name{color:#ffd78a}
.mw-dlg-poly-list{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.mw-dlg-poly-detail{margin:0}

/* Message box: centred over the dialog (or stage) that holds it. */
.mw-dlg-msg-shade{position:absolute;inset:0;z-index:90;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.5);touch-action:none}
.mw-window.mw-dlg-msg{position:relative;left:auto;top:auto;width:440px;max-width:calc(100% - 32px);height:auto;min-height:180px;max-height:calc(100% - 24px)}
.mw-dlg-msg .mw-body{touch-action:pan-y}
.mw-dlg-msg-text{margin:4px 2px;color:#fff}
.mw-dlg-msg .mw-footer .mw-button{flex:1;min-height:52px;margin:0;font-size:17px;box-shadow:none;border-radius:6px}
.mw-dlg-msg .mw-footer .mw-button:not(.primary){background:#302820;border:1px solid #8d7248;color:#eee8dc}
.mw-dlg-msg .mw-footer .mw-button.primary{background:#6b5226;border:1px solid #d0a95c;color:#fff4d6}
