
/* Proportional controls: explicit touch targets, compact secondary actions. */
:root body .translator-card{padding:10px!important;gap:8px!important;justify-content:flex-start}
:root body #voice-quick-start{padding:0!important}
:root body #voice-quick-title{margin:0 0 4px;font-size:14px!important;line-height:1.5}
:root body .voice-quick-choices{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
:root body .voice-quick-choices>button{height:44px!important;min-height:44px!important;padding:4px 2px!important;font-size:14px!important;line-height:1.4!important;white-space:nowrap;overflow-wrap:normal;border-radius:13px}
:root body .translator-card .language-bar{align-items:end!important;gap:6px!important;min-height:0!important;height:auto!important}
:root body .translator-card .language-select{min-width:0;gap:4px!important}
:root body .translator-card .language-select>span{font-size:14px!important;line-height:21px!important;margin:0!important}
:root body .translator-card .language-picker-button{height:44px!important;min-height:44px!important;padding:6px!important;border-radius:14px}
:root body .translator-card .language-picker-button>span{white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
:root body .translator-card .language-picker-button .country-flag{width:24px!important;height:24px!important;flex:0 0 24px}
:root body .translator-card #swap-languages{width:44px!important;height:44px!important;min-height:44px;min-width:44px;margin:0!important;align-self:end}
:root body .translator-card>.voice-panels{flex:0 0 auto!important;gap:8px!important}
:root body .translator-card .conversation-bottom{min-height:0!important}
:root body .translator-card #original-output{height:76px!important;min-height:76px!important;padding:22px 12px 8px!important;font-size:17px!important;line-height:1.6!important}
:root body .translator-card #original-output.transcript-compact{height:116px!important}
:root body .translator-card #face-panel.voice-result-card{flex:0 0 auto!important;padding:10px!important;gap:4px!important;border-radius:18px}
:root body #face-panel.voice-result-card .voice-result{gap:6px!important}
:root body #face-panel.voice-result-card .voice-result #target-output{font-size:18px!important;line-height:1.65!important;padding:4px 0!important}
:root body #face-panel.voice-result-card .playback-controls{padding-top:6px!important;gap:6px!important}
:root body .playback-controls .voice-main-actions{display:flex!important;justify-content:flex-start;align-items:center;gap:8px!important}
:root body .playback-controls .voice-main-actions>:is(#replay,#whatsapp-voice){flex:0 0 112px!important;width:112px!important;max-width:calc(50% - 4px);height:44px!important;min-height:44px!important;padding:6px 10px!important;margin:0!important;font-size:14px!important;line-height:1.5!important;border-radius:14px;gap:6px!important;white-space:nowrap!important}
:root body .playback-controls .voice-main-actions>:is(#replay,#whatsapp-voice)>span{white-space:nowrap!important}
:root body .playback-controls #whatsapp-voice{background:var(--tw-control-glass)!important;border:1px solid var(--tw-glass-line)!important;color:var(--ink)!important;box-shadow:none!important}
:root body .playback-controls #whatsapp-voice svg{width:20px!important;height:20px!important;flex-shrink:0}
:root body .translator-card[data-has-translation=false] .voice-main-actions:has(#replay:disabled):has(#whatsapp-voice:disabled){display:none!important}
:root body .playback-controls .voice-options{gap:6px!important;min-height:44px!important;flex-wrap:nowrap!important}
:root body .playback-controls .voice-options :is(#voice-open,.speed-control,#stop-playback){height:44px!important;min-height:44px!important;margin-block:0!important;padding-block:4px!important;border-radius:14px!important}
:root body .playback-controls #stop-playback{width:44px!important;min-width:44px!important;padding:0!important}
:root body .playback-controls .speed-control{gap:4px!important;padding-inline:6px!important}
:root body .translator-card .mic-controls{display:grid!important;grid-template-columns:repeat(2,minmax(0,152px))!important;justify-content:center!important;gap:8px!important;width:100%;margin:0!important}
:root body .translator-card .mic-controls .mic-button{height:48px!important;min-height:48px!important;padding:6px 10px!important;border-radius:15px!important;gap:6px!important;white-space:nowrap!important}
:root body .translator-card .mic-button :is(#mic-a-label,#mic-b-label){white-space:nowrap!important;overflow:hidden;text-overflow:ellipsis;min-width:0;font-size:14px!important}
:root body .translator-card .mic-icon{width:22px!important;height:22px!important;flex:0 0 22px!important}
:root body .translator-card .conversation-actions{display:flex!important;justify-content:center!important;align-items:center;gap:8px!important;margin:0!important;min-height:44px!important}
:root body .translator-card .conversation-actions :is(#conversation-send,#clear-conversation){flex:0 0 96px!important;width:96px!important;max-width:calc(50% - 4px);height:44px!important;min-height:44px!important;padding:6px 12px!important;line-height:1.5!important;border-radius:14px!important;white-space:nowrap!important;margin:0!important}
:root body .translator-card #recording-status{height:auto!important;min-height:0!important;font-size:14px!important;line-height:1.5!important;padding:0!important}
:root body .translator-card #recording-status.is-idle{position:absolute;width:1px;height:1px!important;clip-path:inset(50%);overflow:hidden}
/* Text, photo and document utilities should not expand to fill a card. */
:root body .writing-result-heading,:root body .documents-result-heading{display:flex!important;flex-wrap:wrap;align-items:center;gap:8px!important}
:root body :is(.writing-result-heading,.documents-result-heading)>h3{flex:1 0 100%;margin:0!important}
:root body :is(.writing-result-heading,.documents-result-heading)>button{flex:0 0 auto!important;width:auto!important;min-width:76px;min-height:44px!important;height:44px!important;padding:6px 12px!important;white-space:nowrap!important}
:root body .photo-actions{display:flex!important;flex-wrap:wrap;gap:8px!important;justify-content:flex-start}
:root body .photo-actions>button{flex:0 1 auto!important;width:auto!important;min-height:44px!important;padding:6px 12px!important}

/* Keep calculator interaction colors paired in both themes, including sticky iOS hover. */
:root body .keypad>button:not(.equals):is(:hover,:active,:focus-visible){background:var(--mint);color:var(--ink)}
:root body .keypad>button:is(.utility,.operator):not(.equals):is(:hover,:active,:focus-visible){color:var(--teal-dark)}
:root body .keypad>button.equals:is(:hover,:active,:focus-visible){background:var(--tiffany-gradient);color:var(--action-ink)}
:root body .keypad>button:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
:root body .keypad>button:active{box-shadow:inset 0 0 0 2px var(--focus)}


/* The scrollable main region can receive focus without drawing a frame around the app. */
#main-content {
  -webkit-tap-highlight-color: transparent;
}
#main-content:focus {
  outline: none;
}

/* Standalone icon controls keep their hit areas and lose the decorative tiles. */
:root body :is(
  button.icon-button,
  .header-actions > button,
  .bottom-nav > button,
  .tw-auth :is(.tw-tool, .tw-dialog-close, button[data-show-password]),
  button.attachment-remove,
  #swap-languages,
  #writing-swap,
  #offline-save-voice,
  #assistant-attach,
  #assistant-mic,
  #assistant-send
) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  -webkit-tap-highlight-color: transparent;
  color: var(--ink);
}

:root body :is(
  button.icon-button,
  .header-actions > button,
  .bottom-nav > button,
  .tw-auth :is(.tw-tool, .tw-dialog-close, button[data-show-password]),
  button.attachment-remove,
  #swap-languages,
  #writing-swap,
  #offline-save-voice,
  #assistant-attach,
  #assistant-mic,
  #assistant-send
):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  border-radius: 12px;
}

:root body .bottom-nav > button {
  color: var(--muted);
}
:root body .bottom-nav > button:is(.selected, [aria-current="page"]),
:root body .bottom-nav > button:is(.selected, [aria-current="page"]) > span,
:root body #assistant-send:not(:disabled) {
  color: var(--teal);
}
:root body #assistant-mic[aria-pressed="true"] {
  color: var(--danger);
}

/* Preserve the sliding selection feedback as a short underline. */
:root body .bottom-nav .nav-indicator {
  background: transparent;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.bottom-nav .nav-indicator::after {
  content: "";
  position: absolute;
  inset-inline: 34%;
  inset-block-end: 1px;
  height: 2px;
  border-radius: 2px;
  background: var(--teal);
}

/* iPhone: consistent icon alignment and a fully visible wrapping composer. */
:root body .header-actions :is(#account-button,#settings-button,#usage-button,#offline-open,#theme-toggle){display:grid!important;grid-template-rows:24px 18px;align-content:center;justify-items:center;row-gap:0}
:root body .header-actions > button > svg{grid-row:1;width:24px;height:24px}
:root body .header-actions > button > span{grid-row:2;line-height:18px!important}
:root body #assistant-input{height:var(--assistant-input-height,80px)!important;min-height:80px!important;max-height:160px!important;line-height:24px!important;padding:14px 12px!important;box-sizing:border-box;overflow-y:auto!important;resize:none}
:root body #assistant-form{align-items:center;grid-auto-rows:auto}
@media (hover:none) and (pointer:coarse){
 :root body .app-shell :is(.topbar,.bottom-nav,.translator-card,.voice-result,.calculator-card,#assistant,.mic-button,.listen-button,.clear-action,.speed-control,.icon-button,#voice-open){-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
}

:root body .topbar:has(#theme-toggle){padding-inline:0!important}
:root body .topbar #theme-toggle{position:static!important;inset:auto!important;transform:none!important}

/* Keyboard compact row must grow with its editor, never remain a 48px track. */
:root:is([data-viewport-keyboard=true],[data-keyboard=true]) body #assistant-form{grid-template-columns:48px 48px minmax(0,1fr) 48px!important;grid-template-rows:auto!important;gap:6px!important;min-height:0!important;align-items:center}
:root:is([data-viewport-keyboard=true],[data-keyboard=true]) body #assistant-input{grid-column:3!important;grid-row:1!important}
:root:is([data-viewport-keyboard=true],[data-keyboard=true]) body #assistant-form :is(#assistant-attach,#assistant-mic,#assistant-send){grid-row:1!important}
:root:is([data-viewport-keyboard=true],[data-keyboard=true]) body #assistant-attach{grid-column:1!important}
:root:is([data-viewport-keyboard=true],[data-keyboard=true]) body #assistant-mic{grid-column:2!important}
:root:is([data-viewport-keyboard=true],[data-keyboard=true]) body #assistant-send{grid-column:4!important}
:root:is([data-viewport-keyboard=true],[data-keyboard=true]) body .assistant-composer-hint{display:none!important}
@media(max-height:500px) and (min-width:600px){:root body #assistant-form{grid-template-rows:auto!important}}

/* Website conversation layout: preserve all controls, IDs and event bindings. */
:root body #voice-quick-start{display:none!important}
:root body #settings-button{order:4}
:root body #theme-toggle{order:1}
:root body .header-actions :is(#account-button,#settings-button,#usage-button,#offline-open,#theme-toggle){box-sizing:border-box;width:44px!important;height:48px!important;flex:0 0 44px}
:root body .translator-card .language-bar{order:0!important}
@media(max-width:700px){
 :root:not([data-voice-editing=true]) body[data-view=translator]:not(.welcome-open) .app-shell main{container-type:size;container-name:conversation-space}
 :root:not([data-voice-editing=true]) body[data-view=translator] #translator .translator-card{box-sizing:border-box;flex:0 0 auto!important;height:calc(100cqh - 6px)!important;min-height:0!important;max-height:none!important;padding:12px 10px 14px!important;gap:12px!important;overflow:hidden!important}
 :root:not([data-voice-editing=true]) body[data-view=translator] #translator .translator-card>.voice-panels{flex:1 1 0!important;min-height:0!important;gap:12px!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain;scroll-padding-block:10px;padding-bottom:2px;}
 :root:not([data-voice-editing=true]) body[data-view=translator] .translator-card .conversation-bottom{flex:0 0 auto!important}
 :root:not([data-voice-editing=true]) body[data-view=translator] .translator-card #original-output{height:112px!important;min-height:112px!important;padding:26px 12px 10px!important}
 :root:not([data-voice-editing=true]) body[data-view=translator] .translator-card #face-panel.voice-result-card{flex:1 0 auto!important;min-height:200px!important;padding:12px!important;align-content:stretch;grid-template-rows:auto 1fr}
 :root:not([data-voice-editing=true]) body[data-view=translator] #face-panel .voice-result{flex:1 0 auto!important;gap:10px!important}
 :root:not([data-voice-editing=true]) body[data-view=translator] #face-panel #target-output{min-height:62px!important}
 :root:not([data-voice-editing=true]) body[data-view=translator] .translator-card .mic-controls{flex:0 0 48px!important;gap:10px!important}
 :root:not([data-voice-editing=true]) body[data-view=translator] .translator-card .conversation-actions{flex:0 0 44px!important;gap:10px!important}
}

/* Website header: one icon row and one caption row, without icon tiles. */
:root body .header-actions :is(#account-button,#settings-button,#usage-button,#offline-open,#theme-toggle){
 display:grid!important;grid-template-columns:1fr;grid-template-rows:20px 18px;
 align-content:center;align-items:center;justify-items:center;gap:2px 0!important;
 width:44px!important;height:48px!important;padding:3px 0!important;
 border:0!important;background:none!important;box-shadow:none!important;
}
:root body .header-actions > button svg{
 display:block;width:20px!important;height:20px!important;min-width:20px;min-height:20px;
 margin:0!important;grid-column:1;grid-row:1;align-self:center;
}
:root body .header-actions :is(#account-button,#settings-button,#usage-button,#offline-open,#theme-toggle) > span,
:root body .header-actions #settings-button::after{
 grid-column:1;grid-row:2;align-self:center;margin:0!important;padding:0!important;
 font-family:inherit;font-size:12px!important;font-weight:600!important;line-height:18px!important;
 letter-spacing:0;white-space:nowrap!important;
}
:root body .header-actions #settings-button::after{content:"إعدادات";display:block}
:root body .header-actions #account-button > .account-header-label{display:block!important}
:root body .header-actions #account-button > [data-launch-icon="account"]{
 display:flex!important;grid-column:1;grid-row:1;align-items:center;justify-content:center;
 width:20px!important;height:20px!important;line-height:0!important;
}

/* Account offers: short, separate billing choices; honour existing hidden states. */
:root body #account-modal [hidden]{display:none!important}
:root body #account-modal :is(.plan-feedback,.plan-local-price,#account-load-status,#account-billing-status):empty{display:none!important}
:root body #account-modal .offer-segments{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;padding:4px;border:1px solid var(--tw-glass-line);border-radius:16px;background:var(--tw-control-glass);margin-block:10px}
:root body #account-modal .offer-segments>button{min-width:0;min-height:44px;padding:8px 6px;border:0;border-radius:12px;background:transparent;color:var(--ink);font:inherit;font-size:14px;font-weight:600;line-height:1.5;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px}
:root body #account-modal .offer-segments>button[aria-pressed=true]{background:var(--tiffany-gradient);color:var(--action-ink);box-shadow:0 2px 8px rgba(0,80,70,.08)}
:root body #account-modal .offer-segments>button:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
:root body #account-modal .offer-discount{font-size:11px;line-height:18px;border-radius:7px;padding:0 5px;background:var(--surface);color:var(--teal-dark)}
:root body #account-modal .offer-category-description{font-size:13px;line-height:1.6;color:var(--muted);margin:6px 0 12px}
:root body #account-modal #account-plans{grid-template-columns:minmax(0,1fr);gap:12px}
:root body #account-modal #account-offers{margin-bottom:12px;padding-bottom:12px}
:root body #account-modal #account-billing-status{margin-bottom:0}
:root body #account-modal #account-load-status:empty{margin:0;padding:0;min-height:0}
