/* Cloner AI — SuA Dark Theme (검은색 배경 + 프리미엄 글래스모피즘) */
@font-face {
  font-family: "EF Diary";
  src: url("./fonts/EF_Diary.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --ink: #f2f2f3;
  --ink-soft: #8d8d93;
  --ink-faint: #5d5d63;
  --paper: #0b0b0c;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.085);
  --accent: #ff6fa0;
  --accent-deep: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --sky: #91d4ec;
  --lilac: #b4a9e4;
  --code-bg: #131316;
  --code-head: #19191d;
  --danger: #ff6584;
  --side-w: 272px;
  --diary: "Pretendard Variable", Pretendard, "Malgun Gothic", sans-serif;
  --text:
    "Pretendard Variable", Pretendard, "Malgun Gothic", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  color: var(--ink);
  background: var(--bg);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── 배경 (사이트와 동일한 딥 다크 글로우) ── */
.ai-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg);
}
.ai-ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 8% 20%,
      rgba(255, 111, 160, 0.05) 0,
      transparent 42%
    ),
    radial-gradient(
      ellipse at 92% 14%,
      rgba(201, 182, 255, 0.05) 0,
      transparent 42%
    ),
    radial-gradient(
      ellipse at 70% 96%,
      rgba(183, 216, 255, 0.04) 0,
      transparent 44%
    ),
    var(--bg);
  opacity: 1;
}
.orb {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}
.orb-a {
  width: 680px;
  height: 340px;
  top: 22%;
  left: -260px;
  rotate: -28deg;
}
.orb-b {
  width: 720px;
  height: 400px;
  top: 48%;
  right: -300px;
  rotate: 24deg;
}
.spark {
  position: absolute;
  color: rgba(255, 255, 255, 0.35);
  text-shadow: none;
  font-size: 26px;
  opacity: 0.5;
}
.spark-a {
  top: 18%;
  right: 14%;
}
.spark-b {
  bottom: 24%;
  left: 9%;
  font-size: 20px;
}

/* ── 전체 틀 ── */
.ai-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100dvh;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--ink-soft);
  transition:
    background 0.15s,
    color 0.15s;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ── 사이드바 (대화 기록) ── */
.ai-side {
  flex: none;
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px 12px;
  background: rgba(18, 18, 22, 0.88);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}
