/* Preserve the text size when an inline word becomes a tappable translation. */
html[data-design] :is(.thai,[lang="th"]) .thaiHintWord{font:inherit!important;line-height:inherit!important;letter-spacing:inherit!important;color:inherit!important}
/* The speaker stays beside the start of the line rather than far below it. */
html[data-design] #modal .conversationTurn{align-items:flex-start}
html[data-design] #modal .conversationTurn>.storyPerson{align-self:flex-start;margin-top:8px;width:52px;height:64px;flex-basis:52px}
/* The invitation is positioned next to its own character by walking-games.js. */
html[data-design] #modal .walkingNPC{width:56px;height:70px}
html[data-design] #modal .walkingNpcPortrait{width:100%;height:100%}
html[data-design] #modal .walkingNpcBubble{box-sizing:border-box;max-width:min(160px,calc(100% - 16px));width:max-content;line-height:1.45}
html[data-design] #modal .walkingNpcBubble:after{display:block;right:auto;left:var(--invitation-tail-x,50%);bottom:-7px;transform:translateX(-50%);border-radius:0}
/* Horizontal tab scrolling stays usable without a permanent scrollbar track. */
.literacyTabs{scrollbar-width:none}
.literacyTabs::-webkit-scrollbar{display:none}
@media(max-width:360px){
 html[data-design] body #main .pocketQuickSituations{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 html[data-design] body #main .pocketQuickSituations button{grid-template-columns:24px minmax(0,1fr);grid-template-rows:auto;justify-items:start;gap:10px;min-height:62px;padding:10px;font-size:13px;text-align:left}
 html[data-design] body #main .pocketQuickSituations button>span{align-self:center;overflow-wrap:normal;word-break:normal}
}

.thaiHintPopover{box-sizing:border-box;max-width:min(240px,calc(100% - 16px));grid-template-columns:minmax(0,1fr) auto;overflow-wrap:anywhere}

/* The first mission reserves separate space for its start badge and Chang's speech. */
html[data-design] .cleanJourney .continuousSection>.learningTrail:has(>.routeFirstStop.isCurrent){padding-top:72px}
html[data-design] .cleanJourney .trailStop.routeFirstStop.changAtCurrent{min-height:190px;--bend:-56px!important}
html[data-design] .cleanJourney .trailStop.routeFirstStop.changAtCurrent>.trailChang{top:56px!important}
html[data-design] .cleanJourney .trailStop.routeFirstStop.changAtCurrent>.trailTypeHint{transform:translateX(-56px)}

