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

:root {
  --bg:           #0a0a10;
  --bg-subtle:    #0e0e18;
  --surface:      #12121e;
  --surface2:     #1a1a2e;
  --surface3:     #22223a;
  --border:       #2a2a44;
  --border-glow:  rgba(155, 126, 255, 0.15);
  --text:         #e4e4f0;
  --text-dim:     #7878a0;
  --text-faint:   #4e4e6a;
  --accent:       #8b6cff;
  --accent-glow:  #a78bff;
  --accent-soft:  rgba(139, 108, 255, 0.08);
  --moon:         #c9b8ff;
  --moon-glow:    rgba(201, 184, 255, 0.12);
  --user-bubble:  #1e1e38;
  --ai-bubble:    #141428;
  --danger:       #ff5c7c;
  --success:      #4ecd82;
  --radius:       14px;
  --header-h:     56px;
  --emotion-rgb:  139, 108, 255;
  --portrait-w:   300px;
  --trans-dur:    300ms;
}

body.light-theme {
  --bg:           #f5f5fa;
  --bg-subtle:    #eeeef5;
  --surface:      #ffffff;
  --surface2:     #eeeef5;
  --surface3:     #e5e5f0;
  --border:       #d0d0e0;
  --border-glow:  rgba(139, 108, 255, 0.15);
  --text:         #18182a;
  --text-dim:     #5a5a80;
  --text-faint:   #9090b0;
  --user-bubble:  #ece8ff;
  --ai-bubble:    #f5f3ff;
  --accent:       #7055e0;
  --accent-glow:  #8b6cff;
  --accent-soft:  rgba(112, 85, 224, 0.08);
  --moon:         #7055e0;
  --moon-glow:    rgba(112, 85, 224, 0.10);
  --danger:       #e04060;
  --success:      #2ea860;
}

html, body {
  height: 100%;
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* Ambient scene */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 50%, rgba(var(--emotion-rgb), 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 15%, rgba(139,108,255, 0.04) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
  transition: background 0.8s ease;
}

/* ================================================================
   LOGIN SCREEN
   ================================================================ */

#login-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  animation: fadeIn 0.3s ease;
}

#login-screen.visible { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.login-card {
  display: flex;
  width: min(860px, 95vw);
  height: min(540px, 88vh);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.55), 0 0 0 1px rgba(var(--emotion-rgb), 0.08);
  animation: cardUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardUp {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* Portrait side */
.login-portrait-side {
  flex: 0 0 44%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--surface2) 0%, var(--bg) 100%);
}

.login-portrait-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 95%,
    rgba(var(--emotion-rgb), 0.2) 0%, transparent 65%);
  pointer-events: none;
  transition: background 0.8s ease;
}

.login-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 0 36px rgba(var(--emotion-rgb), 0.28));
  transition: filter 0.8s ease;
}

/* Form side */
.login-form-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 40px;
  border-left: 1px solid var(--border);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 36px;
}

.login-wordmark {
  font-family: 'Syne', sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--text);
  line-height: 1;
}

.login-tagline {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-faint);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 6px;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 288px;
}

.login-fields input {
  width: 100%;
  padding: 12px 15px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-fields input:focus {
  border-color: rgba(var(--emotion-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--emotion-rgb), 0.1);
  background: var(--surface3);
}

.login-fields input::placeholder { color: var(--text-faint); }

.btn-login {
  margin-top: 6px;
  width: 100%;
  max-width: 288px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.12s, box-shadow 0.2s;
  box-shadow: 0 4px 22px rgba(var(--emotion-rgb), 0.32);
}

.btn-login:hover:not(:disabled) {
  opacity: 0.88;
  box-shadow: 0 6px 28px rgba(var(--emotion-rgb), 0.44);
}

.btn-login:active:not(:disabled) { transform: scale(0.97); }
.btn-login:disabled { opacity: 0.45; cursor: not-allowed; }

#login-error {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--danger);
  text-align: center;
  min-height: 18px;
  max-width: 288px;
}

/* ================================================================
   CHAT SCREEN
   ================================================================ */

#chat-screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  z-index: 50;
}

#chat-screen.visible { display: flex; }

/* ---- Header ---- */

#header {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 16px;
  background: rgba(10, 10, 16, 0.88);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  position: relative;
}

body.light-theme #header {
  background: rgba(245, 245, 250, 0.92);
}

.header-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(var(--emotion-rgb), 0.4);
  flex-shrink: 0;
  transition: border-color 0.4s;
}

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

.header-text {}

.header-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text);
  line-height: 1;
}

.header-mood {
  font-size: 0.64rem;
  color: rgba(var(--emotion-rgb), 0.85);
  letter-spacing: 0.08em;
  line-height: 1;
  margin-top: 3px;
  transition: color 0.4s;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hdr-user {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0 8px;
}

.hdr-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.hdr-btn:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--border);
}

