.cmprow{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:8px 0}.cmprow .msg{max-width:100%;margin:0}.mtag{font:600 12px ui-monospace,Consolas,monospace;color:var(--muted);margin-bottom:6px}@media(max-width:900px){.cmprow{grid-template-columns:1fr}}
  .modes{flex-wrap:wrap}.opt-in{width:100%}.msg{padding:10px 14px;border-radius:12px;margin:8px 0;max-width:90%;line-height:1.55;overflow-wrap:anywhere}.msg.user{background:var(--raise);margin-left:auto}.msg.assistant{border:1px solid var(--raise)}.msg pre{overflow:auto;padding:10px;border-radius:8px;background:var(--raise)}#chatLog{max-height:68vh;overflow:auto}#imgOut{max-width:100%;max-height:70vh;border-radius:12px;display:block;margin:auto}.attach{border:1px dashed var(--muted);border-radius:12px;padding:10px}

  /* ---------- Giãn bố cục ---------- */
  html { overflow: hidden; height: 100%; }
  .shell { grid-template-columns: 460px minmax(0, 1fr); }
  .shell > * { min-width: 0; }
  .top { padding: 18px 40px; }
  .side { padding: 44px 40px 48px; }
  .side h1 { margin: 0 0 10px; line-height: 1.2; }
  .lead { margin: 0 0 32px; line-height: 1.65; }
  .form { gap: 32px; }
  label { margin-bottom: 12px; }
  textarea, input[type=text], input[type=password], input[type=number], select { padding: 16px 18px; border-radius: 14px; width: 100%; font: inherit; }
  input[type=number] { background: var(--field); color: var(--ink); border: 1px solid var(--line); }
  textarea { min-height: 220px; }
  .row { gap: 20px; }
  .chips { gap: 12px; margin-top: 18px; }
  .chip { padding: 8px 16px; }
  .hint { margin-top: 12px; }
  .attach { padding: 22px; border-radius: 16px; display: flex; flex-direction: column; gap: 14px; }
  .attach label, .attach .hint, .attach .chips { margin: 0; }
  input[type=file] { color: var(--muted); font-size: 13px; width: 100%; }
  input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 14px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); color: var(--ink); cursor: pointer; }
  input[type=file]::file-selector-button:hover { border-color: var(--accent); }
  #chatOpts, #imageOpts, #vstyleBox { display: flex; flex-direction: column; gap: 14px; }
  #imageOpts.row { display: flex; }
  #chatOpts button { align-self: flex-start; padding: 10px 18px; }
  .big { padding: 18px 20px; }
  .work { padding: 44px 48px 64px; }
  .msg { padding: 16px 20px; margin: 16px 0; border-radius: 16px; }
  #chatLog { max-height: 72vh; padding-right: 6px; }
  .empty { padding: 72px 32px; }
  @media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .side { padding: 28px 20px 32px; } .work { padding: 24px 20px 48px; } .top { padding: 14px 16px; } }
  #videoOpts, #imageOpts { display: flex; flex-direction: column; gap: 28px; }
  #videoOpts > div, #imageOpts > div { width: 100%; }
  .durbox { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; }
  .durbox input, .durbox select, #aspect, #isize { height: 54px; }
  #imgGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 28px; margin-top: 24px; }
  .imgcard { margin: 0; } .imgcard img { width: 100%; height: auto; display: block; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
  .imgbar { display: flex; gap: 10px; margin-top: 12px; }
  .imgbar button { padding: 8px 16px; }
  .combo { position: relative; }
  #modelFilter { cursor: pointer; padding-right: 44px; text-overflow: ellipsis; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238b87b5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
  .combolist { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }
  .combolist.up { top: auto; bottom: calc(100% + 6px); }
  .cgroup { padding: 8px 10px 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
  .copt { padding: 9px 12px; border-radius: 9px; cursor: pointer; overflow-wrap: anywhere; }
  .copt:hover, .copt.act { background: var(--raise); }
  .copt.on { color: var(--accent); font-weight: 600; }
  #mic[aria-pressed="true"] { background: var(--tally); color: var(--on-tally); border-color: var(--tally); }
  .convlist{display:flex;flex-direction:column;gap:6px;max-height:210px;overflow:auto}
  .crow{display:flex;gap:6px}
  #histBox{display:flex;flex-direction:column;gap:10px}
  #filmPane > #histBox{margin-bottom:18px}
  #histBox .cbtn{flex:1;min-width:0;display:block;text-align:left;padding:8px 12px;background:var(--raise);color:var(--ink);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;align-self:stretch}
  #histBox .cbtn.on{background:var(--accent);color:var(--on-accent)}
  #histBox .cx{padding:8px 11px;background:transparent;border:1px solid var(--line);color:var(--muted);align-self:stretch}
  #histBox .chip{padding:6px 12px}
  #chatOpts .cbtn{flex:1;min-width:0;display:block;text-align:left;padding:8px 12px;background:var(--raise);color:var(--ink);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;align-self:stretch}
  #chatOpts .cbtn.on{background:var(--accent);color:var(--on-accent)}
  #chatOpts .cx{padding:8px 11px;background:transparent;border:1px solid var(--line);color:var(--muted);align-self:stretch}
  #chatOpts .chip{padding:6px 12px}
  #gate { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: var(--bg); }
  #gate form { width: min(380px, 90vw); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: 0 0 60px rgba(225, 29, 46, 0.15); display: flex; flex-direction: column; gap: 14px; }
  #gate h2 { margin: 0; } #gate p { margin: 0; color: var(--muted); font-size: 14px; }