* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "PingFang SC", sans-serif; }
#app { display: flex; flex-direction: column; height: 100vh; position: relative; }

/* ====== 手机竖屏优先（< 600px）====== */

#bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #075e54;
  color: #fff;
  height: 48px;
  font-size: 14px;
}
#who {
  font-weight: 600;
  flex-shrink: 0;
}
#badge {
  margin-left: auto;
  background: #e8b04b;
  color: #000;
  padding: 4px 6px;
  border-radius: 10px;
  font-size: 11px;
  flex-shrink: 0;
}
#lock-btn {
  margin-left: auto;
  background: #ffffff22;
  color: #fff;
  border: 0;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
}
#lock-btn::before { content: "🔒"; }
#lock-btn { font-size: 0; }

#chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  padding-bottom: 70px;
  background: #ece5dd;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 15px;
}
.msg.mine {
  align-self: flex-end;
  background: #dcf8c6;
}
.msg .meta {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 3px;
}

#composer {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: #f0f0f0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-top: 1px solid #ddd;
}
#input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
  outline: none;
  font-size: 15px;
}
#composer button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #075e54;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#composer button::before { content: "📤"; }
#composer button { font-size: 0; }

#chat.blurred {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

#veil {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 28, .55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10;
}
.veil-box {
  background: #fff;
  padding: 24px;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
  animation: slideUp .3s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.veil-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
}
.veil-box button {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: #075e54;
  color: #fff;
  cursor: pointer;
}
.lock-icon {
  font-size: 40px;
}
.veil-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}
#pw-hint {
  font-size: 13px;
  color: #c0392b;
  min-height: 18px;
}

.hidden {
  display: none !important;
}
.shake {
  animation: shake .3s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ====== 平板及以上（≥ 600px）====== */
@media (min-width: 600px) {
  #bar {
    padding: 10px 14px;
    font-size: 16px;
  }
  #lock-btn::before { content: "🔒 模糊"; }
  #lock-btn { font-size: 14px; }

  #chat {
    padding: 16px;
    padding-bottom: 16px;
    gap: 8px;
  }
  .msg {
    max-width: 60%;
    font-size: 15px;
  }

  #composer {
    gap: 8px;
    padding: 10px;
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    z-index: auto;
    border-top: none;
  }
  #input {
    font-size: 15px;
  }
  #composer button {
    width: auto;
    border-radius: 20px;
    padding: 10px 18px;
  }
  #composer button::before { content: "发送"; }
  #composer button { font-size: 14px; }

  #veil {
    align-items: center;
    justify-content: center;
  }
  .veil-box {
    width: min(320px, 86%);
    max-height: none;
    border-radius: 14px;
    animation: none;
  }
}
