* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- burger button ---- */
#burger-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  flex-shrink: 0;
}
#burger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: #94a3b8;
  border-radius: 2px;
  transition: background 0.15s;
}
#burger-btn:hover span { background: #e2e8f0; }

/* ---- drawer overlay ---- */
#drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1998;
}
#drawer-overlay.open { display: block; }

/* ---- side drawer ---- */
#drawer {
  position: fixed;
  top: 0; left: 0;
  width: 300px;
  height: 100vh;
  background: #1a1d27;
  border-right: 1px solid #2d3148;
  z-index: 1999;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}
#drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #2d3148;
}
.drawer-title { font-size: 15px; font-weight: 600; }
.drawer-close {
  background: none; border: none;
  color: #64748b; font-size: 18px;
  cursor: pointer; line-height: 1;
}
.drawer-close:hover { color: #e2e8f0; }

.drawer-section { padding: 12px 10px; }
.drawer-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 0 8px;
  margin-bottom: 8px;
}
.drawer-divider { border-top: 1px solid #2d3148; margin: 4px 0; }

.drawer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.drawer-item:hover { background: #2d3148; }
.drawer-item.danger { color: #f87171; }
.drawer-item.danger:hover { background: rgba(220,38,38,0.15); }

/* ---- API reference list ---- */
.api-row-wrapper { border-radius: 8px; overflow: hidden; margin-bottom: 4px; border: 1px solid #2d3148; }
.api-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #1a1d27;
  cursor: pointer;
  transition: background 0.15s;
}
.api-row:hover { background: #222638; }
.api-badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 5px;
  border-radius: 4px;
  text-align: center;
  text-transform: uppercase;
  min-width: 46px;
}
.api-badge.get  { background: #14532d; color: #4ade80; }
.api-badge.post { background: #1e3a5f; color: #60a5fa; }
.api-path { font-size: 12px; font-family: monospace; color: #e2e8f0; }
.api-desc { font-size: 11px; color: #64748b; }
.api-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.api-chevron {
  flex-shrink: 0;
  color: #64748b;
  font-size: 10px;
  padding-left: 4px;
  transition: transform 0.2s;
}
.api-row-wrapper.open .api-chevron { transform: rotate(90deg); }

/* ---- API detail / runner ---- */
.api-detail {
  display: none;
  padding: 14px 16px;
  background: #0f1117;
  border-top: 1px solid #2d3148;
}
.api-detail.open { display: block; }
.api-param-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.api-param-label {
  font-size: 12px;
  color: #94a3b8;
  min-width: 90px;
  font-family: monospace;
}
.api-param-input {
  flex: 1;
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  font-family: monospace;
}
.api-param-input:focus { border-color: #4f8ef7; }
.api-run-btn {
  background: linear-gradient(135deg, #4f8ef7, #7c3aed);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 20px;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-bottom: 10px;
}
.api-run-btn:hover { opacity: 0.85; }
.api-run-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.api-response {
  display: none;
  margin-top: 4px;
  background: #0d1117;
  border: 1px solid #2d3148;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: monospace;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow-y: auto;
}
.api-response:not(:empty) { display: block; }

/* ---- header ---- */
header {
  background: #1a1d27;
  border-bottom: 1px solid #2d3148;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header .logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #4f8ef7, #7c3aed);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
header h1 { font-size: 17px; font-weight: 600; }
header .subtitle { font-size: 12px; color: #64748b; margin-top: 1px; }
.status-bar {
  margin-left: auto;
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #64748b;
  align-items: center;
}
.stat-pill {
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}
.stat-pill span { color: #e2e8f0; font-weight: 600; }
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #64748b;
  margin-right: 4px;
  vertical-align: middle;
}
.status-dot.active { background: #22c55e; }

/* ---- messages ---- */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  display: flex;
  gap: 12px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}
.msg.user { flex-direction: row-reverse; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.avatar.ai   { background: linear-gradient(135deg, #4f8ef7, #7c3aed); }
.avatar.user { background: #374151; color: #9ca3af; }

.bubble {
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  max-width: calc(100% - 44px);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user .bubble {
  background: #1e3a5f;
  border-color: #2d5a8e;
}

.action-card {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
  color: #94a3b8;
}
.action-card .action-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #4f8ef7;
  margin-bottom: 4px;
}
.action-card pre {
  background: #0d1117;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  overflow-x: auto;
  color: #e2e8f0;
  margin-top: 6px;
}

.typing { color: #64748b; font-style: italic; }

/* ---- timer ---- */
#timer-bar {
  display: none;
  background: #1a1d27;
  border-bottom: 1px solid #2d3148;
  padding: 6px 20px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
}
#timer-bar.active { display: none; }
#timer-seconds {
  color: #4f8ef7;
  font-weight: 700;
  font-size: 14px;
}
.response-time {
  font-size: 11px;
  color: #4f8ef7;
  margin-top: 5px;
  display: block;
}

/* ---- input ---- */
#input-area {
  background: #1a1d27;
  border-top: 1px solid #2d3148;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
}
.input-wrap {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
#user-input {
  flex: 1;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 14px;
  padding: 12px 14px;
  resize: none;
  min-height: 46px;
  max-height: 140px;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
}
#user-input:focus { border-color: #4f8ef7; }
#send-btn {
  background: linear-gradient(135deg, #4f8ef7, #7c3aed);
  border: none;
  border-radius: 10px;
  width: 46px; height: 46px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
#send-btn:hover { opacity: 0.85; }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#send-btn svg { width: 18px; height: 18px; fill: white; }

/* ---- welcome ---- */
#welcome {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 0 16px;
  text-align: center;
}
#welcome h2 { font-size: 22px; margin-bottom: 8px; }
#welcome p  { color: #64748b; font-size: 14px; margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.chip:hover { border-color: #4f8ef7; color: #4f8ef7; }

/* scrollbar */
#messages::-webkit-scrollbar { width: 6px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: #2d3148; border-radius: 3px; }

/* ---- login overlay ---- */
#login-overlay {
  position: fixed;
  inset: 0;
  background: #0f1117;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#login-box {
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 16px;
  padding: 40px 36px;
  width: 340px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
#login-box .login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #4f8ef7, #7c3aed);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
}
#login-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
#login-box p  { color: #64748b; font-size: 13px; margin-bottom: 28px; }
#passcode-input {
  width: 100%;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 22px;
  letter-spacing: 6px;
  padding: 12px 14px;
  text-align: center;
  outline: none;
  margin-bottom: 10px;
  font-family: monospace;
}
#passcode-input:focus { border-color: #4f8ef7; }
#passcode-input.shake { animation: shake 0.35s; border-color: #dc2626; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-10px); }
  60%      { transform: translateX(10px); }
  80%      { transform: translateX(-5px); }
}
#login-error { color: #dc2626; font-size: 12px; min-height: 18px; margin-bottom: 12px; }
.remember-row {
  display: flex; align-items: center; gap: 8px;
  justify-content: center; margin-bottom: 20px;
  font-size: 13px; color: #94a3b8; cursor: pointer; user-select: none;
}
.remember-row input { cursor: pointer; accent-color: #4f8ef7; width: 14px; height: 14px; }
#login-btn {
  width: 100%;
  background: linear-gradient(135deg, #4f8ef7, #7c3aed);
  border: none; border-radius: 10px;
  color: white; font-size: 15px; font-weight: 600;
  padding: 13px; cursor: pointer;
  transition: opacity 0.15s;
}
#login-btn:hover { opacity: 0.85; }
#logout-btn {
  background: none; border: 1px solid #2d3148;
  color: #64748b; border-radius: 8px;
  padding: 5px 9px; font-size: 12px;
  cursor: pointer; margin-left: 4px;
  transition: border-color 0.15s, color 0.15s;
}
#logout-btn:hover { border-color: #dc2626; color: #dc2626; }

/* ---- model manager ---- */
#mm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  display: none;
}
#model-manager {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 70vh;
  max-height: 80vh;
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 12px;
  z-index: 1000;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#model-manager.show {
  display: flex;
}
#mm-overlay.show {
  display: block;
}
#mm-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#model-manager .mm-head {
  padding: 10px 14px;
  border-bottom: 1px solid #2d3148;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}
#mm-search:focus { border-color: #4f8ef7; }
#model-manager .mm-close { cursor: pointer; color: #64748b; font-size: 16px; }
#model-manager .mm-close:hover { color: #e2e8f0; }
.mm-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #1e2235; font-size: 12px; align-items: center; }
.mm-row.hidden { display: none; }
.mm-actions { display: flex; gap: 10px; align-items: center; justify-content: center; }
.mm-row:last-child { border-bottom: none; }
.mm-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mm-size { color: #64748b; font-size: 10px; white-space: nowrap; }
.mm-del { background: none; border: 1px solid #dc2626; color: #dc2626; border-radius: 6px; padding: 3px 8px; font-size: 11px; cursor: pointer; transition: background 0.15s; white-space: nowrap; }
.mm-del:hover { background: #dc2626; color: white; }
.mm-del:disabled { opacity: 0.4; cursor: not-allowed; }
.mm-del[style*="background:#3b82f6"] { border-color: #3b82f6; }
.mm-del[style*="background:#3b82f6"]:hover { background: #2563eb !important; border-color: #2563eb; }
/* ---- api full-screen page ---- */
#api-page {
  display: none;
  position: fixed;
  inset: 0;
  background: #0f1117;
  z-index: 2000;
  flex-direction: column;
}
#api-page.open { display: flex; }

.api-page-header {
  background: #1a1d27;
  border-bottom: 1px solid #2d3148;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.api-page-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.api-back-btn {
  background: none;
  border: none;
  color: #4f8ef7;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.api-back-btn:hover { background: #2d3148; }

.api-page-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- debug log ---- */
#debug-panel {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 340px;
  background: #0d1117;
  border: 1px solid #2d3148;
  border-radius: 10px;
  font-size: 11px;
  z-index: 999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
#debug-panel .dbg-head {
  padding: 6px 12px;
  background: #1a1d27;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  color: #4f8ef7;
  font-weight: 600;
}
#log-body {
  padding: 8px 10px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #94a3b8;
  font-family: monospace;
  line-height: 1.5;
}

/* ---- MOBILE RESPONSIVE ---- */
@media (max-width: 768px) {
  /* Hide status bar on tablet/mobile */
  .status-bar { display: none !important; }

  /* API reference alignment */
  .api-row {
    grid-template-columns: 40px 1fr 14px;
    gap: 2px 6px;
    padding: 8px 10px;
  }
  .api-badge { font-size: 8px; padding: 2px 4px; }
  .api-path { font-size: 11px; }
  .api-desc { font-size: 10px; }
  .api-chevron { font-size: 9px; }

  /* Make chat messages full width */
  .msg { max-width: 100%; }

  /* Adjust drawer width for tablet */
  #drawer { width: 75vw; max-width: 280px; }

  /* Adjust header */
  header { padding: 12px 14px; gap: 10px; }
  header h1 { font-size: 15px; }
  header .logo { width: 32px; height: 32px; font-size: 16px; }

  /* Adjust messages padding */
  #messages { padding: 16px 12px; gap: 12px; }

  /* Adjust input area */
  #input-area { padding: 12px 14px; }
  .input-wrap { gap: 8px; }
  #user-input { padding: 10px 12px; font-size: 13px; min-height: 44px; }
  #send-btn { width: 44px; height: 44px; }

  /* Adjust chat bubbles */
  .bubble { font-size: 13px; padding: 10px 14px; }
  .avatar { width: 28px; height: 28px; font-size: 12px; }

  /* Adjust welcome screen */
  #welcome { padding: 20px 0 12px; }
  #welcome h2 { font-size: 18px; margin-bottom: 6px; }
  #welcome p { font-size: 12px; margin-bottom: 14px; }
  .chips { gap: 6px; }
  .chip { padding: 6px 12px; font-size: 12px; }

  /* Adjust login box */
  #login-box { width: calc(100% - 32px); padding: 32px 24px; }
  #login-box h2 { font-size: 18px; }

  /* Adjust model manager modal */
  #mm-overlay { padding: 16px; }
  .mm-container { width: 100%; max-width: 100%; max-height: calc(100vh - 40px); }
}

/* ---- SMALL PHONES (< 480px) ---- */
@media (max-width: 480px) {
  /* Burger button visible */
  #burger-btn { display: flex; }

  /* Header compact */
  header { padding: 10px 12px; gap: 8px; }
  header h1 { font-size: 14px; }
  header .logo { width: 30px; height: 30px; font-size: 14px; }
  header .subtitle { font-size: 10px; }

  /* Drawer narrower */
  #drawer { width: 85vw; max-width: 240px; }
  .drawer-header { padding: 12px 14px; }
  .drawer-title { font-size: 13px; }
  .drawer-item { font-size: 13px; padding: 8px 10px; }

  /* Messages very compact */
  #messages { padding: 12px 8px; gap: 10px; }
  #messages::-webkit-scrollbar { width: 4px; }

  /* Smaller bubbles */
  .msg { gap: 8px; }
  .avatar { width: 24px; height: 24px; font-size: 10px; }
  .bubble { font-size: 12px; padding: 8px 12px; max-width: calc(100% - 40px); line-height: 1.4; }
  .msg.user .bubble { max-width: calc(100% - 40px); }

  /* Input compact */
  #input-area { padding: 10px 10px; }
  .input-wrap { gap: 6px; }
  #user-input { padding: 8px 10px; font-size: 12px; min-height: 40px; }
  #send-btn { width: 40px; height: 40px; }
  #send-btn svg { width: 16px; height: 16px; }

  /* Welcome screen mobile */
  #welcome { padding: 16px 8px 10px; margin: 0 8px; }
  #welcome h2 { font-size: 16px; margin-bottom: 4px; }
  #welcome p { font-size: 11px; margin-bottom: 12px; }
  .chips { gap: 5px; }
  .chip { padding: 5px 10px; font-size: 11px; }

  /* Login box mobile */
  #login-box { width: calc(100% - 24px); padding: 24px 18px; }
  #login-box .login-logo { width: 48px; height: 48px; font-size: 24px; margin: 0 auto 16px; }
  #login-box h2 { font-size: 16px; margin-bottom: 4px; }
  #login-box p { font-size: 12px; margin-bottom: 20px; }
  #passcode-input { font-size: 18px; padding: 10px 10px; }
  #login-btn { padding: 11px; font-size: 14px; }

  /* Debug panel mobile */
  #debug-panel { width: calc(100% - 32px); bottom: 70px; right: 16px; font-size: 10px; }
  #log-body { max-height: 150px; }

  /* Action cards mobile */
  .action-card { padding: 8px 12px; font-size: 12px; }
  .action-card pre { padding: 6px; font-size: 11px; }

  /* API reference small phones */
  .api-row {
    grid-template-columns: 36px 1fr 12px;
    gap: 2px 4px;
    padding: 6px 8px;
  }
  .api-badge { font-size: 7px; padding: 2px 3px; }
  .api-path { font-size: 10px; }
  .api-desc { font-size: 9px; }
  .api-chevron { font-size: 8px; }

  /* Model manager modal mobile */
  #mm-overlay.show { display: block; }
  #model-manager {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    transform: none;
    border-radius: 0;
    z-index: 1001;
  }
  #model-manager.show { display: flex; }
  #mm-list { max-height: calc(100vh - 50px); }
  #model-manager .mm-head { padding: 12px 14px; font-size: 13px; }
  #mm-search { font-size: 12px; padding: 6px 8px; }
  #model-manager .mm-close { font-size: 18px; }
  .mm-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px 10px;
    font-size: 11px;
    align-items: center;
  }
  .mm-name { gap: 2px; }
  .mm-size { display: inline; margin-right: 4px; }
  .mm-actions { gap: 6px; }
  .mm-del { padding: 3px 6px; font-size: 10px; white-space: normal; }

  /* Manage panel mobile */
  #manage-panel { padding: 12px; }

  /* Timer bar */
  #timer-bar { padding: 4px 12px; font-size: 11px; }
}

/* ---- ULTRA SMALL (< 360px) ---- */
@media (max-width: 360px) {
  header { padding: 8px 10px; }
  header h1 { font-size: 13px; }
  header .logo { width: 28px; height: 28px; font-size: 13px; }

  #messages { padding: 10px 6px; }
  .avatar { width: 22px; height: 22px; }
  .bubble { font-size: 11px; padding: 7px 10px; }

  #input-area { padding: 8px 8px; }
  #user-input { padding: 8px 8px; font-size: 11px; min-height: 38px; }
  #send-btn { width: 38px; height: 38px; }

  #welcome h2 { font-size: 14px; }
  #welcome p { font-size: 10px; }
  .chip { padding: 4px 8px; font-size: 10px; }

  /* Model manager ultra-small */
  #model-manager .mm-head { padding: 10px 12px; font-size: 12px; }
  #mm-list { max-height: calc(100vh - 44px); }
  .mm-row { padding: 8px 10px; font-size: 10px; }
}

/* ---- LANDSCAPE MODE ---- */
@media (max-height: 500px) {
  header { padding: 8px 14px; }
  #messages { padding: 12px 10px; gap: 8px; }
  #input-area { padding: 8px 14px; }
  #user-input { min-height: 36px; }
  #send-btn { width: 36px; height: 36px; }
}
