/* FE/v2/styles.css */

:root {
  --v2-bg-deep: #161126;
  --v2-bg-mid: #26183b;
  --v2-gold: #d6b47a;
  --v2-gold-soft: rgba(214, 180, 122, 0.35);
  --v2-text-main: #f7f0ff;
  --v2-text-soft: rgba(247, 240, 255, 0.82);
  --v2-panel: rgba(33, 22, 50, 0.62);
  --v2-panel-strong: rgba(28, 18, 44, 0.82);
  --v2-white-card: rgba(255, 250, 255, 0.92);
  --v2-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--v2-bg-deep);
  color: var(--v2-text-main);
  font-family:
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI",
    "Yu Gothic",
    sans-serif;
}

#app {
  min-height: 100vh;
}

.v2-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.v2-debug-box {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 40;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(10, 10, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  backdrop-filter: blur(8px);

  pointer-events: none;
}

/* Home */

.v2-home-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at top, rgba(214, 180, 122, 0.16), transparent 34%),
    linear-gradient(180deg, #1a1230 0%, #221538 42%, #1a132d 100%);
}

.v2-home-background {
  position: absolute;
  inset: 0;
  background-image: url("../v2/assets/Hermes-Home-BG-001.webp");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  opacity: 0.95;
  z-index: 1;
}

.v2-home-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(18, 12, 28, 0.22) 0%, rgba(18, 12, 28, 0.10) 28%, rgba(18, 12, 28, 0.38) 100%);
  z-index: 2;
}

.v2-home-header {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 18px;
  gap: 4px;
}

.v2-home-brand {
  font-size: 34px;
  line-height: 1;
  color: #f3ddb0;
  font-family: "Times New Roman", serif;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.v2-home-subtitle {
  font-size: 15px;
  color: rgba(246, 230, 198, 0.9);
  letter-spacing: 0.08em;
}

.v2-home-stage {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px 18px 0;
  min-height: 0;
}

.v2-home-character-wrap {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: none;
}

.v2-home-character-button {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
}

.v2-home-character {
  display: block;
  width: min(88vw, 360px);
  max-height: 80vh;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.32));
}

.v2-home-bubble-wrap {
  position: absolute;
  left: 40%;
  top: 50%;
  transform: translateX(-128px);
  z-index: 8;
  width: min(56vw, 250px);
}

.v2-home-bubble {
  background: var(--v2-white-card);
  color: #1e1530;
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: var(--v2-shadow);
  border: 1px solid rgba(132, 108, 168, 0.18);
}

.v2-home-bubble-text {
  font-size: 16px;
  line-height: 1.55;
  white-space: normal;
}

.v2-home-bubble-link {
  margin-top: 10px;
  appearance: none;
  border: none;
  background: transparent;
  color: #6749a0;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}

.v2-home-bottom-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10;

  padding: 14px 14px 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 248, 255, 0.16), rgba(255, 248, 255, 0.08));
  border: 1px solid rgba(255, 235, 205, 0.14);
  backdrop-filter: blur(14px);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.v2-home-nameplate {
  text-align: center;
  font-size: 18px;
  color: rgba(248, 232, 200, 0.95);
  margin-bottom: 14px;
  letter-spacing: 0.08em;
}

.v2-primary-button {
  appearance: none;
  border: 1px solid rgba(241, 220, 181, 0.32);
  background:
    linear-gradient(180deg, rgba(93, 55, 143, 0.92), rgba(64, 35, 102, 0.94));
  color: #fff7ea;
  border-radius: 999px;
  min-height: 46px;
  padding: 0 20px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(50, 26, 81, 0.35);
}

.v2-home-chat-button {
  width: 100%;
}

.v2-home-mini-talk {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.v2-home-mini-talk-input {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 205, 0.18);
  background: rgba(19, 13, 31, 0.42);
  color: var(--v2-text-main);
  min-height: 42px;
  padding: 0 16px;
  outline: none;
}

.v2-home-mini-talk-input::placeholder {
  color: rgba(247, 240, 255, 0.5);
}

.v2-home-mini-talk-button {
  appearance: none;
  border: 1px solid rgba(241, 220, 181, 0.20);
  background: rgba(76, 46, 118, 0.9);
  color: #fff7ea;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
}

/* Chat refined layout stable */

