:root {
  --bg: #000;
  --bg-1: #000;

  --glass: rgba(255,255,255,0.04);
  --glass-2: rgba(255,255,255,0.06);
  --glass-bg: rgba(255,255,255,0.05);

  --border: rgba(255,255,255,0.10);
  --glass-border: rgba(255,255,255,0.12);
  --accent: rgba(255,255,255,0.14);

  --muted: rgba(255,255,255,0.6);
  --danger: #ff4a4a;
  --success: #4aff8a;
  --fg: #fff;
}

/* ===== BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter Tight", system-ui, Segoe UI, Roboto, Arial;
  background: black;
  color: white
}

html,
body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background: linear-gradient(
    135deg,
    var(--bg-1),
    #1f1f1f 40%,
    var(--bg-1)
  );
}

.app {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ===== CARD ===== */
.card {
  width: 100%;
  max-width: 980px;
  height: 86vh;

  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;

  padding: 18px;
  border-radius: 18px;

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.02),
    rgba(255,255,255,0.01)
  );

  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
  overflow: hidden;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #111, #000);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

.header .status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* ===== MESSAGES ===== */
.messages-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;

  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.02);

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.01),
    rgba(255,255,255,0)
  );
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;

  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  scroll-behavior: smooth;
}

/* ===== MESSAGE ROW ===== */
.msg-row {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: flex-start;
}

.msg-row.incoming {
  justify-content: flex-start;
}

.msg-row.outgoing {
  flex-direction: row-reverse;
}

.msg-row.outgoing .msg-meta {
  margin-left: auto;
  align-items: flex-end;
  text-align: right;
}


/* ===== MESSAGE META ===== */
.msg-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 70%;
}

.msg-meta.right {
  align-items: flex-end;
  text-align: right;
}

.username {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
}

/* ===== AVATAR ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(135deg, #111, #000);

  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== BUBBLE ===== */
.bubble {
  padding: 10px 14px;
  border-radius: 14px;

  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.06);

  max-width: 100%;
  word-wrap: break-word;
  white-space: pre-wrap;

  font-size: 15px;
  line-height: 1.35;

  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

.msg-row.outgoing .bubble {
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.02),
    rgba(255,255,255,0.01)
  );
  border: 1px solid rgba(255,255,255,0.08);
}

/* ===== COMPOSER ===== */
.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px;

  border-top: 1px solid rgba(255,255,255,0.03);
  background: linear-gradient(180deg, rgba(0,0,0,0.02), transparent);
}

.input-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-input {
  width: 100%;
  min-height: 48px;
  resize: none;

  padding: 12px 14px;
  border-radius: 12px;

  background: var(--glass-2);
  border: 1px solid rgba(255,255,255,0.06);

  font-size: 15px;
  outline: none;
}

.message-input:focus {
  border-color: rgba(255,255,255,0.12);
}

.controls {
  display: flex;
  gap: 8px;
}

.send-btn {
  padding: 10px 14px;
  border-radius: 12px;

  background: var(--glass-2);
  border: 1px solid rgba(255,255,255,0.07);

  cursor: pointer;
  font-weight: 600;
}

.send-btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

/* ===== HELPERS ===== */
.helper {
  font-size: 13px;
  color: var(--muted);
}

/* ===== MOBILE ===== */
@media (max-width: 680px) {
  .card {
    height: 100vh;
    padding: 12px;
    border-radius: 14px;
  }

  .msg-meta {
    max-width: 85%;
  }
}
