/* Shared refined composer and model picker. Native and standard web use the same rules;
   Android retains its original controls. Keep host navigation/window chrome in each shell. */
/* The Android bridge shares this document, but retains its native composer. */
#composer-meta { display: contents; }
#attach .attach-plus { display: none; }
:is(html.standard-web, html.native-refined) #composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-inline: 8px;
  margin-bottom: 2px;
}
:is(html.standard-web, html.native-refined) #composer-meta:not(:has(> :not([hidden]))) { display: none; }
:is(html.standard-web, html.native-refined) #with { flex: 1; min-width: 0; padding: 0; }
:is(html.standard-web, html.native-refined) #with .chip.add {
  min-height: 28px;
  padding-inline: 0 7px;
  border: 0;
  border-radius: 7px;
  background: none;
}
:is(html.standard-web, html.native-refined) #with .chip.add:hover { color: var(--ink); }
:is(html.standard-web, html.native-refined) #composer-context {
  display: flex;
  align-items: center;
  flex: none;
  gap: 5px;
  margin-left: auto;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
:is(html.standard-web, html.native-refined) #composer-context svg { width: 13px; height: 13px; transform: rotate(-90deg); }
:is(html.standard-web, html.native-refined) #composer-context circle { fill: none; stroke-width: 2.4; }
:is(html.standard-web, html.native-refined) #composer-context .track { stroke: var(--muted); opacity: .42; }
:is(html.standard-web, html.native-refined) #composer-context-fill {
  stroke: var(--acc-ink);
  stroke-linecap: round;
  stroke-dasharray: 0 100;
}
:is(html.standard-web, html.native-refined) #composer-context.high #composer-context-fill { stroke: var(--warn); }

:is(html.standard-web, html.native-refined) #box:not([data-voice]) {
  justify-content: flex-end;
  gap: 3px;
  padding: 4px 5px;
  border-color: var(--line);
  border-radius: 23px;
  background: var(--paper);
  box-shadow: 0 2px 9px rgb(0 0 0 / .045);
}
:is(html.standard-web, html.native-refined) #box:not([data-voice]):focus-within { border-color: var(--control-line); }
:is(html.standard-web, html.native-refined) #box:not([data-voice]).files { border-color: var(--acc); }
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #input {
  order: 11;
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 36px;
  padding: 7px 2px;
}
:is(html.standard-web, html.native-refined) #box:not([data-voice]).tall #input { order: 2; flex-basis: 100%; padding-inline: 8px; }
:is(html.standard-web, html.native-refined) #input::placeholder { color: var(--muted); }
:is(html.standard-web, html.native-refined) #box :is(#gauge, #wise) { display: none; }
:is(html.standard-web, html.native-refined) #box.model-includes-thinking #think { display: none; }
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #attach .attach-paperclip { display: none; }
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #attach .attach-plus { display: initial; }
:is(html.standard-web, html.native-refined) #box:not([data-voice]) :is(#attach, #mic, #send) {
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 50%;
}
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #attach { order: 10; }
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #mic { order: 24; }
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #send { order: 25; }
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #model {
  order: 21;
  flex: 0 0 auto;
  min-height: 36px;
  padding-inline: 7px;
  margin-left: auto;
  max-width: 100%;
  color: var(--body);
  font-size: 12px;
  font-weight: 550;
}
/* The preserved but nonvisible allowance gauge must not consume the model's auto margin. */
:is(html.standard-web, html.native-refined) #box:not([data-voice]) #gauge ~ #model { margin-left: auto; }
:is(html.standard-web, html.native-refined) #model:is(:hover, .open) { background: none; color: var(--ink); }
:is(html.standard-web, html.native-refined) #model[aria-expanded="true"] > svg { transform: rotate(180deg); }
:is(html.standard-web, html.native-refined) #model .mpre { display: none; }
:is(html.standard-web, html.native-refined) #menu.models {
  max-height: calc(var(--app-h, 100dvh) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
:is(html.standard-web, html.native-refined) #send {
  background: var(--raise);
  color: var(--muted);
  opacity: 1;
}
:is(html.standard-web, html.native-refined) #send.live { background: var(--ink); color: var(--paper); }
:is(html.standard-web, html.native-refined) #send.live:hover { background: var(--body); }
:is(html.standard-web, html.native-refined) #bar :focus-visible, :is(html.standard-web, html.native-refined) #web-appearance button:focus-visible {
  outline: 2px solid var(--acc-ink);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  :is(html.standard-web, html.native-refined) #box:not([data-voice]) :is(#attach, #mic, #send) { width: 44px; height: 44px; }
  :is(html.standard-web, html.native-refined) #box:not([data-voice]) :is(#input, #model) { min-height: 44px; }
  :is(html.standard-web, html.native-refined) #box:not([data-voice]) #input { padding-block: 10px; font-size: 16px; }
}
@media (max-width: 410px) {
  html.unlocked-web #box:not([data-voice]) #input { order: 2; flex-basis: 100%; padding-inline: 8px; }
}
@media (max-width: 360px) {
  :is(html.standard-web, html.native-refined) #box:not([data-voice]) #input { order: 2; flex-basis: 100%; padding-inline: 8px; }
}
@media (max-width: 270px) {
  :is(html.standard-web, html.native-refined) #box:not([data-voice]) :is(#attach, #mic, #send) { width: 36px; height: 36px; }
  :is(html.standard-web, html.native-refined) #box:not([data-voice]) #model { padding-inline: 3px; }
}

