/* MC174 / 29.16. Refinements to the existing unified reader dock.
   No replacement of the original action or translation handlers. */
body.mc170-reading #mc170-reader-tools:has(#mc168-settings:not([hidden]), #mc167-actions:not([hidden])) {
  width:min(360px, calc(100vw - 18px))!important;
  max-width:calc(100vw - 18px)!important;
  border-radius:20px!important;
}
#mc170-reader-tools, #mc170-reader-tools #mc168-settings,
#mc170-reader-tools #mc167-actions { isolation:isolate; }
#mc170-reader-tools::before,#mc170-reader-tools::after,
#mc170-reader-tools #mc168-settings::before,#mc170-reader-tools #mc168-settings::after,
#mc170-reader-tools #mc167-actions::before,#mc170-reader-tools #mc167-actions::after {
  pointer-events:none!important;
}
#mc170-reader-tools :is(button,[role=button]) { position:relative;pointer-events:auto!important;touch-action:manipulation!important;-webkit-user-select:none;user-select:none; }
#mc170-reader-tools button:focus-visible { outline:2px solid var(--c138-accent,currentColor)!important;outline-offset:-2px!important; }
#mc170-reader-tools button:active { background:color-mix(in srgb,currentColor 11%,transparent)!important; }
/* Settings: tight rows; retain a minimum 44x44px touch area for every option. */
body.mc170-reading #mc170-reader-tools #mc168-settings {
  padding:5px 10px 7px!important;
  max-height:min(43dvh,calc(100dvh - var(--mc169-bottom,84px) - 64px))!important;
  -webkit-overflow-scrolling:touch;
}
#mc168-settings .mc168-line,#mc168-settings .mc170-choice {
  min-height:46px!important;gap:8px!important;padding:0!important;
  justify-content:space-between!important;
}
#mc168-settings .mc168-line>b,#mc168-settings .mc170-choice>b { min-width:71px;max-width:100px;flex:0 0 auto;font-size:14px!important; }
#mc168-settings .mc170-options,#mc168-settings .mc168-step {
  display:flex!important;gap:4px!important;justify-content:flex-end!important;
  flex:0 0 auto!important;width:auto!important;margin-left:auto!important;
}
#mc168-settings button[data-family],#mc168-settings button[data-paper] {
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;
  max-width:44px!important;flex:0 0 44px!important;
  margin:0!important;padding:0!important;
  font-size:17px!important;line-height:1!important;
}
#mc168-settings button[data-family] {font-weight:600!important}
#mc168-settings button[data-family=book] {font-weight:500!important}
#mc168-settings button[data-family=expressive] {font-style:italic!important}
#mc168-settings button[data-paper]::before {width:26px!important;height:26px!important;border-radius:8px!important;pointer-events:none!important}
#mc168-settings .mc168-step button {width:44px!important;min-width:44px!important;min-height:44px!important;flex:0 0 44px!important;}
#mc168-settings .mc168-step output{min-width:26px!important;text-align:center!important}
/* Translation list: aligned rows, including the unusual Greek study entry. */
#mc168-settings .mc169-editions{padding:2px 0!important;}
#mc168-settings .mc169-editions button{
  display:flex!important;align-items:center!important;
  width:100%!important;min-height:47px!important;
  margin:0!important;padding:9px 34px 9px 12px!important;
  border-radius:9px!important;font-size:14px!important;
  line-height:1.35!important;overflow-wrap:break-word!important;
  white-space:normal!important;text-align:left!important;
  touch-action:manipulation!important;
}
#mc168-settings .mc169-editions button[data-mc174-interlinear]{border-top:1px solid var(--c138-line,#8884)!important;margin-top:3px!important;}
#mc168-settings .mc169-editions button[aria-pressed=true]::after{right:12px!important;top:50%!important;transform:translateY(-50%)!important;pointer-events:none!important}
/* Existing actions now expand the same dock rather than becoming a separate sheet. */
body.mc170-reading #mc170-reader-tools #mc167-actions{
  padding:5px 10px 8px!important;
  max-height:min(43dvh,calc(100dvh - var(--mc169-bottom,84px) - 64px))!important;
  -webkit-overflow-scrolling:touch;
}
#mc170-reader-tools #mc167-actions header{min-height:42px!important}
#mc170-reader-tools #mc167-actions header strong {padding-right:6px;}
#mc170-reader-tools #mc167-actions .mc167-list{
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:3px!important;padding:4px 0!important;
}
#mc170-reader-tools #mc167-actions .mc167-list:not(.is-sharing) button{
  min-height:52px!important;height:auto!important;padding:4px 2px!important;
  gap:3px!important;border-radius:10px!important;
  color:inherit!important;line-height:1.15!important;
}
#mc170-reader-tools #mc167-actions .mc167-list button span{max-width:100%!important;line-height:1.15!important;}
#mc170-reader-tools #mc167-actions .mc167-list svg{width:19px!important;height:19px!important;pointer-events:none!important}
#mc170-reader-tools #mc167-actions .mc167-list.is-sharing{
  grid-template-columns:1fr!important;
}
#mc170-reader-tools #mc167-actions .mc167-list.is-sharing button{
  min-height:44px!important;flex-direction:row!important;justify-content:flex-start!important;
  padding-inline:12px!important;
}
#mc170-reader-tools #mc167-actions .mc170-status:not(:empty){
  display:block!important;min-height:30px!important;margin:2px 0 3px!important;
  padding:6px 10px!important;border-radius:9px!important;text-align:center!important;
  background:color-mix(in srgb,var(--c138-accent,currentColor) 14%,transparent)!important;
  font-weight:600!important;font-size:13px!important;line-height:1.3!important;
}
#mc170-reader-tools #mc167-actions .mc167-colors {min-height:44px!important;border-top:1px solid var(--c138-line,#8884)!important}
#mc170-reader-tools #mc167-actions .mc167-colors>span{font-size:13px!important}
#mc170-reader-tools #mc167-actions .mc167-colors [data-swatch]{
  flex:1 1 39px!important;min-width:37px!important;width:auto!important;
  min-height:44px!important;height:44px!important;padding:0!important;
}
#mc170-reader-tools #mc167-actions [data-swatch]::before{width:21px!important;height:21px!important;pointer-events:none!important}
/* Greek interlinear is a separate modal; maintain the correct original/translation pairs. */
dialog.mc166-reader{width:min(100%,48rem)!important;max-height:100dvh!important;overflow-x:hidden!important;overscroll-behavior-y:contain!important;}
dialog.mc166-reader section p{display:flex!important;flex-wrap:wrap!important;align-items:flex-start!important;gap:9px 10px!important;}
dialog.mc166-reader section p>span{display:inline-flex!important;vertical-align:top!important;flex-direction:column!important;align-items:flex-start!important;min-width:0!important;max-width:100%!important;overflow-wrap:anywhere!important;}
dialog.mc166-reader section p>span>*{min-width:0;max-width:100%;}
dialog.mc166-reader section [lang=grc]{line-height:1.35!important;}
dialog.mc166-reader section small {line-height:1.35!important;}
@media (max-width:350px) {
 #mc168-settings .mc168-line>b,#mc168-settings .mc170-choice>b{min-width:56px!important;}
 #mc168-settings button[data-family],#mc168-settings button[data-paper]{min-width:44px!important;}
 #mc170-reader-tools #mc167-actions .mc167-colors>span{max-width:64px;}
}