.v2-chat-screen,
.v2-history-screen {
  background:
    radial-gradient(circle at top, rgba(214, 180, 122, 0.08), transparent 28%),
    linear-gradient(180deg, #191224 0%, #140f1d 100%);
  color: var(--v2-text-main);
}

.v2-chat-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.v2-chat-header,
.v2-history-header {
  flex: 0 0 auto;
  z-index: 12;

  display: grid;
  grid-template-columns:
    minmax(100px, 200px)
    minmax(0, 1fr)
    minmax(100px, 200px);
  align-items: center;
  column-gap: 10px;

  padding: 14px 16px;
  background: rgba(22, 16, 33, 0.90);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-chat-header > :first-child,
.v2-history-header > :first-child {
  justify-self: start;
}

.v2-chat-header > :last-child,
.v2-history-header > :last-child {
  justify-self: end;
}

.v2-chat-header button,
.v2-history-header button,
.v2-history-header-spacer {
  min-width: 100px;
  max-width: 200px;
  height: 36px;
  box-sizing: border-box;
}

.v2-chat-header button,
.v2-history-header button {
  appearance: none;
  border: 1px solid rgba(241, 220, 181, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(247, 240, 255, 0.88);
  border-radius: 999px;
  padding: 0 14px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-chat-header-title,
.v2-history-header-title {
  min-width: 0;
  text-align: center;
  justify-self: center;
}

.v2-chat-title,
.v2-history-title {
  font-size: 20px;
  color: #f3ddb0;
  font-family: "Times New Roman", serif;
  letter-spacing: 0.04em;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-chat-subtitle,
.v2-history-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(247, 240, 255, 0.58);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-history-header-spacer {
  display: block;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 640px) {
  .v2-chat-header,
  .v2-history-header {
    grid-template-columns:
      minmax(84px, 104px)
      minmax(0, 1fr)
      minmax(84px, 104px);
    column-gap: 8px;
    padding: 12px 12px;
  }

  .v2-chat-header button,
  .v2-history-header button,
  .v2-history-header-spacer {
    min-width: 84px;
    max-width: 104px;
    height: 34px;
  }

  .v2-chat-title,
  .v2-history-title {
    font-size: 18px;
  }

  .v2-chat-subtitle,
  .v2-history-subtitle {
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .v2-chat-header,
  .v2-history-header {
    grid-template-columns:
      minmax(76px, 92px)
      minmax(0, 1fr)
      minmax(76px, 92px);
    column-gap: 6px;
    padding: 10px 10px;
  }

  .v2-chat-header button,
  .v2-history-header button,
  .v2-history-header-spacer {
    min-width: 76px;
    max-width: 92px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
  }

  .v2-chat-title,
  .v2-history-title {
    font-size: 17px;
  }

  .v2-chat-subtitle,
  .v2-history-subtitle {
    font-size: 10px;
  }
}


.v2-chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.v2-chat-log,
.v2-history-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 224, 190, 0.58) rgba(255, 255, 255, 0.06);
}

.v2-chat-log::-webkit-scrollbar,
.v2-history-list::-webkit-scrollbar {
  width: 10px;
}

.v2-chat-log::-webkit-scrollbar-track,
.v2-history-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.v2-chat-log::-webkit-scrollbar-thumb,
.v2-history-list::-webkit-scrollbar-thumb {
  background: rgba(245, 224, 190, 0.58);
  border-radius: 999px;
  border: 2px solid rgba(20, 15, 29, 0.18);
}

.v2-chat-log::-webkit-scrollbar-thumb:hover,
.v2-history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 224, 190, 0.72);
}

.v2-message {
  display: flex;
  flex-direction: column;
  max-width: min(88%, 680px);
}

.v2-message.is-lilith {
  align-self: flex-start;
}

.v2-message.is-user {
  align-self: flex-end;
}

.v2-message-role {
  margin-bottom: 6px;
  padding-left: 4px;
  font-size: 12px;
  color: rgba(245, 224, 190, 0.78);
  letter-spacing: 0.04em;
}

.v2-message-body {
  border-radius: 20px;
  padding: 14px 16px;
  line-height: 1.72;
  font-size: 15px;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
}

.v2-message.is-lilith .v2-message-body {
  background: rgba(255, 250, 255, 0.94);
  color: #1f1830;
  border: 1px solid rgba(255, 255, 255, 0.52);
}

.v2-message.is-user .v2-message-body {
  background: linear-gradient(180deg, rgba(86, 55, 128, 0.96), rgba(65, 40, 102, 0.96));
  color: #fffaff;
  border: 1px solid rgba(224, 206, 255, 0.10);
}

.v2-message-meta {
  margin-top: 6px;
  padding: 0 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.48);
}

.v2-network-label {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(214, 180, 122, 0.14);
  border: 1px solid rgba(214, 180, 122, 0.22);
  color: rgba(245, 224, 190, 0.92);
  font-size: 10px;
  vertical-align: middle;
}

.v2-waiting-indicator {
  align-self: flex-start;
  margin-top: 2px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 250, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 13px;
  color: rgba(245, 224, 190, 0.88);
}

.v2-chat-composer {
  flex: 0 0 auto;
  padding: 12px 14px 16px;
  background:
    linear-gradient(180deg, rgba(21, 15, 31, 0.78), rgba(21, 15, 31, 0.96));
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-chat-composer form {
  max-width: 860px;
  margin: 0 auto;
}

.v2-chat-composer textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 13px 15px;
  resize: none;
  min-height: 84px;
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.12);
}

.v2-chat-composer textarea::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.v2-chat-composer textarea:disabled {
  opacity: 0.72;
}

.v2-chat-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.v2-network-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: rgba(247, 240, 255, 0.72);
}

.v2-network-toggle input {
  accent-color: #8a64d6;
}

.v2-chat-composer button[type="submit"] {
  appearance: none;
  border: 1px solid rgba(241, 220, 181, 0.18);
  background: linear-gradient(180deg, rgba(104, 63, 158, 0.96), rgba(67, 39, 106, 0.96));
  color: #fff7ea;
  border-radius: 999px;
  min-height: 40px;
  padding: 0 18px;
  box-shadow: 0 8px 18px rgba(42, 22, 71, 0.28);
}

.v2-chat-composer button[type="submit"]:disabled {
  opacity: 0.6;
}

/* History small polish */

.v2-history-list {
  padding: 16px 14px 24px;
}

.v2-history-item {
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.v2-history-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.56);
  margin-bottom: 6px;
}

.v2-history-summary {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(247, 240, 255, 0.88);
}

.v2-empty {
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
}