/* The list and model details are adjacent cards on roomy displays and a single scroll on phones. */
:is(html.standard-web, html.native-refined) #menu.compact-model.picker-web {
  width: 550px;
  min-width: 0;
  max-width: calc(100vw - 16px);
  max-height: var(--compact-model-max-height, calc(var(--app-h, 100dvh) - 16px));
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  animation: none;
  transition: none;
  overflow: visible;
}
.picker-web .compact-model-controls {
  display: grid;
  grid-template-columns: minmax(0, 254px) minmax(0, 288px);
  align-items: end;
  gap: 8px;
}
.picker-web.compact-model-side-left .compact-model-controls { grid-template-columns: minmax(0, 288px) minmax(0, 254px); }
.picker-web.compact-model-side-left .compact-model-list-panel { grid-column: 2; grid-row: 1; }
.picker-web.compact-model-side-left .compact-model-card { grid-column: 1; grid-row: 1; }
.picker-web :is(.compact-model-list-panel, .compact-model-card) {
  min-width: 0;
  max-height: var(--compact-model-max-height, calc(var(--app-h, 100dvh) - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
:is(html.standard-web, html.native-refined) #menu.compact-model.picker-web.compact-model-inline {
  width: 352px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: auto;
  overscroll-behavior: contain;
}
.picker-web.compact-model-inline .compact-model-controls,
.picker-web.compact-model-config-only .compact-model-controls { display: block; }
.picker-web.compact-model-inline :is(.compact-model-list-panel, .compact-model-card) {
  max-height: none;
  overflow: visible;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.picker-web.compact-model-inline .compact-model-card { border-top: 1px solid var(--line); }
:is(html.standard-web, html.native-refined) #menu.compact-model.picker-web.compact-model-config-only { width: 254px; }
.picker-web .compact-model-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 4px 6px 3px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.picker-web .compact-model-close {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  text-align: center;
}
.picker-web .compact-model-list { display: grid; gap: 2px; padding: 5px; }
.picker-web .compact-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
}
.picker-web .compact-model-row-copy { display: grid; min-width: 0; gap: 2px; }
.picker-web .compact-model-name { font-size: 13px; font-weight: 650; }
.picker-web .compact-model-summary { color: var(--muted); font-size: 12px; line-height: 1.35; }
.picker-web :is(.compact-model-close, .compact-model-row):hover { background: var(--raise); }
.picker-web .compact-model-row[aria-checked="true"] { background: var(--acc-soft); }
.picker-web .compact-model-row[aria-checked="true"]::before {
  content: "✓";
  order: 1;
  flex: none;
  color: var(--acc-ink);
}
.picker-web :is(.compact-model-card-title, .compact-model-description, .compact-model-metrics) { margin: 0; }
.picker-web .compact-model-card-title {
  padding: 12px 13px 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: normal;
  text-transform: none;
}
.picker-web .compact-model-description { padding: 5px 13px 11px; color: var(--body); font-size: 12px; line-height: 1.4; }
.picker-web .compact-model-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
  padding: 0 13px 12px;
}
.picker-web :is(.compact-model-metric-label, .compact-thinking-heading) {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .035em;
}
.picker-web .compact-model-metric-label { font-size: 9px; letter-spacing: 0; }
.picker-web .compact-model-unrated { display:block; min-height:5px; color:var(--muted); font-size:11px; line-height:1; }
.picker-web .compact-model-metric dd { margin: 3px 0 0; }
.picker-web .compact-model-bar { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.picker-web .compact-model-bar > span { height: 5px; border-radius: 2px; background: var(--line); }
.picker-web .compact-model-bar > .filled { background: var(--acc-ink); }
.picker-web .compact-model-metric-note { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.picker-web .compact-thinking-heading { padding: 9px 13px 0; border-top: 1px solid var(--line); }
.picker-web .compact-thinking-label { margin: 0; padding: 3px 13px 0; color: var(--muted); font-size: 12px; }
.picker-web .compact-thinking {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px 13px 10px;
}
.picker-web .compact-thinking-choice {
  position: relative;
  z-index: 0;
  min-width: 0;
  min-height: 28px;
  border-radius: 6px;
  color: var(--body);
  font-size: 11px;
  white-space: nowrap;
  text-align: center;
}
.picker-web .compact-thinking-choice::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 3px 0;
  border-radius: 6px;
  background: var(--raise);
}
.picker-web .compact-thinking-choice[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.picker-web .compact-thinking-choice[aria-checked="true"]::before { background: var(--acc-soft); }
.picker-web .compact-thinking-choice:hover { color: var(--ink); }
.picker-web .compact-model-controls button:focus-visible { outline: 2px solid var(--acc-ink); outline-offset: -1px; }
@media (max-width: 720px) {
  .picker-web .compact-model-close { width: 44px; height: 44px; }
  .picker-web .compact-thinking-choice { min-height: 44px; }
  .picker-web .compact-thinking-choice::before { inset-block: 11px; }
}
@media (forced-colors: active) {
  .picker-web .compact-model-bar > span { background: GrayText; forced-color-adjust: none; }
  .picker-web .compact-model-bar > .filled { background: Highlight; }
  .picker-web .compact-thinking-choice[aria-checked="true"] { border: 1px solid Highlight; }
}
