/* Girlfriend / 我的女友 session layout. Loaded only on the workbench. */

.studio.studio-gf { align-items: stretch; }
.studio-gf .composer {
  align-content: start;
  min-height: 0;
}
.studio-gf .products,
.studio-gf .modes {
  align-self: start;
  align-items: center;
}
body.has-gf-chat #products { display: none; }
.studio-gf #panel-girlfriend { align-content: start; }
.studio-gf .stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 140px);
  padding: 0;
  overflow: hidden;
  align-content: stretch;
}

.chat-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: 100%;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.chat-head-art {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--field);
  flex: 0 0 auto;
}
.chat-head-meta { min-width: 0; flex: 1; }
.chat-head-name { font-weight: 700; font-size: 15px; }
.chat-head-int { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.chat-head-back,
.chat-head-new { display: inline-flex; flex: 0 0 auto; }

.gf-picker {
  display: grid;
  gap: 8px;
  min-height: 0;
}
.gf-picker-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.gf-picker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
.gf-pick {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  text-align: left;
}
.gf-pick:hover { background: var(--surface-2); }
.gf-pick img {
  grid-row: 1 / span 2;
  display: block;
  width: 48px;
  height: 64px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 8px;
  background: var(--field);
}
.gf-pick strong { font-size: 13px; }
.gf-pick span {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gf-picker-hint { display: none; }
@media (min-width: 960px) {
  .gf-picker-stage { display: none; }
  .gf-picker-hint { display: block; }
}
.chat-head-back { order: -1; }

.chat-thread {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 12px 12px 8px;
  scrollbar-gutter: stable;
}
.chat-media {
  margin-top: 8px;
}
.chat-media img,
.chat-media video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(168px, 56vw);
  max-height: min(240px, 42vh);
  border-radius: 10px;
  object-fit: contain;
}
.chat-msg.pending { opacity: 0.75; }
.chat-dock {
  position: relative;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.gf-fab-menu {
  position: absolute;
  left: 10px;
  bottom: calc(100% + 8px);
  display: grid;
  gap: 6px;
  min-width: 168px;
  padding: 8px;
  border-radius: var(--r);
  background: var(--surface-2);
  z-index: 3;
}
.gf-fab-menu[hidden] { display: none; }
.gf-act {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  font-weight: 650;
  touch-action: manipulation;
}
.gf-act .go-cost {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(11, 13, 18, 0.22);
}
.gf-fab {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--feature);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  touch-action: manipulation;
}
.gf-fab[aria-expanded="true"] { filter: brightness(1.12); }
.chat-msg {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.55;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--field);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--feature);
  color: var(--accent-ink);
  border-bottom-right-radius: 4px;
}
.chat-msg.streaming::after {
  content: "▍";
  margin-left: 1px;
  animation: chat-caret 1s step-end infinite;
}
@keyframes chat-caret {
  50% { opacity: 0; }
}
.chat-composer {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.chat-composer textarea {
  min-height: 48px;
  max-height: 132px;
  resize: none;
}
.chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--r);
  background: var(--feature);
  color: var(--accent-ink);
  font-weight: 650;
}
.chat-send:hover:not(:disabled) { filter: brightness(1.12); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-send.locked { background: var(--surface-2); color: var(--text); opacity: 1; cursor: pointer; }
.chat-send .go-cost {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(11, 13, 18, 0.22);
}
.chat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.chat-time { font-size: 11px; color: var(--faint); }
.chat-resend,
.chat-stop {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  padding: 0;
  cursor: pointer;
}
.chat-resend:hover,
.chat-stop:hover { color: var(--text); }
.chat-empty {
  color: var(--faint);
  font-size: 13px;
  padding: 24px 8px;
  text-align: center;
}

@media (max-width: 959px) {
  .studio.studio-gf {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - var(--topbar-h));
    max-height: calc(100dvh - var(--topbar-h));
    gap: 8px;
    padding: 8px 10px 0;
    align-items: stretch;
  }
  .studio-gf .composer {
    flex: 0 0 auto;
    gap: 8px;
  }
  .studio-gf .products,
  .studio-gf .modes {
    position: sticky;
    top: var(--topbar-h);
    z-index: 5;
    overflow-x: auto;
  }
  .studio-gf #panel-girlfriend { display: none !important; }
  .studio-gf .stage {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    padding: 0;
    overflow: hidden;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .chat-send { min-width: 72px; padding: 10px 12px; }
  .chat-dialog {
    flex: 1 1 auto;
    max-height: none;
    height: auto;
    min-height: 0;
  }
  .studio-gf ~ .foot,
  body:has(.studio-gf) .foot,
  body.has-girlfriend .foot { display: none !important; }
  body.has-girlfriend {
    overflow: hidden;
    height: 100dvh;
  }
  .chat-dock {
    flex: none;
    position: sticky;
    bottom: 0;
    z-index: 4;
  }
  .chat-head-art { width: 32px; height: 32px; }
  .chat-head-name { display: none; }
  .chat-composer textarea { font-size: 16px; }
}
