/* main.css - 沉沦 · 轻语  (dark glass phone theme, ref: shenlun_vision_chat)
   #app 即一只居中的玻璃手机框：桌面 390×844 圆角玻璃，窄屏满屏。
   #bar/#input 固定高度，#msgs 占满中间可滚动；键盘弹出时浏览器上推，输入框自然贴输入法。 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #050608;
  color: #eee;
}

/* 漂移的环境光晕 */
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: -30%;
  background:
    radial-gradient(circle, rgba(120, 50, 80, .35), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(190, 140, 80, .12), transparent 30%);
  animation: drift 12s infinite alternate;
  z-index: 0;
  pointer-events: none;
}
@keyframes drift { to { transform: translate(80px, -50px); } }

/* ---------- 玻璃手机框 ---------- */
#app {
  position: relative;
  z-index: 1;
  width: min(390px, 100vw);
  height: min(844px, 100vh);
  border-radius: 42px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, .04);
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 40px 100px #000;
}
/* 入场光带 */
#app::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .12), transparent);
  animation: shine 2.4s ease-in 1;
  pointer-events: none;
  z-index: 5;
}
@keyframes shine { to { left: 150%; } }

/* 全屏态：点「全屏」切到满屏，去掉框 */
body.boxed #app {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.page {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.page.active { display: flex; }

/* ---------- 登录页 ---------- */
#login {
  justify-content: center;
  padding: 45px;
  margin: 0 auto;
}
#login h1 {
  font-size: 46px;
  font-weight: 300;
  letter-spacing: 12px;
  color: #eee;
  text-align: center;
  margin: 0 0 70px;
  text-shadow: 0 2px 24px rgba(120, 50, 80, .45);
}
#login h1 small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 6px;
  color: #ad8995;
  margin-top: 12px;
}
#login input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 22px;
  font-size: 16px;
  color: #eee;
  background: rgba(255, 255, 255, .06);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#login input::placeholder { color: #777; }
#login input:focus {
  border-color: rgba(123, 67, 85, .85);
  background: rgba(255, 255, 255, .09);
}
#goBtn {
  width: 100%;
  height: 56px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #7b4355, #321c24);
  color: #f0e0e4;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 5px;
  cursor: pointer;
  user-select: none;
  transition: filter .15s;
}
#goBtn:active { filter: brightness(1.12); }

/* 全屏/卡片切换按钮 */
.fsToggle {
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 40px;
  background: rgba(255, 255, 255, .08);
  color: #ddd;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.fsToggle:active { background: rgba(255, 255, 255, .18); transform: scale(.96); }
#login .fsToggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 6;
}

/* ---------- 顶栏（固定高度）---------- */
#bar {
  height: 75px;
  padding: 0 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
#bar .title {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
  color: #eee;
}
#bar .title::before {
  content: "◌ ";
  color: #ad8995;
  font-weight: 400;
  letter-spacing: 0;
}
#bar button {
  background: none;
  border: none;
  color: #ad8995;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
}
#bar button:active { filter: brightness(1.2); }

/* ---------- 消息流（独立滚动，占满中间）---------- */
#msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 35px 25px;
  display: flex;
  flex-direction: column;
}
#msgs::-webkit-scrollbar { width: 4px; }
#msgs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .15);
  border-radius: 20px;
}

.row {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin-bottom: 30px;
  animation: show .5s ease both;
}
.row:not(.me) { align-items: flex-start; }
.row.me { align-items: flex-end; }
@keyframes show {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble {
  max-width: 75%;
  padding: 15px 18px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  color: #eee;
}
.row:not(.me) .bubble {
  background: rgba(255, 255, 255, .07);
  border-bottom-left-radius: 4px;
}
.row.me .bubble {
  background: linear-gradient(135deg, #704354, #24151b);
  color: #f3e6ea;
  border-bottom-right-radius: 4px;
}

.meta {
  font-size: 11px;
  color: #777;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.row.me .meta { justify-content: flex-end; }
.meta .name {
  font-weight: 500;
  color: #ad8995;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta .time { color: #6a5d68; font-size: 10px; }

.sys {
  align-self: center;
  text-align: center;
  font-size: 12px;
  color: #777;
  margin-bottom: 20px;
  letter-spacing: .5px;
}

.bubble img {
  max-width: 100%;
  border-radius: 12px;
  display: block;
  margin-top: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.bubble audio {
  width: 100%;
  margin-top: 6px;
  border-radius: 30px;
  height: 36px;
}

/* ---------- 输入栏（固定高度，位于底部）---------- */
#input {
  height: 90px;
  padding: 18px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
#input button {
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter .15s;
}
#input button:active { filter: brightness(1.2); }

#imgBtn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .1);
}
#imgBtn:active { background: rgba(255, 255, 255, .08); }
#imgBtn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #c8b0b8;
  stroke-width: 1.5;
}

#text {
  flex: 1;
  height: 52px;
  min-width: 0;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 26px;
  font-size: 15px;
  color: #eee;
  background: rgba(255, 255, 255, .06);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#text::placeholder { color: #777; }
#text:focus {
  border-color: rgba(123, 67, 85, .85);
  background: rgba(255, 255, 255, .09);
}

#send {
  height: 52px;
  min-width: 52px;
  padding: 0 24px;
  border: none;
  border-radius: 26px;
  background: #754052;
  color: #f0e0e4;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 2px;
  cursor: pointer;
  animation: pulse 2s infinite;
}
#send:active { filter: brightness(1.2); }
@keyframes pulse { 50% { box-shadow: 0 0 25px #754052; } }

/* ---------- 窄屏：满屏，去掉框 ---------- */
@media (max-width: 840px) {
  body { gap: 0; }
  #app {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .fsToggle { display: none; }
}

@media (max-width: 480px) {
  #login h1 { font-size: 38px; letter-spacing: 10px; }
  #bar .title { font-size: 15px; }
  .bubble { font-size: 14px; padding: 13px 15px; }
  #text { font-size: 16px; }
}