/* Pocket guide: stable controls above the search, results update in place. */
html[data-design] body #main:has(.pocketGuideHero){min-height:100dvh;overflow-anchor:none}
html[data-design] body #main .pocketControls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:20px 0 16px;padding:0;overflow:visible}
html[data-design] body #main .pocketControls>.chip{display:flex;align-items:center;justify-content:center;gap:8px;min-width:0;width:100%;min-height:46px;margin:0;padding:10px 12px;font:600 14px/1.4 Outfit,sans-serif;letter-spacing:0;border-radius:14px;box-sizing:border-box}
html[data-design] body #main .pocketControls>select[hidden]{display:none!important}
html[data-design] body #main .pocketControls>#choosePhraseTopic{grid-column:1/-1;justify-content:space-between;min-height:48px;text-align:left}
html[data-design] body #main .pocketControls svg{width:20px;height:20px;flex:none}
html[data-design] body #main .pocketQuickSituations{margin:14px 0 20px}
html[data-design] body #main .pocketQuickSituations button[aria-pressed=true]{border-color:var(--green);background:color-mix(in srgb,var(--green) 14%,var(--surface));box-shadow:inset 0 0 0 1px var(--green)}
html[data-design] #modal:has(.phraseTopicsSheet){width:min(440px,calc(100vw - 24px));height:min(680px,calc(var(--app-height,100dvh) - 32px));max-height:calc(var(--app-height,100dvh) - 32px);min-height:0;margin:auto;inset:0;border-radius:24px;overflow:hidden}
html[data-design] #modal:has(.phraseTopicsSheet) #modalBody{height:100%;min-height:0;padding:0;overflow:hidden}
html[data-design] #modal .phraseTopicsSheet{width:100%;height:100%;max-height:none;min-height:0;padding:20px;box-sizing:border-box;display:flex;flex-direction:column;gap:14px;overflow:hidden}
html[data-design] #modal .phraseTopicsSheet .sheetHeader{position:static;display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:center;gap:12px;margin:0;padding:0;border:0;flex:none}
html[data-design] #modal .phraseTopicsSheet .sheetHeader h2{font-size:22px;line-height:1.25;margin:0;overflow-wrap:normal}
html[data-design] #modal .phraseTopicsSheet .close{position:static;width:44px;height:44px;margin:0;padding:10px}
html[data-design] #modal .phraseTopicsSheet>.search{width:100%;min-height:48px;margin:0;flex:none}
html[data-design] #modal .phraseTopicOptions{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 2px 8px;scrollbar-width:thin}
html[data-design] #modal .phraseTopicOptions section+section{margin-top:22px}
html[data-design] #modal .phraseTopicOptions h3{font:700 12px/1.5 Outfit,sans-serif;color:var(--sub);margin:0 0 8px}
html[data-design] #modal .phraseTopicOptions button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:52px;margin:0 0 6px;padding:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface);font:500 15px/1.45 Outfit,sans-serif;color:var(--text);text-align:left}
html[data-design] #modal .phraseTopicOptions button>span{min-width:0;overflow-wrap:anywhere}
html[data-design] #modal .phraseTopicOptions button[aria-pressed=true]{border-color:var(--green);color:var(--green);background:color-mix(in srgb,var(--green) 12%,var(--surface))}
html[data-design] body #main .filters.pocketControls{grid-template-columns:repeat(2,minmax(0,1fr))!important}

