/* AC Main ad274aa reference viewport from docs/design/Phase-1-UI-Spec.md.
   Scene coordinates are fixed here. The Studio scales the scene as one unit. */
.scene {
  --scene-width: 390px;
  --scene-height: 844px;
  --safe-top: 0px;
  --safe-bottom: 0px;
  position: relative;
  isolation: isolate;
  width: var(--scene-width);
  height: var(--scene-height);
  overflow: hidden;
  transform-origin: top left;
  color: #f5efe5;
  font: 16px/1.5 "DM Sans", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}
.scene svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.stage { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #252744 url("./assets/ac-room.webp") center 45% / cover no-repeat; }
.stage::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(transparent 35%, #0003 60%, #000c); }
.stage-light {
  position: absolute;
  left: 50%;
  top: 1%;
  transform: translateX(-50%);
  width: min(calc(var(--scene-width) * .92), 1040px);
  height: min(calc(var(--scene-width) * .76), 780px);
  background: radial-gradient(ellipse, rgba(246,224,218,.27), rgba(205,173,178,.1) 45%, transparent 72%);
}
.character-wrap {
  position: absolute;
  top: var(--safe-top);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(var(--scene-width) * 1.6), calc(var(--scene-height) * .9), 850px);
  aspect-ratio: 1;
}
.character-wrap::before {
  content: "";
  position: absolute;
  inset: 8% 7% 0;
  background: radial-gradient(ellipse, rgba(238,213,201,.26), rgba(193,164,165,.1) 41%, transparent 74%);
}
.character-wrap video {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  filter: saturate(.92) contrast(1.025);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent), linear-gradient(to bottom, transparent, #000 1%, #000 98%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent), linear-gradient(to bottom, transparent, #000 1%, #000 98%, transparent);
  mask-composite: intersect;
}
.scene-navigation {
  position: absolute;
  z-index: 2;
  top: max(8px, var(--safe-top));
  inset-inline: 12px;
  display: flex;
  justify-content: space-between;
}
.scene-navigation span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(213,183,124,.4);
  border-radius: 50%;
  background: rgba(37,39,68,.78);
}
.chat {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  height: 60%;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(213,183,124,.56);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(37,39,68,.56), rgba(22,24,46,.74));
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 36px rgba(8,10,24,.42), inset 0 1px 0 rgba(246,227,180,.22);
}
.chat::before, .chat::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 14px;
  height: 14px;
  border: solid rgba(213,183,124,.5);
  pointer-events: none;
}
.chat::before { left: 6px; border-width: 1px 0 0 1px; border-top-left-radius: 7px; }
.chat::after { right: 6px; border-width: 1px 1px 0 0; border-top-right-radius: 7px; }
.conversation { flex: 1; min-height: 0; }
.chat-edge { display: grid; grid-template-columns: 46px minmax(0,1fr) 46px; align-items: center; padding: 6px 12px 2px; }
.grip {
  grid-column: 2;
  justify-self: center;
  width: 48px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg,#b38e50,#f6e3b4,#b38e50);
  box-shadow: 0 0 8px rgba(213,183,124,.45);
}
.mode-icon {
  grid-column: 3;
  display: grid;
  place-items: center;
  width: 46px;
  height: 44px;
  border: 1px solid rgba(213,183,124,.62);
  border-radius: 999px;
  background: rgba(25,28,52,.78);
  color: #d5b77c;
  box-shadow: inset 0 0 0 1px rgba(213,183,124,.16);
}
.chat-divider { display: flex; gap: 8px; align-items: center; height: 20px; padding: 0 22px 6px; color: #d5b77c; opacity: .72; }
.chat-divider::before, .chat-divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #d5b77c); opacity: .65; }
.chat-divider::after { transform: scaleX(-1); }
.chat-messages { padding: 10px 20px 22px; }
.message { display: flex; gap: 12px; align-items: flex-start; position: relative; }
.message + .message { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(213,183,124,.22); }
.message + .message::before { content: "✦"; position: absolute; top: -9px; left: 50%; color: #d5b77c; font-size: 11px; }
.message p { margin: 0; line-height: 1.68; text-shadow: 0 1px 2px rgba(10,12,26,.45); }
.message-meta { display: flex; gap: 10px; align-items: baseline; margin-bottom: 5px; font-family: Fraunces, "Yu Mincho", "Hiragino Mincho ProN", serif; color: #e6cc93; }
.message-meta em { color: #f5efe5; }
.message-meta time { font-family: "DM Sans", sans-serif; font-size: .74em; color: #ece5e2; padding-left: 10px; border-left: 1px solid rgba(213,183,124,.35); }
.avatar, .user-star { flex: 0 0 32px; display: grid; place-items: center; }
.avatar { height: 32px; border: 1.5px solid #d5b77c; border-radius: 50%; font-family: Georgia, serif; color: #d5b77c; }
.user-star { color: #b9b2d9; }
.composer { padding: 12px 20px max(12px, var(--safe-bottom)); }
.composer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 60px;
  padding: 7px 7px 7px 17px;
  border: 1px solid rgba(213,183,124,.58);
  border-radius: 16px;
  background: rgba(25,28,52,.88);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(10,12,28,.35), inset 0 1px 0 rgba(245,239,229,.12);
  color: color-mix(in srgb, #f5efe5 65%, #b9b2d9);
  font-style: italic;
}
.send-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(213,183,124,.25);
  border-radius: 12px;
  background: rgba(213,183,124,.35);
  color: rgba(37,39,68,.7);
}
.safe-guides { position: absolute; inset: var(--safe-top) 0 var(--safe-bottom); z-index: 3; border: 2px dashed #f6e3b4; pointer-events: none; }
