/* v0.32 — touch-first controls, keyboard-aware sheets, readable resources.
   Retains HospiQuest's existing palette and map-first content order. */
:root { --hq-vh:100dvh; --hq-vtop:0px; }
button,a,input,textarea,select { -webkit-tap-highlight-color:transparent; }
button,a { touch-action:manipulation; }
button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
  outline:2px solid var(--lime);outline-offset:3px;
}
.connection-recovery{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:14px 28px 0;padding:14px 18px;border:1px solid var(--gold);border-radius:10px;background:var(--panel,#142321);color:var(--text);}
.connection-recovery[hidden]{display:none}.connection-recovery p{flex:1 1 240px;margin:0;font-size:14px;line-height:1.6}.connection-recovery .button{min-height:44px;font-size:14px;}
.combat-tools{gap:12px;flex-wrap:wrap}.combat-tools .button{min-height:44px;font-size:14px;line-height:1.4}
.combat-tools .retreat-button{margin-left:auto;min-width:125px;border-color:var(--line)}
.resource-label{font-variant-numeric:tabular-nums;line-height:1.5}.resource-label span{min-width:0}.resource-label span:last-child{overflow-wrap:anywhere;text-align:right;}
.modal-backdrop{padding-top:max(12px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom));}
.modal-panel{max-height:calc(var(--hq-vh) - 28px);overflow:auto;overscroll-behavior:contain;}
#modal-close{min-width:44px;min-height:44px;display:grid;place-items:center;font-size:26px;z-index:2;}
.item-tooltip,.buff-detail-tooltip{max-width:min(400px,calc(100vw - 24px));overflow-wrap:anywhere;max-height:calc(var(--hq-vh) - 28px);overflow:auto;}
#chat-input,#dm-text,#guild-chat-text{scroll-margin-bottom:90px;}
#dm-compose,#chat-form,#guild-chat-form{scroll-margin-top:90px;scroll-margin-bottom:20px;}
.dm-contact{min-height:58px}.dm-contact strong{overflow-wrap:anywhere}
@media(max-width:960px){
 .topbar{padding-top:max(10px,env(safe-area-inset-top));padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right));}
 .footer{padding-bottom:max(20px,env(safe-area-inset-bottom));}
 .sidebar{padding-top:max(14px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));}
 .sidebar #nav .nav-item,.sidebar #nav .nav-group>summary,#game-menu-toggle{min-height:44px;font-size:14px;}
 #game-menu-toggle{min-width:72px;}
 .chat-form input,.chat-form button,#dm-compose input,#dm-compose textarea,#dm-compose button,
 #guild-chat-form textarea,#guild-chat-form button{font-size:16px;line-height:1.5;min-height:44px;}
 #dm-compose textarea,#guild-chat-form textarea{min-height:96px;resize:vertical;}
 .dm-bubble p,.chat-line,.guild-chat-message p{font-size:15px;line-height:1.6;}
 .dm-bubble>span,.dm-bubble time,.chat-line time,.guild-chat-message time{font-size:12px;}
 .dm-contact strong{font-size:14px}.dm-contact small{font-size:13px;}
 .form-actions{flex-wrap:wrap}.form-actions small{font-size:12px;line-height:1.5;}
 .mail-conversation label{font-size:14px;}
 .item-tooltip,.buff-detail-tooltip{font-size:14px;line-height:1.5;}
 .item-tooltip p,.item-tooltip small,.buff-detail-tooltip p,.buff-detail-tooltip small{font-size:13px;line-height:1.5;}
 .resource-label,.dossier-resource .resource-label,.dossier-resource .resource-label b{font-size:14px;}
 .dossier-stat-grid .record-stat>span{font-size:12px;}
 .dossier-slot strong{font-size:12px}.dossier-slot small,.slot-label{font-size:11px;}
 .dossier-slots{gap:10px;}.dossier-slot{padding:10px 6px;min-height:145px;}
 .dossier-bag-item strong{font-size:12px;}.dossier-bag-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
 .dossier-hero-foot{font-size:11px;line-height:1.5;}
 .dossier-presence,.dossier-presence>span:last-child,.dossier-meta,.dossier-title{font-size:12px;}
 .dossier-hero-actions .button{min-height:44px;font-size:13px;}
 .dossier-hero{min-height:280px;}.dossier-hero-copy{padding-bottom:24px;}
 .dossier-hero-foot .text-button{min-height:44px;font-size:13px;}
 .chat-form{display:flex;gap:10px;align-items:stretch;}.chat-form input{min-width:0;flex:1;}
 .chat-form button{min-width:70px;}
 .hq-keyboard-open .topbar{position:relative;}
 .hq-keyboard-open .mobile-status,.hq-keyboard-open .tracked-mobile{display:none;}
 .hq-keyboard-open .modal-backdrop{align-items:flex-start;padding-top:calc(var(--hq-vtop) + 12px);}
}
@media(max-width:640px){
 .skills{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
 .skill{min-height:116px;min-width:0;padding:14px;}.skill strong{font-size:16px;line-height:1.3;}.skill small{font-size:13px;line-height:1.5;}
 .skill .key{display:none;}.skill .cooldown-tag{font-size:12px;}
 .combat-tools{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:stretch;}
 .combat-tools .button{font-size:14px;min-height:48px;padding:12px 8px;min-width:0;}
 .combat-tools .retreat-button{margin-left:0;}
 .arena-labels{padding:14px;}.arena-labels .fighter-name{font-size:14px;}
 .arena-labels small,.arena-labels .hp-meta,.arena-labels .hp-caption{font-size:12px;}
 .combat-log .log-line{font-size:14px;line-height:1.6;}
 .result-banner{gap:12px;flex-wrap:wrap;}.result-banner .button{min-height:48px;font-size:15px;}
 .result-banner h3{font-size:23px;}.result-banner p{font-size:14px;line-height:1.6;}
 .mobile-bars{gap:12px;}.mobile-bars .resource-label{display:flex;flex-wrap:wrap;gap:3px;font-size:12px;line-height:1.5;}
 .mobile-bars .resource-label>span:last-child{display:block;width:100%;text-align:left;font-size:14px;}
 .mobile-identity{font-size:14px;flex-wrap:wrap;}.mobile-identity .text-button{min-height:44px;padding:8px;}
 .mobile-utility .text-button{min-height:44px;font-size:13px;}
 .connection-recovery{margin:12px 14px 0;padding:14px;}.connection-recovery p{font-size:14px;}
 #modal .button,#modal button[type=submit]{min-height:44px;font-size:14px;white-space:normal;}
 #modal input,#modal select,#modal textarea{font-size:16px;min-height:44px;}
 #modal-body>h2{padding-right:24px;font-size:26px;}
 .world-target .button,[data-move]{min-height:44px;min-width:44px;}
 .world-target p,.world-target small{font-size:12px;line-height:1.5;}
 .world-supply-tools .button,.field-supplies .button{min-height:44px;}
 .mail-layout{gap:16px;}.mail-conversation{padding:18px;}
 .dm-header h2{font-size:24px;overflow-wrap:anywhere;}.dm-header .button{min-height:44px;font-size:13px;}
 .dm-history{height:min(340px,calc(var(--hq-vh) * .43));min-height:100px;}
 .guild-chat-lines,.chat-messages{max-height:min(360px,calc(var(--hq-vh) * .48));min-height:110px;}
 .chat-panel{padding:16px;}.chat-title{flex-wrap:wrap;gap:8px;}.chat-title span{font-size:12px;}
 .hq-keyboard-open .mail-inbox{display:none;}
 .hq-keyboard-open .dm-history,.hq-keyboard-open .guild-chat-lines,.hq-keyboard-open .chat-messages{max-height:180px;height:180px;}
}
@media(prefers-reduced-motion:reduce){
 .float-number,.hit-flash,.bar i,.cosmetic-aura{animation:none!important;transition:none!important;}
 html{scroll-behavior:auto;}
}

.buff-detail-tooltip{pointer-events:auto;}
@media(max-width:640px){.selected-action .button{min-height:48px;font-size:14px;}.selected-action small{font-size:12px;}.selected-info p,.selected-info small{font-size:12px;}.selected-info .button{min-height:44px;font-size:13px;}}

@media(max-width:640px){
 .hq-combat-view #mobile-status{margin-top:10px;padding:8px 12px;}
 .hq-combat-view .mobile-utility,.hq-combat-view .mobile-identity>.text-button{display:none;}
 .hq-combat-view .mobile-identity{line-height:1.5;min-height:24px;}
 .hq-combat-view .content-grid{padding-top:14px;}
 .hq-combat-view .page-heading{margin-bottom:14px;}
 .hq-combat-view .page-heading h1{font-size:25px;line-height:1.25;}
 .hq-combat-view .battle-arena{height:clamp(185px,25svh,230px);}
 .hq-combat-view .hud-name{font-size:13px;line-height:1.3;}
 .hq-combat-view .hud-meta{font-size:11px;line-height:1.5;flex-wrap:wrap;gap:4px;}
 .hq-combat-view .battle-hud{inset:12px 12px auto;gap:18px;}
 .hq-combat-view .combatant-hud{width:46%;}
 .hq-combat-view .skill{min-height:108px;padding:12px;}
}