.ai-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.ai-brand img {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  object-fit: contain;
  filter: brightness(0.95);
}
.ai-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-family: var(--text);
}
.ai-brand-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.ai-brand-sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}
.side-close {
  display: none;
}
.side-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: var(--text);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition:
    transform 0.15s,
    background 0.15s,
    border-color 0.15s;
}
.side-new:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}
.side-list {
  flex: 1;
  overflow-y: auto;
  margin: 4px -4px 0;
  padding: 0 4px;
}
.side-list::-webkit-scrollbar {
  width: 6px;
}
.side-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}
.side-group {
  margin: 12px 8px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.side-empty {
  margin: 18px 8px;
  font-size: 13px;
  color: var(--ink-faint);
  line-height: 1.6;
}
.chat-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 10px;
  transition: background 0.12s;
}
.chat-item:hover {
  background: rgba(255, 255, 255, 0.055);
}
.chat-item.is-active {
  background: rgba(255, 255, 255, 0.1);
}
.chat-open {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  text-align: left;
  font-size: 14px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item.is-active .chat-open {
  color: #fff;
  font-weight: 600;
}
.chat-tools {
  display: flex;
  gap: 0;
  padding-right: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.chat-item:hover .chat-tools,
.chat-item.is-active .chat-tools,
.chat-item:focus-within .chat-tools {
  opacity: 1;
}
.chat-tools button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--ink-faint);
}
.chat-tools button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.chat-tools svg {
  width: 15px;
  height: 15px;
}
.chat-rename {
  flex: 1;
  margin: 3px 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: #fff;
  background: #1c1c20;
  outline: 0;
}
.chat-confirm {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--danger);
}
.chat-confirm span {
  flex: 1;
}
.chat-confirm button {
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 12.5px;
}
.chat-confirm .yes {
  background: var(--danger);
  color: #fff;
}
.chat-confirm .no {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.side-user img,
.side-user .ph {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #26262b;
  flex: none;
}
.side-user .ph {
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #fff;
}
.side-user .who {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.side-user .who b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user .who small {
  font-size: 12px;
  color: var(--ink-faint);
}
.side-user .logout {
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 4px 8px;
  border-radius: 8px;
}
.side-user .logout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.side-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* ── 본문 ── */
.ai-app {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.ai-top {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100% - 32px, 860px);
  margin: 14px auto 0;
  padding: 8px 12px;
  background: rgba(24, 24, 28, 0.78);
  border: 1px solid var(--line);
  border-radius: 9999px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.side-open {
  display: none;
}
.ai-title {
  flex: 1;
  min-width: 0;
  font-family: var(--text);
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-modes {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.ai-mode {
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  transition:
    background 0.15s,
    color 0.15s;
}
.ai-mode:hover {
  color: #fff;
}
.ai-mode.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

.ai-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 28px;
  scroll-behavior: smooth;
}
.ai-scroll > * {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}
.ai-scroll::-webkit-scrollbar {
  width: 8px;
}
.ai-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

/* ── 첫 화면 ── */
.ai-welcome {
  text-align: center;
  padding: 7vh 0 20px;
}
.ai-welcome-logo {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.ai-welcome h2 {
  margin-top: 20px;
  font-weight: 600;
  font-size: clamp(26px, 5vw, 36px);
  color: #fff;
  letter-spacing: -0.02em;
}
.ai-welcome p {
  max-width: 460px;
  margin: 8px auto 30px;
  color: var(--ink-soft);
  font-size: 15px;
}
.ai-suggest {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 660px;
  margin: 0 auto;
}
.ai-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
  transition:
    transform 0.15s,
    background 0.15s,
    border-color 0.15s;
}
.ai-chip b {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}
.ai-chip span {
  color: var(--ink-soft);
  font-size: 13px;
}
.ai-chip:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
}

/* ── 메시지 ── */
.ai-messages {
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.msg-user {
  display: flex;
  justify-content: flex-end;
}
.msg-user .bubble {
  max-width: min(78%, 620px);
  padding: 12px 18px;
  border-radius: 20px 20px 6px 20px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.msg-bot {
  display: flex;
  gap: 14px;
}
.msg-bot .avatar {
  flex: none;
  width: 34px;
  height: 34px;
  margin-top: 2px;
  border-radius: 11px;
  object-fit: contain;
  background: #1c1c20;
  border: 1px solid var(--line);
}
.msg-bot .body {
  flex: 1;
  min-width: 0;
  color: var(--ink);
}
.mode-tag {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

/* Thinking */
.thinking {
  display: inline-block;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: transparent;
  background-image: linear-gradient(
    100deg,
    #5d5d63 0%,
    #5d5d63 28%,
    #b4b4ba 40%,
    #ffffff 50%,
    #b4b4ba 60%,
    #5d5d63 72%,
    #5d5d63 100%
  );
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  animation: thinking-wave 1.8s linear infinite;
}
@keyframes thinking-wave {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .thinking,
  .paint-wait::before {
    animation-duration: 4s;
  }
}

.content {
  overflow-wrap: anywhere;
  font-size: 16px;
  color: #e4e4e8;
}
.content > :first-child {
  margin-top: 0;
}
.content > :last-child {
  margin-bottom: 0;
}
.content p {
  margin: 0 0 0.8em;
}
.content h1,
.content h2,
.content h3 {
  margin: 1.1em 0 0.45em;
  line-height: 1.4;
  font-weight: 600;
  color: #fff;
}
.content h1 {
  font-size: 1.28em;
}
.content h2 {
  font-size: 1.16em;
}
.content h3 {
  font-size: 1.05em;
}
.content ul,
.content ol {
  margin: 0 0 0.8em;
  padding-left: 1.4em;
}
.content li {
  margin: 0.2em 0;
}
.content li::marker {
  color: var(--ink-soft);
}
.content a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.content strong {
  font-weight: 600;
  color: #fff;
}
.content hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 1.2em 0;
}
.content blockquote {
  margin: 0 0 0.8em;
  padding: 2px 14px;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  color: var(--ink-soft);
}
.content :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.content table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 0.8em;
  font-size: 0.95em;
}
.content th,
.content td {
  padding: 6px 12px;
  border: 1px solid var(--line);
}
.content th {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.content .cursor-dot::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-radius: 50%;
  background: #fff;
  vertical-align: middle;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.codeblock {
  margin: 0 0 0.9em;
  border-radius: 14px;
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.codehead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px 7px 16px;
  background: var(--code-head);
  font-family: var(--mono);
  font-size: 12px;
  color: #8d8d93;
  border-bottom: 1px solid var(--line);
}
.copy {
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--text);
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.copy:hover {
  background: rgba(255, 255, 255, 0.16);
}
.codeblock pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}
.codeblock code {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: #f2f2f3;
  background: transparent !important;
  padding: 0 !important;
}

/* ── 디자인(그림) ── */
.paint {
  width: min(100%, 460px);
}
.paint-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 22px;
  padding: 6px;
  background: #141416;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.paint-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 17px;
  background: #1c1c20;
  cursor: zoom-in;
  animation: paint-in 0.6s ease both;
}
@keyframes paint-in {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: scale(1.02);
  }
  to {
    opacity: 1;
    filter: none;
    transform: none;
  }
}
.paint-actions {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.18s,
    transform 0.18s;
}
.paint-frame:hover .paint-actions,
.paint-frame:focus-within .paint-actions {
  opacity: 1;
  transform: none;
}
.paint-actions a,
.paint-actions button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.85);
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.paint-actions a:hover,
.paint-actions button:hover {
  background: rgba(255, 255, 255, 0.16);
}
.paint-actions svg {
  width: 15px;
  height: 15px;
}
.paint-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.paint-meta summary {
  cursor: pointer;
  width: fit-content;
  color: var(--ink-faint);
  list-style: none;
}
.paint-meta summary::-webkit-details-marker {
  display: none;
}
.paint-meta summary::before {
  content: "＋ ";
}
.paint-meta[open] summary::before {
  content: "－ ";
}
.paint-meta p {
  margin-top: 4px;
  line-height: 1.6;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.paint-gone {
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: 17px;
  background: #18181b;
  color: var(--ink-faint);
  font-size: 14px;
}

/* 그리는 중 */
.paint-wait {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: 17px;
  overflow: hidden;
  background: #141416;
}
.paint-wait::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 0deg,
    rgba(255, 111, 160, 0.2),
    rgba(201, 182, 255, 0.2),
    rgba(183, 216, 255, 0.2),
    rgba(255, 111, 160, 0.2)
  );
  filter: blur(40px);
  opacity: 0.9;
  animation: swirl 6s linear infinite;
}
@keyframes swirl {
  to {
    transform: rotate(1turn);
  }
}
.paint-wait .moon {
  position: relative;
  font-size: 38px;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.6);
  animation: float 2.4s ease-in-out infinite;
}
@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}
.paint-wait .note {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.note {
  color: var(--ink-faint);
  font-size: 14px;
}
.error {
  color: var(--danger);
  font-size: 15px;
  white-space: pre-wrap;
}
.error-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 101, 132, 0.08);
  border: 1px solid rgba(255, 101, 132, 0.25);
  color: #ff9aa8;
}
.retry {
  flex: none;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

/* ── 모델 선택 (v1 / v2) ── */
.ai-models {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  flex: none;
}
.ai-model {
  padding: 4px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}
.ai-model:hover {
  color: #fff;
}
.ai-model.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}
.ai-model[data-model="v2"].is-active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.ai-model.not-ready::after {
  content: "준비 중";
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-faint);
}
.ai-model.not-ready.is-active::after {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.v2-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.v2-status .dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
}
.v2-status[data-state="ready"] .dot {
  background: #3aa57a;
  box-shadow: 0 0 0 3px rgba(58, 165, 122, 0.2);
}
.v2-status[data-state="loading"] .dot {
  background: #fff;
  animation: pulse 1s ease-in-out infinite;
}
.v2-status[data-state="missing"] .dot {
  background: #d08a2c;
}
.v2-status .thinking {
  font-size: 13px;
}

