* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}
header {
  padding: 12px 24px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: baseline;
  gap: 16px;
}
header h1 { margin: 0; font-size: 20px; }
header .tag {
  background: #f59e0b;
  color: #1e293b;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
header .hint { color: #94a3b8; font-size: 13px; }

main {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 56px);
}

.phone-col { display: flex; justify-content: center; }
.phone {
  width: 340px;
  background: #1e293b;
  border-radius: 24px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 4px solid #0b1220;
}
.phone-top {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  padding: 4px 0 8px;
  border-bottom: 1px solid #334155;
}
.phone-screen {
  flex: 1;
  overflow-y: auto;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  max-width: 80%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.outgoing {  /* user sends from phone -> right */
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble.incoming {  /* server replies to phone -> left */
  align-self: flex-start;
  background: #334155;
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
}
.bubble .meta {
  font-size: 10px;
  color: #cbd5e1;
  margin-top: 4px;
  opacity: 0.8;
}

.phone-input {
  border-top: 1px solid #334155;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.phone-input label {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  gap: 6px;
  align-items: center;
}
.phone-input select,
.phone-input textarea {
  width: 100%;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
}
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.quick button {
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
  cursor: pointer;
}
.quick button:hover { background: #475569; }
button.primary {
  background: #10b981;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: #34d399; }

.log-col {
  background: #0b1220;
  border-radius: 8px;
  padding: 12px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.log-col h2 { margin: 0 0 8px; font-size: 16px; }
.log {
  flex: 1;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
}
.log-row {
  border-bottom: 1px dashed #1e293b;
  padding: 6px 0;
}
.log-row .k-incoming { color: #34d399; }
.log-row .k-outgoing { color: #60a5fa; }
.log-row .k-trace { color: #f59e0b; }
.log-row .ts { color: #64748b; margin-right: 6px; }
.log-row pre {
  margin: 4px 0 0;
  white-space: pre-wrap;
  color: #cbd5e1;
}