.hdr-btn.danger:hover {
  color: var(--danger);
  background: rgba(255, 92, 124, 0.07);
  border-color: rgba(255, 92, 124, 0.2);
}

.hdr-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

#btn-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
}

#btn-menu svg { width: 20px; height: 20px; fill: currentColor; }

/* ---- Main layout ---- */

#chat-main {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ---- Portrait Panel (desktop) ---- */

#portrait-panel {
  flex: 0 0 var(--portrait-w);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-subtle) 100%);
  border-right: 1px solid var(--border);
}

#portrait-panel-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 110% 55% at 50% 100%,
    rgba(var(--emotion-rgb), 0.13) 0%, transparent 65%);
  pointer-events: none;
  transition: background var(--trans-dur) ease;
  z-index: 0;
}

#portrait-panel-img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 68px;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  mask-image: linear-gradient(to bottom, black 0%, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 80%, transparent 100%);
  z-index: 1;
  filter: drop-shadow(0 0 28px rgba(var(--emotion-rgb), 0.35))
          drop-shadow(0 2px 8px rgba(0,0,0,0.7));
  transition: opacity var(--trans-dur) ease, filter var(--trans-dur) ease;
  animation: lunaFloat 7s ease-in-out infinite;
}

@keyframes lunaFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

#portrait-panel-nameplate {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(10,10,16,0.5);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--emotion-rgb), 0.12);
  padding: 7px 12px;
  border-radius: 10px;
}

body.light-theme #portrait-panel-nameplate {
  background: rgba(245,245,250,0.7);
}

.pp-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--text);
}

.pp-mood {
  font-size: 0.62rem;
  color: rgba(var(--emotion-rgb), 0.9);
  letter-spacing: 0.08em;
  transition: color 0.4s;
}

/* ---- Chat Column ---- */

.chat-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ---- Portrait Mobile ---- */

#portrait-mobile {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 12px;
  z-index: 12;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 8px 7px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4),
              0 0 12px rgba(var(--emotion-rgb), 0.12);
}

.pm-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 14px;
  overflow: hidden;
}

#portrait-mobile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 14px;
  transition: opacity 0.25s ease;
}

.pm-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(var(--emotion-rgb), 0.35);
  pointer-events: none;
}

.pm-glow {
  position: absolute;
  inset: -8px;
  border-radius: 18px;
  background: radial-gradient(circle, rgba(var(--emotion-rgb), 0.18) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  transition: background var(--trans-dur) ease;
}

.pm-info { display: flex; flex-direction: column; gap: 2px; align-items: center; }

.pm-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.pm-mood {
  font-size: 0.62rem;
  color: rgba(var(--emotion-rgb), 0.85);
  transition: color var(--trans-dur) ease;
}

/* ---- Messages ---- */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#messages::-webkit-scrollbar { width: 3px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: msgSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msgSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.msg.user {
  flex-direction: row-reverse;
  align-self: flex-end;
  max-width: 82%;
}

.msg.assistant {
  align-self: flex-start;
  max-width: 88%;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
  margin-top: 3px;
  border: 1px solid rgba(var(--emotion-rgb), 0.3);
  transition: border-color 0.4s;
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.msg-text {
  padding: 10px 14px;
  font-size: 0.875rem;
  line-height: 1.68;
  word-break: break-word;
  overflow-wrap: break-word;
}

.msg.user .msg-text {
  background: var(--user-bubble);
  border: 1px solid rgba(var(--emotion-rgb), 0.14);
  border-radius: 14px 3px 14px 14px;
  color: var(--text);
}

.msg.assistant .msg-text {
  background: var(--ai-bubble);
  border: 1px solid var(--border);
  border-radius: 3px 14px 14px 14px;
  color: var(--text);
}

/* Markdown */
.msg.assistant .msg-text p { margin-bottom: 0.55em; }
.msg.assistant .msg-text p:last-child { margin-bottom: 0; }
.msg.assistant .msg-text h1,
.msg.assistant .msg-text h2,
.msg.assistant .msg-text h3 {
  font-family: 'Syne', sans-serif;
  color: var(--accent-glow);
  margin: 0.8em 0 0.4em;
}
.msg.assistant .msg-text code {
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
  background: rgba(var(--emotion-rgb), 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}
.msg.assistant .msg-text pre {
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
  overflow-x: auto;
  margin: 6px 0;
  font-size: 0.82rem;
}
.msg.assistant .msg-text pre code { background: transparent; padding: 0; }
.msg.assistant .msg-text ul,
.msg.assistant .msg-text ol { padding-left: 18px; margin: 4px 0; }
.msg.assistant .msg-text li { margin-bottom: 3px; }
.msg.assistant .msg-text strong { color: var(--accent-glow); font-weight: 600; }
.msg.assistant .msg-text em { color: var(--text-dim); }
.msg.assistant .msg-text a { color: var(--accent-glow); }
.msg.assistant .msg-text blockquote {
  border-left: 3px solid rgba(var(--emotion-rgb), 0.4);
  padding-left: 12px;
  color: var(--text-dim);
  margin: 6px 0;
}

body.light-theme .msg.assistant .msg-text code { background: rgba(0,0,0,0.06); }
body.light-theme .msg.assistant .msg-text pre { background: rgba(0,0,0,0.04); }

/* Message meta */
.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding-left: 1px;
}

.emotion-badge {
  font-size: 0.62rem;
  color: rgba(var(--emotion-rgb), 0.88);
  background: rgba(var(--emotion-rgb), 0.08);
  border: 1px solid rgba(var(--emotion-rgb), 0.18);
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  cursor: default;
  user-select: none;
  transition: background 0.2s, color 0.2s;
}

.emotion-badge:hover {
  background: rgba(var(--emotion-rgb), 0.14);
}

.latency-badge {
  font-size: 0.6rem;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.debug-panel {
  display: none;
  font-size: 0.62rem;
  color: var(--text-faint);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

.debug-panel.visible { display: block; }

/* ---- History separator ---- */
.history-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 8px 0;
  user-select: none;
}
.history-sep::before,
.history-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Loading ---- */

#loading {
  display: none;
  align-items: flex-start;
  gap: 8px;
  animation: msgSlide 0.2s ease;
}

#loading.visible { display: flex; }

.loading-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(var(--emotion-rgb), 0.3);
  background: rgba(var(--emotion-rgb), 0.08);
  flex-shrink: 0;
  margin-top: 3px;
}