/* ── zip 프로젝트 ── */
.proj {
  margin: 4px 0 10px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}
.proj-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.proj-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.proj-icon svg {
  width: 22px;
  height: 22px;
}
.proj-info {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.proj-info b {
  display: block;
  font-family: var(--mono);
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-info small {
  font-size: 12.5px;
  color: var(--ink-faint);
}
.proj-dl,
.content .proj-dl {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 12px;
  background: #fff;
  color: #0b0b0c;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.content .proj-dl:hover {
  background: #e4e4e8;
  color: #0b0b0c;
}
.proj-dl svg {
  width: 16px;
  height: 16px;
}
.proj-status {
  font-size: 14px;
  color: var(--ink-soft);
}
.proj-files {
  list-style: none;
  margin: 0;
  padding: 6px 8px 8px;
}
.proj-files li {
  border-radius: 10px;
}
.proj-files li + li {
  margin-top: 2px;
}
.proj-files summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 13.5px;
  color: var(--ink);
}
.proj-files summary::-webkit-details-marker {
  display: none;
}
.proj-files summary::before {
  content: "›";
  color: var(--ink-faint);
  transition: transform 0.15s;
  display: inline-block;
  width: 8px;
}
.proj-files details[open] > summary::before {
  transform: rotate(90deg);
}
.proj-files summary:hover {
  background: rgba(255, 255, 255, 0.055);
}
.proj-files .path {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-files .size {
  flex: none;
  font-size: 12px;
  color: var(--ink-faint);
}
.proj-files details > div {
  padding: 4px 4px 8px;
}
.proj-files li.writing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 28px;
}
.proj-files li.writing .thinking {
  font-size: 13px;
}
.proj-outro {
  margin-top: 8px;
}

/* ── 남은 사용량 (%) ── */
.side-quota {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.side-quota:empty {
  display: none;
}
.q-top {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.q-top b {
  font-variant-numeric: tabular-nums;
  color: #fff;
  font-weight: 600;
}
.q-track {
  height: 5px;
  margin-top: 3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.q-track i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), #fff);
  transition: width 0.4s ease;
}
.q-row.hot .q-track i {
  background: linear-gradient(90deg, #e7b36a, #d08a2c);
}
.q-row.full .q-track i {
  background: var(--danger);
}
.q-row.full .q-top b {
  color: var(--danger);
}
.q-free {
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ── 입력창 ── */
.ai-bottom {
  width: min(100% - 32px, 860px);
  margin: 0 auto;
  padding: 6px 0 calc(12px + env(safe-area-inset-bottom));
}
.style-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.style-row::-webkit-scrollbar {
  display: none;
}
.style-label {
  flex: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-right: 2px;
}
.style-chip {
  flex: none;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition:
    background 0.15s,
    color 0.15s;
}
.style-chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}
.style-chip.is-active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  font-weight: 600;
}
.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  border-radius: 24px;
  background: rgba(24, 24, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 16px 45px rgba(0, 0, 0, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition:
    box-shadow 0.15s,
    border-color 0.15s;
}
.ai-composer:focus-within {
  box-shadow:
    0 16px 45px rgba(0, 0, 0, 0.6),
    0 0 0 2px rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.25);
}
.ai-composer textarea {
  flex: 1;
  max-height: 200px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font: inherit;
  line-height: 1.55;
  color: #fff;
}
.ai-composer textarea::placeholder {
  color: var(--ink-faint);
}
.ai-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: #0b0b0c;
  transition:
    background 0.15s,
    opacity 0.15s;
}
.ai-send:hover:not(:disabled) {
  background: #e4e4e8;
}
.ai-send:disabled {
  opacity: 0.25;
  cursor: default;
}
.ai-stop {
  background: var(--ink);
  color: #fff;
}
.ai-stop svg rect {
  fill: currentColor;
  stroke: none;
}
.ai-foot {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── 로그인 안내 ── */
.ai-gate {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 16px;
  background: var(--bg);
}
.gate-card {
  width: min(100%, 380px);
  text-align: center;
  padding: 40px 28px 30px;
  border-radius: 28px;
  background: rgba(20, 20, 24, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.gate-card img {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  filter: brightness(0.95);
}
.gate-card h1 {
  margin-top: 14px;
  font-weight: 600;
  font-size: 30px;
  color: #fff;
  letter-spacing: -0.02em;
}
.gate-card p {
  margin: 8px 0 24px;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.75;
}
.gate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 14px;
  background: #5865f2;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(88, 101, 242, 0.35);
}
.gate-btn:hover {
  background: #4752c4;
}
.gate-home {
  display: block;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-faint);
  text-decoration: none;
}
.gate-home:hover {
  color: #fff;
}

/* ── 이미지 크게 보기 ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}
.lightbox img {
  max-width: min(92vw, 1024px);
  max-height: 80vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  border: 1px solid var(--line);
}
.lightbox-bar {
  display: flex;
  gap: 8px;
}
.lb-btn {
  padding: 7px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.lb-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 860px) {
  .ai-side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(84vw, 300px);
    background: rgba(18, 18, 22, 0.96);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.7);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }
  .ai-shell.side-on .ai-side {
    transform: none;
  }
  .side-close,
  .side-open {
    display: grid;
  }
}
@media (max-width: 640px) {
  .ai-top {
    width: calc(100% - 24px);
    margin-top: 10px;
    padding: 6px 6px 6px 6px;
    gap: 6px;
    border-radius: 20px;
  }
  .ai-title {
    font-size: 15px;
  }
  .ai-mode {
    padding: 3px 9px;
    font-size: 13.5px;
  }
  .ai-scroll {
    padding: 10px 12px 24px;
  }
  .ai-bottom {
    width: calc(100% - 24px);
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .ai-welcome {
    padding-top: 4vh;
  }
  .ai-suggest {
    grid-template-columns: 1fr;
  }
  .msg-user .bubble {
    max-width: 88%;
  }
  .msg-bot .avatar {
    display: none;
  }
  .paint-actions {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 640px) {
  .ai-top {
    flex-wrap: wrap;
  }
  .ai-models {
    order: 3;
  }
  .ai-modes {
    order: 4;
    margin-left: auto;
  }
}
@media (max-width: 420px) {
  .ai-title {
    display: none;
  }
  .ai-models {
    order: 0;
  }
  .ai-model {
    padding: 3px 8px;
    font-size: 12px;
  }
}
