@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --scale: 1;
  --canvas: #fffdfb;
  --sidebar: #e9dfdc;
  --sidebar-button: #ddc8ba;
  --main: #fff0ee;
  --accent: #a9655b;
  --text: #51443f;
  --muted: #a58c7e;
  --action: #f7d1ca;
  --action-hover: #efc4bc;
  --white: #fffaf8;
  --setting-active: #d5bdaf;
  font-family: "Nunito Sans", "Avenir Next", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
  padding: 12px 9px;
  gap: 9px;
}

.sidebar {
  width: 255px;
  min-width: 255px;
  min-height: calc(100vh - 24px);
  padding: 14px 15px 13px;
  border-radius: 36px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  z-index: 5;
  overflow: hidden;
  transition: width .42s cubic-bezier(.22,.72,.24,1), min-width .42s cubic-bezier(.22,.72,.24,1), padding .42s cubic-bezier(.22,.72,.24,1), opacity .28s ease, transform .42s cubic-bezier(.22,.72,.24,1);
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  pointer-events: none;
}

.brand-row { height: 48px; display: flex; align-items: center; gap: 9px; padding: 0 6px; margin-bottom: 17px; }
.back-button, .mobile-close { border: 0; background: transparent; color: #a58c7e; font-size:calc(35px * var(--scale, 1)); line-height: 1; padding: 0; }
.brand-name { color: #a58c7e; font-size:calc(31px * var(--scale, 1)); font-weight: 500; }
.mobile-close { display: none; margin-left: auto; }

.main-nav { display: flex; flex-direction: column; gap: 23px; }
.nav-button {
  min-height: 78px; width: 100%; border: 0; border-radius: 27px;
  padding: 13px 22px; display: flex; align-items: center; gap: 16px;
  color: var(--accent); background: var(--sidebar-button); font-size:calc(25px * var(--scale, 1));
  font-weight: 500; text-align: left; transition: background-color .38s cubic-bezier(.22,.72,.24,1), color .38s ease, transform .38s cubic-bezier(.22,.72,.24,1), box-shadow .38s ease;
}
.nav-button:hover, .nav-button.active { background: var(--setting-active); color: var(--text); }
.settings-button.active { background: var(--action); color: var(--accent); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 24%, transparent); }
.nav-button, .main-panel, .brand-name, .timeline-button, .round-action { transition: background-color .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease; }
.nav-button:hover { transform: translateY(-1px); }
.nav-icon { width: 28px; display: inline-flex; justify-content: center; align-items: center; font-size:calc(31px * var(--scale, 1)); line-height: 1; font-weight: 700; }
.nav-icon.book { font-size:calc(29px * var(--scale, 1)); }
.nav-icon.aperture { font-size:calc(31px * var(--scale, 1)); }
.nav-icon.gear { font-size:calc(29px * var(--scale, 1)); }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 13px; }
.settings-button { margin-bottom: 0; }
.profile-button { display: flex; align-items: center; gap: 14px; border: 0; background: transparent; padding: 4px 0 0; text-align: left; color: #171313; font-size:calc(22px * var(--scale, 1)); }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: #bdbdbb; flex: 0 0 auto; }

.main-panel {
  position: relative; flex: 1; min-width: 0; min-height: calc(100vh - 24px);
  border-radius: 39px; background: var(--main); overflow: hidden;
  display: flex; flex-direction: column;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a58c7e;
  transition: background .18s ease, color .18s ease;
}
.sidebar-toggle:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); transform: scale(1.04); }
.sidebar-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sidebar-toggle svg,
.restore-sidebar-button svg { width: 29px; height: 24px; overflow: visible; }
.sidebar-toggle .window-outline,
.sidebar-toggle .sidebar-divider,
.sidebar-toggle .sidebar-lines,
.restore-sidebar-button .window-outline,
.restore-sidebar-button .sidebar-divider,
.restore-sidebar-button .sidebar-lines {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.timeline-button {
  position: absolute;
  top: 20px;
  right: 21px;
  min-width: 246px;
  height: 54px;
  border: 0;
  border-radius: 21px;
  padding: 0 27px;
  background: var(--action);
  color: var(--accent);
  font-size:calc(26px * var(--scale, 1));
  font-weight: 700;
  transition: background .18s ease;
}
.timeline-button:hover { background: var(--action-hover); transform: translateY(-1px); }

.restore-sidebar-button {
  display: none;
  position: absolute;
  z-index: 10;
  cursor: pointer;
  top: 20px;
  left: 20px;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 0;
  border-radius: 17px;
  background: var(--action);
  color: var(--accent);
  transition: background .38s cubic-bezier(.22,.72,.24,1), color .38s ease, transform .38s cubic-bezier(.22,.72,.24,1);
}
.restore-sidebar-button:hover { background: var(--action-hover); transform: translateY(-1px); }
.app-shell.sidebar-collapsed .restore-sidebar-button { display: grid; }

.welcome-view { flex: 1; min-height: 300px; display: grid; place-items: center; padding: 70px 25px 145px; text-align: center; }
.welcome-view h1 { margin: 0; color: var(--accent); font-size:calc(clamp(42px, 5vw, 70px) * var(--scale, 1)); line-height: 1.1; font-weight: 800; letter-spacing: -1.5px; }

.composer-area { width: min(850px, calc(100% - 70px)); margin: 0 auto 14px; }
.composer { display: flex; align-items: center; gap: 20px; }
.round-action {
  width: 80px; height: 80px; flex: 0 0 80px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--action); color: var(--accent);
  transition: background .38s cubic-bezier(.22,.72,.24,1), color .38s ease, transform .38s cubic-bezier(.22,.72,.24,1), box-shadow .38s ease;
}
.round-action:hover { background: var(--action-hover); transform: scale(1.03); }
.attach-button { cursor: pointer; font-size:calc(53px * var(--scale, 1)); font-weight: 300; }
.message-input {
  min-width: 0; flex: 1; height: 80px; border: 0; outline: none; border-radius: 42px;
  background: var(--action); padding: 0 32px; color: var(--text); font-size:calc(25px * var(--scale, 1));
}
.message-input::placeholder { color: var(--text); opacity: .68; }
.message-input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); }
.message-input { transition: background-color .38s cubic-bezier(.22,.72,.24,1), color .38s ease, box-shadow .28s ease; }
.voice-button svg { width: 31px; height: 39px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.send-button { font-size:calc(35px * var(--scale, 1)); padding-right: 4px; }

.chat-log { width: min(850px, calc(100% - 70px)); margin: 100px auto 20px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 10px 4px; }
.message { max-width: 78%; padding: 16px 21px; border-radius: 22px; font-size:calc(20px * var(--scale, 1)); line-height: 1.5; overflow-wrap: anywhere; }
.message.user { align-self: flex-end; background: #e6cfc2; }
.message.assistant { align-self: flex-start; background: #ffffffb3; border: 1px solid #a47e6f2e; }

.content-view { flex: 1; display: grid; place-items: center; padding: 90px 30px 140px; }
.content-card { width: min(700px, 100%); padding: 40px; border-radius: 30px; background: #ffffff8f; border: 1px solid #a47e6f2e; }
.eyebrow { color: #ad7e6d; letter-spacing: 2px; font-size:calc(13px * var(--scale, 1)); font-weight: 800; }
.content-card h2 { margin: 10px 0; color: var(--accent); font-size:calc(42px * var(--scale, 1)); }
.content-card p { font-size:calc(20px * var(--scale, 1)); line-height: 1.55; }
.placeholder-note { margin-top: 26px; padding: 18px; border-radius: 18px; background: #f8e1dc; color: #9b786b; font-size:calc(17px * var(--scale, 1)); }

.hidden { display: none !important; }
.mobile-menu { display: none; }
.toast { position: fixed; top: 24px; bottom: auto; left: 50%; transform: translate(-50%, -12px); background: var(--accent, #8d4f47); color: white; padding: 12px 18px; border-radius: 20px; opacity: 0; pointer-events: none; transition: .2s; z-index: 20000; font-size:calc(15px * var(--scale, 1)); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .app-shell { padding: 7px; gap: 0; }
  .app-shell.sidebar-collapsed .sidebar { width: min(290px, calc(100vw - 50px)); min-width: 0; padding: 14px 15px 13px; opacity: 1; pointer-events: auto; }
  .sidebar { position: fixed; top: 7px; bottom: 7px; left: 7px; width: min(290px, calc(100vw - 50px)); min-width: 0; min-height: 0; transform: translateX(calc(-100% - 15px)); transition: transform .38s cubic-bezier(.22,.72,.24,1), opacity .3s ease, box-shadow .38s ease; opacity: .96; box-shadow: 8px 0 30px #50322820; }
  .sidebar.open { transform: translateX(0); }
  .mobile-close { display: block; }
  .main-panel { min-height: calc(100vh - 14px); border-radius: 28px; }
  .mobile-menu { display: block; position: absolute; top: 18px; left: 16px; width: 47px; height: 47px; border: 0; border-radius: 50%; background: var(--action); color: var(--accent); font-size:calc(22px * var(--scale, 1)); }
  .sidebar-toggle { width: 30px; height: 30px; flex-basis: 30px; }
  .sidebar-toggle svg { width: 27px; height: 23px; }
  .restore-sidebar-button { display: none !important; }
  .timeline-button { top: 17px; right: 15px; min-width: 0; height: 47px; padding: 0 16px; border-radius: 17px; font-size:calc(17px * var(--scale, 1)); }
  .welcome-view { padding: 80px 18px 125px; }
  .welcome-view h1 { font-size:calc(clamp(36px, 9vw, 54px) * var(--scale, 1)); }
  .composer-area { width: calc(100% - 24px); margin-bottom: 13px; }
  .composer { gap: 8px; }
  .round-action { width: 52px; height: 52px; flex-basis: 52px; }
  .attach-button { font-size:calc(36px * var(--scale, 1)); }
  .message-input { height: 56px; padding: 0 17px; font-size:calc(16px * var(--scale, 1)); }
  .voice-button svg { width: 23px; height: 30px; }
  .chat-log { width: calc(100% - 28px); margin-top: 80px; }
  .message { max-width: 90%; font-size:calc(17px * var(--scale, 1)); }
  .content-view { padding: 85px 16px 110px; }
  .content-card { padding: 25px; }
  .content-card h2 { font-size:calc(32px * var(--scale, 1)); }
  .content-card p { font-size:calc(17px * var(--scale, 1)); }
}

.settings-frame-view {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  border-radius: inherit;
  background: #fff0ed;
}
.settings-frame-view iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  background: #fff0ed;
}

/* Settings is a full-screen view: hide the home navigation while it is open. */
.app-shell.settings-open .sidebar { display: none; }
.app-shell.settings-open .main-panel { flex: 1 1 100%; width: 100%; min-width: 0; }
.app-shell.settings-open .mobile-menu,
.app-shell.settings-open .restore-sidebar-button,
.app-shell.settings-open .timeline-button { display: none !important; }
.app-shell.settings-open .settings-frame-view { inset: 0; border-radius: 28px; }
@media (max-width: 760px) {
  .app-shell.settings-open { padding: 0; gap: 0; }
  .app-shell.settings-open .main-panel { border-radius: 0; }
  .app-shell.settings-open .settings-frame-view { border-radius: 0; }
}

/* Smooth, subtle transitions for the existing views; no layout or behavior changes. */
.settings-frame-view { animation: settingsReveal .48s cubic-bezier(.22,.72,.24,1) both; will-change: opacity, transform; }
.settings-frame-view iframe { animation: settingsContentReveal .52s cubic-bezier(.22,.72,.24,1) both; }
.settings-frame-view.is-exiting { pointer-events: none; animation: settingsExit .28s cubic-bezier(.4,0,.8,.3) both; }
.content-view.view-entering, .welcome-view.view-entering, .chat-log.view-entering { animation: viewEnter .42s cubic-bezier(.22,.72,.24,1) both; }
.app-shell.settings-open .main-panel { transition: border-radius .32s ease, width .32s ease, flex-basis .32s ease; }
.nav-button, .sidebar-toggle, .restore-sidebar-button, .timeline-button, .back-button,
.attach-button, .voice-button, .send-button, .profile-button, .mobile-menu { transition: background-color .38s cubic-bezier(.22,.72,.24,1), color .38s ease, transform .38s cubic-bezier(.22,.72,.24,1), opacity .3s ease, box-shadow .38s ease; }
button:active { transform: scale(.98); }
@keyframes settingsReveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes settingsContentReveal { from { opacity: 0; transform: translateY(10px); filter: blur(1.5px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }
@keyframes settingsExit { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(5px) scale(.995); } }
@keyframes viewEnter { from { opacity: 0; transform: translateY(8px); filter: blur(1px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }
@media (prefers-reduced-motion: reduce) {
  .settings-frame-view, .settings-frame-view iframe { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* User-selected reading size applies across the entire app. */
html { font-size: calc(16px * var(--scale, 1)); }

/* ========================================
   EVORIL AUTHENTICATION PAGE
======================================== */

.auth-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(230, 194, 184, 0.38), transparent 45%),
    radial-gradient(ellipse at 85% 80%, rgba(210, 218, 202, 0.35), transparent 45%),
    #faf7f4;
  color: #51443f;
  font-family: "Nunito Sans", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.auth-language {
  position: absolute;
  top: 30px;
  right: 48px;
  z-index: 2;
}

.auth-language button {
  border: 0;
  background: transparent;
  color: #78665f;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
}

.auth-language button span {
  margin: 0 7px;
  color: #c4aaa0;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  align-items: center;
  gap: 80px;
  width: min(1180px, calc(100% - 100px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 90px 0;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 480px;
  padding: 30px 0;
}

.auth-brand-name {
  color: #a9655b;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1px;
}

.auth-brand-content {
  max-width: 540px;
  margin: 60px 0;
}

.auth-brand-content h1 {
  max-width: 520px;
  margin: 0 0 25px;
  color: #574640;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -1.5px;
}

.auth-brand-content p {
  max-width: 440px;
  color: #907b71;
  font-size: 17px;
  line-height: 1.9;
}

.auth-brand-footer {
  color: #aa9389;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.auth-card-wrapper {
  width: 100%;
}

.auth-card {
  width: 100%;
  padding: 48px 40px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 20px 70px rgba(105, 77, 65, 0.09);
  backdrop-filter: blur(18px);
}

.auth-card h2 {
  margin: 0 0 10px;
  color: #51443f;
  font-size: 27px;
  font-weight: 700;
}

.auth-card p {
  margin: 0 0 30px;
  color: #a18d83;
  font-size: 14px;
  line-height: 1.7;
}

.auth-card form {
  display: flex;
  flex-direction: column;
}

.auth-card label {
  margin: 17px 0 8px;
  color: #78665f;
  font-size: 13px;
  font-weight: 600;
}

.auth-card input {
  width: 100%;
  height: 49px;
  padding: 0 15px;
  border: 1px solid #e9ded8;
  border-radius: 11px;
  outline: none;
  background: #fffdfc;
  color: #51443f;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-card input:focus {
  border-color: #c38c80;
  box-shadow: 0 0 0 3px rgba(195, 140, 128, 0.12);
}

.auth-card form button {
  height: 51px;
  margin-top: 28px;
  border: 0;
  border-radius: 12px;
  background: #a9655b;
  color: white;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.2s, transform 0.2s;
}

.auth-card form button:hover {
  background: #92574e;
  transform: translateY(-1px);
}

.auth-switch {
  display: block;
  margin: 23px auto 0;
  padding: 5px;
  border: 0;
  background: transparent;
  color: #a9655b;
  font-size: 13px;
  font-weight: 600;
}

.auth-message {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f5eeeb;
  color: #80645b;
  font-size: 13px;
  line-height: 1.6;
}

/* Mobile layout */
@media (max-width: 760px) {
  .auth-language {
    top: 18px;
    right: 18px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    width: min(440px, calc(100% - 36px));
    padding: 85px 0 35px;
  }

  .auth-brand {
    min-height: auto;
    padding: 10px 0;
  }

  .auth-brand-content {
    margin: 35px 0 15px;
  }

  .auth-brand-content h1 {
    font-size: 34px;
  }

  .auth-brand-content p {
    font-size: 14px;
  }

  .auth-brand-footer {
    display: none;
  }

  .auth-card {
    padding: 35px 25px;
  }
}


/* Registration profile photo */
.register-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.auth-card .register-avatar-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  color: #a9655b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.register-avatar-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  overflow: hidden;
  border: 1px solid #e9ded8;
  border-radius: 50%;
  background: #f5eeeb;
  color: #a9655b;
  font-size: 30px;
  font-weight: 300;
  transition: border-color .2s, background .2s, transform .2s;
}

.register-avatar-label:hover .register-avatar-preview {
  border-color: #c38c80;
  background: #f1e6e1;
  transform: translateY(-2px);
}

.register-profile > label[for="registerName"] {
  align-self: stretch;
  margin-top: 0;
}

.register-profile > #registerName {
  margin-bottom: 0;
}


/* Cloud-saved user avatar presentation */
.profile-button .avatar {
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.register-avatar-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* Interactive avatar cropper */
.avatar-crop-overlay[hidden] {
  display: none !important;
}

.avatar-crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(38, 29, 26, 0.48);
  backdrop-filter: blur(5px);
}

.avatar-crop-dialog {
  width: min(100%, 390px);
  padding: 26px 24px 22px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 22px;
  background: #fffaf7;
  box-shadow: 0 18px 60px rgba(43, 31, 26, .2);
  color: #443b37;
  text-align: center;
}

.avatar-crop-dialog h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.avatar-crop-description {
  margin: 0 0 18px;
  color: #887a73;
  font-size: 13px;
  line-height: 1.5;
}

.avatar-crop-canvas {
  display: block;
  width: min(280px, 100%);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #eee5df;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 0 0 1px #e8dcd5;
}

.avatar-crop-canvas:active {
  cursor: grabbing;
}

.avatar-zoom-label {
  display: block;
  margin-bottom: 8px;
  color: #6f625c;
  font-size: 13px;
  text-align: left;
}

.avatar-zoom-slider {
  display: block;
  width: 100%;
  margin: 0 0 22px;
  accent-color: #b77e70;
  cursor: pointer;
}

.avatar-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.avatar-crop-actions button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid #e5d8d1;
  border-radius: 12px;
  background: #fff;
  color: #665852;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.avatar-crop-actions .avatar-crop-confirm {
  border-color: #b77e70;
  background: #b77e70;
  color: #fff;
}

.avatar-crop-actions button:disabled {
  opacity: .55;
  cursor: wait;
}

@media (max-width: 420px) {
  .avatar-crop-dialog {
    padding: 22px 18px 18px;
  }
}


/* Confirm password hint */
.auth-field-hint {
  margin: -8px 0 12px;
  color: #9a8981;
  font-size: 11px;
  line-height: 1.5;
  font-weight: 400;
}

.auth-field-hint.auth-hint-show {
  animation: authHintFadeIn 220ms ease both;
}

@keyframes authHintFadeIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