/* A game's scene never grows or shrinks when dialogue or recognition appears. */
html[data-design] #modal :is(.walkingSheet,.miniGameSheet){--game-stage-height:calc((var(--app-height,100dvh) - var(--app-safe-top,0px) - var(--app-safe-bottom,0px))* .44)}
html[data-design] #modal .walkingSheet .walkingWorld,
html[data-design] #modal .walkingSheet .walkingWorld.isTalking{box-sizing:border-box;flex:0 0 var(--game-stage-height)!important;height:var(--game-stage-height)!important;min-height:var(--game-stage-height)!important;max-height:var(--game-stage-height)!important;transition:none!important}
html[data-design] #modal .walkingInteraction{display:flex;flex-direction:column;gap:12px;flex:1 1 0;min-height:0;overflow:auto;overscroll-behavior:contain;overflow-anchor:none;padding:4px 2px 12px;scroll-padding:12px}
html[data-design] #modal .walkingInteraction>*{flex-shrink:0}
html[data-design] #modal .walkingStartHint{padding:16px;margin:0;border:1px solid #ffffff25;border-radius:16px;font-size:14px;line-height:1.6;color:#d7e5d8}
html[data-design] #modal .walkingSheet:has(.walkingWorld.isTalking) .walkingStartHint{display:none}
html[data-design] #modal .walkingDialogue>span:not(.thai){display:block;color:var(--reading);font-size:15px;line-height:1.5}
html[data-design] #modal .walkingChoices button{grid-template-columns:minmax(0,1fr);gap:5px;padding:12px;min-height:88px;box-sizing:border-box}
html[data-design] #modal .walkingChoices .thai{text-align:left;line-height:1.5}
html[data-design] #modal .walkingChoices strong{line-height:1.4;font-size:16px;overflow-wrap:anywhere}
html[data-design] #modal .walkingInteraction #walkingNext{display:flex;align-items:center;justify-content:center;width:100%;min-height:48px;margin:0;padding:12px;border-radius:14px;font:700 15px/1.4 Outfit,sans-serif}
html[data-design] #modal .walkingInteraction #walkingNext[hidden]{display:none!important}
html[data-design] #modal .walkingSheet.isRepeating .walkingInteraction>:is(.walkingDialogue,.walkingChoices){display:none!important}
html[data-design] #modal .walkingInteraction .gameRepeatPanel{margin:0;max-height:none}
html[data-design] #modal .miniGameSheet .miniGameBody{overflow-y:auto!important;overscroll-behavior:contain;overflow-anchor:none}
html[data-design] #modal .miniGameSheet .miniGameBody>.miniScene,
html[data-design] #modal .miniGameSheet.isRepeating .miniGameBody>.miniScene{box-sizing:border-box;height:var(--game-stage-height)!important;min-height:var(--game-stage-height)!important;max-height:var(--game-stage-height)!important;flex:0 0 var(--game-stage-height)!important}
html[data-design] #modal .miniGameSheet .miniGameFoot{min-height:132px;box-sizing:border-box;max-height:43%;overflow-y:auto;overscroll-behavior:contain}
html[data-design] #modal .miniGameSheet .miniGameFoot #miniFeedback:not(:has(.gameRepeatPanel)){min-height:52px;box-sizing:border-box}
html[data-design] #modal .miniMemorySheet .miniMemoryGrid{height:var(--game-stage-height);min-height:var(--game-stage-height);max-height:var(--game-stage-height);grid-template-rows:repeat(3,minmax(0,1fr));grid-auto-rows:1fr;flex:none}
html[data-design] #modal .miniMemorySheet .miniMemoryCard{height:100%;min-height:0;overflow:auto;align-content:center}
html[data-design] #modal .miniGameSheet>.miniScene,
html[data-design] #modal .miniGameSheet.isRepeating>.miniScene{box-sizing:border-box;width:100%;height:var(--game-stage-height)!important;min-height:var(--game-stage-height)!important;max-height:var(--game-stage-height)!important;flex:0 0 var(--game-stage-height)!important;margin:0!important;transition:none!important}
html[data-design] #modal .miniGameSheet>.miniScene .miniMama{height:75%;width:190px;max-height:220px;left:calc(50% - 95px)}
html[data-design] #modal .miniGameSheet:has(>.miniScene)>.miniGameBody{flex:1 1 0;min-height:0}
html[data-design] #modal .miniGameSheet.isRepeating:has(>.miniScene)>.miniGameBody{display:none}
html[data-design] #modal .miniGameSheet.isRepeating>.miniGameFoot{flex:1 1 0;min-height:0;max-height:none}
html[data-design] #modal .walkingChoices .thai{display:block;font-size:20px}
html[data-design] #modal .walkingGameControls{flex:0 0 48px;height:48px;min-height:48px}
html[data-design] #modal .walkingGameControls #walkingNext{display:flex;align-items:center;justify-content:center;width:100%;height:48px;min-height:48px;margin:0;padding:12px;border-radius:14px;font:700 15px/1.4 Outfit,sans-serif}
html[data-design] #modal .walkingGameControls #walkingNext[hidden]{display:block!important;visibility:hidden;pointer-events:none}
html[data-design] #modal .miniGameSheet .miniGameFoot{display:flex;flex-direction:column;gap:8px}
html[data-design] #modal .miniGameSheet .miniGameFoot>#miniFeedback{flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:contain}
html[data-design] #modal .miniGameSheet .miniGameFoot>.primary{flex:none}
html[data-design] #modal .miniGameSheet.isRepeating #nextMiniRound[hidden]{display:none!important}
/* Artwork fills the fixed scene, independently of its original aspect ratio. */
html[data-design] #modal .miniGameSheet>.miniScene>svg{display:block;width:100%!important;height:100%!important;max-width:none;max-height:none}
html[data-design] #modal .miniGameSheet>.miniScene>.miniSceneBackdrop{position:absolute;inset:0;z-index:0}
html[data-design] #modal .miniGameSheet>.miniScene .miniCounter{z-index:3}
html[data-design] #modal .miniGameSheet>.miniScene :is(.miniMama,.nodeGameChang,.nodeGameSituation){z-index:2}
html[data-design] #modal .walkingSceneArt>svg{display:block;width:100%!important;height:100%!important;max-width:none;max-height:none}

/* Small lived-in scenes complement later destinations without stretching the route. */
html[data-design] .routeSurroundings>.environmentPocket{position:absolute;width:142px;height:118px;left:12px;top:19%;opacity:1;pointer-events:none}
html[data-design] .routeSurroundings>.environmentProp:nth-of-type(n+5){width:76px;height:122px}