.loading-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--ai-bubble);
  border: 1px solid var(--border);
  border-radius: 3px 14px 14px 14px;
}

.loading-bubble span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: dotBounce 1.1s ease-in-out infinite;
}

.loading-bubble span:nth-child(2) { animation-delay: 0.18s; }
.loading-bubble span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dotBounce {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40%           { opacity: 1;    transform: scale(1.15); }
}

/* ---- Input Bar ---- */

#input-bar {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  background: rgba(10, 10, 16, 0.75);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

body.light-theme #input-bar {
  background: rgba(245, 245, 250, 0.88);
}

#msg-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  resize: none;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.55;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#msg-input:focus {
  border-color: rgba(var(--emotion-rgb), 0.45);
  box-shadow: 0 0 0 3px rgba(var(--emotion-rgb), 0.07);
}

#msg-input::placeholder { color: var(--text-faint); }

#btn-send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 11px;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 14px rgba(var(--emotion-rgb), 0.32);
}

#btn-send:hover:not(:disabled) {
  opacity: 0.86;
  box-shadow: 0 4px 20px rgba(var(--emotion-rgb), 0.45);
}

#btn-send:active:not(:disabled) { transform: scale(0.91); }
#btn-send:disabled { opacity: 0.38; cursor: not-allowed; }
#btn-send svg { width: 17px; height: 17px; fill: currentColor; }

/* ================================================================
   MOBILE DRAWER
   ================================================================ */

#drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 200;
  backdrop-filter: blur(3px);
}

#drawer-backdrop.open { display: block; }

#mobile-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(270px, 80vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -24px 0 60px rgba(0,0,0,0.42);
}

#mobile-drawer.open { right: 0; }

.drawer-head {
  padding: 24px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.drawer-luna {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.drawer-user-name {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.drawer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(42, 42, 68, 0.5);
}

.drawer-label-text {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.drawer-action {
  padding: 6px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.15s;
}

.drawer-action:hover { background: var(--surface3); }

.drawer-action.danger {
  color: var(--danger);
  border-color: rgba(255,92,124,0.2);
}

.drawer-action.danger:hover {
  background: rgba(255,92,124,0.07);
}

/* PWA-only items: visible only in standalone (home screen) mode */
.drawer-item.pwa-only {
  display: none;
}

@media (display-mode: standalone) {
  .drawer-item.pwa-only { display: flex; }
}
/* iOS standalone fallback */
.pwa-standalone .drawer-item.pwa-only {
  display: flex;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 767px) {
  #portrait-panel { display: none; }
  #portrait-mobile { display: flex; }
  .header-right { display: none; }
  #btn-menu { display: flex; }

  /* ---- Auto-hide header on scroll ---- */
  #header {
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                margin-top 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }

  body.header-hidden #header {
    transform: translateY(-100%);
    margin-top: calc(-1 * var(--header-h));
  }

  #portrait-mobile {
    transition: top 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.header-hidden #portrait-mobile {
    top: 10px;
  }
}

@media (min-width: 768px) {
  #portrait-mobile { display: none; }
  #btn-menu { display: none; }
}

/* Login responsive */
@media (max-width: 600px) {
  .login-card {
    flex-direction: column;
    height: min(640px, 95vh);
    width: min(380px, 95vw);
  }
  .login-portrait-side {
    flex: 0 0 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .login-form-side {
    border-left: none;
    padding: 30px 24px;
  }
}
