/* The same battle and action buttons remain available to keyboard users. */
.touch-only { display: none; }
#world, .skill-button, #cycle-target { touch-action: none; }
html { overscroll-behavior: none; }
.touch-mode { --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --edge-left: max(12px, env(safe-area-inset-left, 0px)); --edge-right: max(12px, env(safe-area-inset-right, 0px)); --action-width: clamp(136px, 42vw, 184px); }
.touch-mode body { height: 100dvh; -webkit-user-select: none; user-select: none; }
.touch-mode .touch-only { display: block; }
.touch-mode span.touch-only { display: inline; }
.touch-mode .start-meta > .touch-only { display: block; }
.touch-mode .desktop-only, .touch-mode .movement-keys, .touch-mode .auto-attack, .touch-mode .bottom-hints, .touch-mode .skill-button kbd { display: none; }
.touch-mode .topbar { height: calc(54px + var(--safe-top)); padding: var(--safe-top) var(--edge-right) 0 var(--edge-left); gap: 8px; }
.touch-mode .brand { gap: 7px; }
.touch-mode .brand > span { font-size: 20px; letter-spacing: 3px; }
.touch-mode .brand svg { width: 22px; height: 28px; }
.touch-mode .brand small, .touch-mode .location, .touch-mode .progress-strip { display: none; }
.touch-mode .top-actions { gap: 3px; }
.touch-mode .top-actions > #elapsed { font-size: 12px; margin-right: 3px; letter-spacing: 1px; }
.touch-mode .icon-button { width: 44px; height: 44px; }
.touch-mode .party-panel { top: calc(60px + var(--safe-top)); left: var(--edge-left); right: var(--edge-right); width: auto; padding: 5px 7px 7px; pointer-events: none; }
.touch-mode .party-panel .panel-heading { margin-bottom: 5px; }
.touch-mode .panel-heading h2 { font-size: 8px; letter-spacing: 1px; }
.touch-mode .panel-heading > span { font-size: 10px; }
.touch-mode #party-list { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.touch-mode .party-member, .touch-mode .party-member.self { display: block; margin: 0; border: 0; padding: 2px; min-width: 0; }
.touch-mode .member-info { margin-bottom: 4px; justify-content: center; }
.touch-mode .member-name { font-size: 8px; letter-spacing: 0; white-space: nowrap; }
.touch-mode .member-health { height: 4px; }
.touch-mode .member-job, .touch-mode .role-icon, .touch-mode .member-aggro, .touch-mode .formation-note { display: none; }
.touch-mode .party-member.is-targeted { background: #ad46453d; box-shadow: 0 0 0 1px var(--red); }
.touch-mode .right-panels { top: calc(119px + var(--safe-top)); left: var(--edge-left); right: var(--edge-right); width: auto; display: flex; gap: 6px; pointer-events: none; }
.touch-mode .objective-panel, .touch-mode .enmity-panel { padding: 7px; margin: 0; width: 50%; }
.touch-mode .objective-panel .eyebrow, .touch-mode #objective-detail, .touch-mode .enmity-legend, .touch-mode #battle-log { display: none; }
.touch-mode .objective-panel h2 { font-size: 10px; letter-spacing: 0; margin-bottom: 5px; }
.touch-mode .objective-footer { padding: 0; margin: 0; border: 0; font-size: 8px; gap: 5px; }
.touch-mode .enmity-panel .panel-heading { margin-bottom: 5px; }
.touch-mode .enmity-panel .panel-heading h2 { font-size: 0; }
.touch-mode .enmity-panel .panel-heading h2::after { content: '自分に向く敵意'; font-size: 8px; }
.touch-mode .enemy-row { margin: 0; }
.touch-mode .enemy-row:nth-child(n+2), .touch-mode .enemy-overflow, .touch-mode .enemy-bar { display: none; }
.touch-mode .enemy-info { flex-wrap: nowrap; font-size: 8px; gap: 3px; margin: 0; }
.touch-mode .enemy-info > span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.touch-mode .enemy-info .enemy-target { font-size: 8px; flex-shrink: 0; }
.touch-mode .empty-list { font-size: 8px; padding: 0; }
.touch-mode .boss-hud { top: calc(184px + var(--safe-top)); width: min(420px, calc(100% - 24px)); padding: 0 8px; pointer-events: none; }
.touch-mode .boss-label { font-size: 6px; margin-bottom: 3px; }
.touch-mode .boss-hud h2 { font-size: 12px; letter-spacing: 1px; margin-bottom: 5px; }
.touch-mode .boss-cast { margin-top: 7px; }
.touch-mode .cast-label, .touch-mode .cast-label span:last-child { font-size: 10px; }
.touch-mode .cast-label { flex-wrap: wrap; gap: 3px 8px; }
.touch-mode .cast-label span:last-child { margin-left: auto; }
.touch-mode .cast-track { height: 9px; }
.touch-mode .cast-track > em { height: 11px; }
.touch-mode .combat-hud { inset: 0; width: auto; transform: none; pointer-events: none; }
.touch-mode .hotbar { position: absolute; bottom: calc(12px + var(--safe-bottom)); right: var(--edge-right); width: var(--action-width); padding: 0; border: 0; background: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; pointer-events: auto; }
.touch-mode .skill-button { width: 100%; height: 76px; border-radius: 13px; padding: 0 2px; background-color: #10222bdc; -webkit-touch-callout: none; }
.touch-mode .skill-button svg { width: 29px; height: 29px; margin: 5px 0 3px; }
.touch-mode .skill-button strong { font-size: 10px; line-height: 1.35; white-space: normal; }
.touch-mode .skill-button small { font-size: 7px; margin-top: 3px; }
.touch-mode .skill-button.guard { grid-column: 2; grid-row: 2; border: 2px solid #cdb279; }
.touch-mode .skill-button.emote { grid-column: 1; grid-row: 2; }
.touch-mode .cooldown-number { top: 8px; font-size: 25px; }
.touch-mode .skill-button:active { filter: brightness(1.3); }
.touch-mode .player-resource { position: absolute; bottom: calc(221px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); width: min(340px, calc(100% - 32px)); margin: 0; gap: 7px; }
.touch-mode .player-resource-label strong small, .touch-mode .tank-mark { display: none; }
.touch-mode .player-resource-label { font-size: 10px; }
.touch-mode .player-resource-label > span { font-size: 11px; }
.touch-mode .target-info { position: absolute; bottom: calc(252px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); width: calc(100% - 32px); margin: 0; font-size: 10px; gap: 8px; }
.touch-mode .target-info small { font-size: 8px; }
.touch-mode .target-mini-hp { width: 55px; flex-shrink: 0; }
.touch-mode .touch-movement { position: absolute; left: var(--edge-left); bottom: calc(12px + var(--safe-bottom)); width: 124px; text-align: center; }
#move-stick { width: 124px; height: 124px; border: 1px solid #9abcb94f; border-radius: 50%; background: radial-gradient(circle, #7bbbb417, #102630a3); box-shadow: inset 0 0 25px #07141c88; position: relative; display: grid; place-items: center; touch-action: none; -webkit-touch-callout: none; }
#move-thumb { width: 48px; height: 48px; border: 1px solid #c6ddd588; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #72a7a6d9, #274b59e8); box-shadow: 0 4px 18px #0005; pointer-events: none; }
#move-stick.active { border-color: #b5dcd5aa; }
.stick-cross { position: absolute; inset: 16px; border: 1px solid #96b4b322; border-radius: 50%; pointer-events: none; }
.stick-cross::before, .stick-cross::after { content: ''; position: absolute; background: #96b4b333; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.stick-cross::before { width: 1px; height: 100%; }
.stick-cross::after { width: 100%; height: 1px; }
.stick-label { display: block; font-size: 10px; color: #b3c7c0; margin-top: 6px; pointer-events: none; }
.touch-mode #cycle-target { position: absolute; left: var(--edge-left); bottom: calc(164px + var(--safe-bottom)); width: 124px; height: 44px; border: 1px solid #afbdad55; border-radius: 22px; background: #112531df; color: #d4d9c6; font-size: 18px; touch-action: none; }
#cycle-target span { font-size: 11px; margin-left: 5px; }
.touch-mode .direction-hint { bottom: calc(287px + var(--safe-bottom)); font-size: 10px; pointer-events: none; white-space: nowrap; }
.touch-mode .announcement, .touch-mode .announcement.encounter { top: 39%; bottom: auto; transform: translate(-50%, -50%); width: 94%; padding: 12px 6px; }
.touch-mode .announcement > strong { font-size: 18px; letter-spacing: 2px; }
.touch-mode .announcement > span { margin-bottom: 6px; font-size: 7px; }
.touch-mode .announcement > p { font-size: 9px; line-height: 1.7; margin-top: 8px; }
.touch-mode .combat-toast { top: 47%; width: 94%; font-size: 18px; letter-spacing: 1px; }
.touch-mode .combat-toast.warning { font-size: 12px; }
.touch-mode .overlay { padding: max(12px, var(--safe-top)) var(--edge-right) max(12px, var(--safe-bottom)) var(--edge-left); overflow: auto; overscroll-behavior: contain; align-items: safe center; }
.touch-mode .start-card { width: 100%; max-width: 600px; min-width: 0; transform: none; padding: 20px 0; margin: auto; flex-shrink: 0; }
.touch-mode .start-card::before { inset: 0; }
.touch-mode .title-rule { font-size: 6px; letter-spacing: 1px; gap: 8px; }
.touch-mode .title-rule > span { width: 16px; }
.touch-mode .title-emblem { margin: 24px auto 18px; width: 42px; }
.touch-mode .title-emblem svg { width: 42px; height: 50px; }
.touch-mode .start-card h2 { font-size: clamp(40px, 12vw, 64px); letter-spacing: 4px; }
.touch-mode .start-subtitle { font-size: 15px; letter-spacing: 1px; }
.touch-mode .start-description { font-size: 10px; letter-spacing: 0; margin-top: 16px; }
.touch-mode .start-features { gap: 12px; font-size: 9px; letter-spacing: 0; margin: 20px 0; }
.touch-mode .start-features b { margin-right: 3px; }
.touch-mode .primary-button { min-width: 0; width: min(300px, 100%); min-height: 50px; }
.touch-mode .text-button { min-height: 44px; margin: 6px auto; padding: 8px 18px; }
.touch-mode .start-meta { margin-top: 8px; font-size: 10px; line-height: 1.9; letter-spacing: 0; color: #a2b8b5; }
.touch-mode .modal { width: min(650px, 100%); padding: 24px 18px; max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom)); flex-shrink: 0; }
.touch-mode .modal h2 { font-size: 23px; }
.touch-mode .help-grid { grid-template-columns: 1fr; gap: 20px; }
.touch-mode .help-grid p, .touch-mode .help-tip { font-size: 11px; }
.touch-mode .help-extra { font-size: 10px; line-height: 1.9; }
.touch-mode .small-modal { width: min(390px, 100%); }
@media (min-width: 600px) {
  .touch-mode .party-panel { width: 170px; right: auto; }
  .touch-mode #party-list { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 6px; }
  .touch-mode .right-panels { left: auto; top: calc(60px + var(--safe-top)); width: 176px; display: block; }
  .touch-mode .objective-panel, .touch-mode .enmity-panel { width: 100%; }
  .touch-mode .objective-panel { margin-bottom: 6px; }
  .touch-mode .boss-hud { top: calc(63px + var(--safe-top)); width: min(460px, calc(100% - 400px)); }
  .touch-mode .player-resource { bottom: calc(14px + var(--safe-bottom)); width: min(360px, calc(100% - 410px)); }
  .touch-mode .target-info { bottom: calc(49px + var(--safe-bottom)); width: min(360px, calc(100% - 410px)); flex-wrap: wrap; gap: 5px; }
  .touch-mode .direction-hint { bottom: calc(88px + var(--safe-bottom)); }
  .touch-mode .announcement, .touch-mode .announcement.encounter { top: 38%; width: min(440px, calc(100% - 370px)); }
}
@media (max-height: 500px) {
  .touch-mode .topbar { height: calc(48px + var(--safe-top)); }
  .touch-mode .party-panel, .touch-mode .right-panels { top: calc(54px + var(--safe-top)); }
  .touch-mode .boss-hud { top: calc(54px + var(--safe-top)); }
  .touch-mode .skill-button { height: 66px; }
  .touch-mode .skill-button svg { width: 23px; height: 23px; margin-top: 4px; }
  .touch-mode .skill-button small { font-size: 6px; }
  .touch-mode #move-stick, .touch-mode .touch-movement { width: 108px; }
  .touch-mode #move-stick { height: 108px; }
  .touch-mode #cycle-target { bottom: calc(144px + var(--safe-bottom)); width: 108px; }
  .touch-mode .stick-label { margin-top: 3px; }
  .touch-mode .start-card { padding: 6px 0; }
  .touch-mode .title-emblem, .touch-mode .start-features, .touch-mode .start-description { display: none; }
  .touch-mode .start-card h2 { font-size: 42px; line-height: 1.3; margin-top: 8px; }
  .touch-mode .start-subtitle { margin: 4px 0 14px; }
  .touch-mode .start-meta { font-size: 9px; margin-top: 0; }
  .touch-mode .announcement > p { display: none; }
}
@media (max-width: 599px) and (max-height: 650px) {
  .touch-mode .player-resource, .touch-mode .target-info { left: auto; right: var(--edge-right); transform: none; width: var(--action-width); }
  .touch-mode .player-resource { bottom: calc(180px + var(--safe-bottom)); }
  .touch-mode .target-info { bottom: calc(218px + var(--safe-bottom)); flex-wrap: wrap; gap: 4px; }
  .touch-mode .target-info small, .touch-mode .target-mini-hp { display: none; }
  .touch-mode .direction-hint { bottom: calc(242px + var(--safe-bottom)); }
}
