:root {
  --mycq-green-1: #f8ffe8;
  --mycq-green-2: #dff2c2;
  --mycq-green-3: #bce987;
  --mycq-green-4: #78b64b;
  --mycq-blue: #2b6fb8;
  --mycq-dark: #1d3e1e;
  --mycq-red: #c31e1e;
  --mycq-panel: #f5ffe2;
  --mycq-shadow: rgba(29, 62, 30, 0.32);
  color-scheme: light;
  font-family: Tahoma, Verdana, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.9), transparent 26rem),
    linear-gradient(135deg, #c7ed98 0%, #ecffd7 42%, #cfefff 100%);
  color: var(--mycq-dark);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100vw - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  place-items: center;
}

.boot-window,
.mycq-window {
  border: 2px outset #b3d685;
  border-radius: 12px;
  background: linear-gradient(#ffffff, var(--mycq-green-1) 22%, var(--mycq-green-2));
  box-shadow: 0 18px 48px var(--mycq-shadow);
  overflow: hidden;
}

.boot-window {
  width: min(520px, 100%);
}

.classic-titlebar {
  min-height: 38px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px groove #8dbb6a;
  background: linear-gradient(#e9ffd2, #9fd96a 48%, #6cae3e);
  color: #123a0d;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.boot-body {
  padding: 22px;
}

.boot-body h1,
.panel-title,
.chat-title {
  margin: 0;
}

.setup-card {
  display: grid;
  gap: 14px;
}

.setup-card p {
  margin: 0;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

.field input,
.message-input {
  width: 100%;
  border: 2px inset #b3d685;
  border-radius: 8px;
  background: #ffffff;
  color: #1d3e1e;
  padding: 10px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.14);
}

.field input:focus,
.message-input:focus {
  border-color: var(--mycq-blue);
}

.classic-button {
  border: 2px outset #6fb63e;
  border-radius: 9px;
  background: linear-gradient(#e4ffb8, #90de47 46%, #55aa22);
  color: #11370d;
  padding: 9px 14px;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 2px 4px rgba(0, 0, 0, 0.18);
}

.classic-button:active {
  border-style: inset;
  transform: translateY(1px);
}

.classic-button.secondary {
  background: linear-gradient(#f8fbff, #c9e1ff 48%, #73a6dd);
  border-color: #5d93ca;
}

.classic-button.small {
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 12px;
}

.mycq-window {
  width: 100%;
  min-height: min(720px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto 1fr;
}

.messenger-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 620px;
}

.contacts-panel {
  border-right: 2px groove #8dbb6a;
  background: linear-gradient(#faffee, #dff2c2);
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
}

.profile-box,
.chat-panel,
.contacts-box,
.composer,
.identity-box {
  border: 2px groove #b3d685;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.profile-box {
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.avatar {
  width: 54px;
  height: 54px;
  border: 2px outset #d3efab;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(#ffffff, #d8f5b3);
  font-size: 27px;
}

.nickname {
  font-size: 18px;
  font-weight: 800;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #376b21;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contacts-box {
  padding: 9px;
  overflow: auto;
}

.group-title {
  padding: 6px 8px;
  border: 1px solid #8dbb6a;
  border-radius: 7px;
  background: linear-gradient(#ffffff, #dcefc4);
  color: #1f5a15;
  font-weight: 800;
}

.contact-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.contact-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: center;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.contact-item.active,
.contact-item:hover {
  border-color: #7ab64d;
  background: linear-gradient(#ffffff, #e6f7ce);
}

.contact-name {
  display: block;
  font-weight: 700;
}

.contact-status {
  display: block;
  max-width: 210px;
  overflow: hidden;
  color: #4f7845;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-actions {
  display: flex;
  gap: 5px;
  margin-top: 4px;
}

.identity-box {
  padding: 9px;
  font-size: 12px;
  display: grid;
  gap: 6px;
}

.identity-line {
  word-break: break-all;
}

.chat-panel {
  margin: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-width: 0;
  overflow: hidden;
}

.chat-header {
  padding: 11px 13px;
  border-bottom: 2px groove #b3d685;
  background: linear-gradient(#faffee, #caef9e);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.relay-status {
  font-size: 12px;
  color: #376b21;
}

.message-history {
  padding: 14px;
  overflow: auto;
  background:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.86)),
    repeating-linear-gradient(0deg, #eef9dd 0, #eef9dd 22px, #f8ffe8 22px, #f8ffe8 44px);
}

.message-row {
  margin-bottom: 10px;
  line-height: 1.35;
}

.message-name {
  color: var(--mycq-red);
  font-weight: 800;
}

.message-time {
  color: #6c7e65;
  font-size: 11px;
}

.message-status {
  color: #6c7e65;
  font-size: 11px;
}

.composer-tools {
  border-top: 2px groove #b3d685;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: linear-gradient(#ffffff, #e8f8d3);
}

.smiley-button {
  width: 30px;
  height: 28px;
  border: 2px outset #c8d993;
  border-radius: 7px;
  background: linear-gradient(#fffbd0, #ffc94f);
  display: grid;
  place-items: center;
  font-size: 17px;
}

.composer {
  border-width: 0;
  border-radius: 0;
  border-top: 2px groove #b3d685;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  background: linear-gradient(#f8ffe8, #dff2c2);
}

.message-input {
  min-height: 64px;
  resize: vertical;
}

.flower {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
}

.flower::before,
.flower::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, #ffd94d 0 18%, transparent 19%),
    radial-gradient(circle at 50% 0%, #ffffff 0 24%, transparent 25%),
    radial-gradient(circle at 100% 50%, #71c94f 0 24%, transparent 25%),
    radial-gradient(circle at 50% 100%, #5aa8ff 0 24%, transparent 25%),
    radial-gradient(circle at 0% 50%, #ff6a6a 0 24%, transparent 25%);
}

.flower::after {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

.notice {
  border: 1px solid #e0c45b;
  border-radius: 8px;
  background: #fff8c8;
  padding: 9px;
  font-size: 13px;
}

.error {
  color: #a40000;
  font-weight: 700;
}

.auth-shell {
  width: min(960px, calc(100vw - 32px));
  min-height: min(620px, calc(100vh - 48px));
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 22px 70px rgba(31, 87, 41, 0.18);
  display: grid;
  grid-template-columns: 1fr minmax(320px, 420px);
  overflow: hidden;
}

.auth-hero {
  padding: 44px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 14px;
  background:
    radial-gradient(circle at 24% 22%, rgba(53, 195, 49, 0.24), transparent 14rem),
    linear-gradient(135deg, #efffe9, #f9fff7);
}

.auth-hero h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 74px);
  letter-spacing: -0.06em;
}

.auth-hero p {
  max-width: 420px;
  margin: 0;
  color: #607060;
  font-size: 17px;
  line-height: 1.5;
}

.auth-flower {
  width: 58px;
  height: 58px;
}

.auth-card {
  padding: 38px;
  align-content: center;
  background: #fff;
}

.auth-card h2 {
  margin: 0;
  font-size: 28px;
}

.auth-card .field input {
  border: 1px solid #e3ece3;
  border-radius: 12px;
  box-shadow: none;
  padding: 12px 13px;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 18px;
  background: rgba(23, 38, 23, 0.32);
  display: grid;
  place-items: center;
  backdrop-filter: blur(7px);
}

.settings-modal {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(31, 87, 41, 0.28);
  overflow: hidden;
}

.settings-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-header h2,
.settings-header p {
  margin: 0;
}

.settings-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.settings-body {
  padding: 18px 20px;
  display: grid;
  gap: 14px;
}

.settings-body .field input {
  border: 1px solid #e3ece3;
  border-radius: 12px;
  box-shadow: none;
  padding: 12px 13px;
}

.share-uin {
  min-height: 92px;
  border: 1px solid #e3ece3;
  border-radius: 12px;
  padding: 12px 13px;
  resize: vertical;
  word-break: break-all;
}

.settings-actions {
  padding: 16px 20px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    min-height: 100svh;
    padding: 0;
  }

  .mycq-window {
    min-height: 100svh;
    border-radius: 0;
  }

  .messenger-layout {
    grid-template-columns: 1fr;
  }

  .contacts-panel {
    border-right: 0;
    border-bottom: 2px groove #8dbb6a;
  }

  .chat-panel {
    min-height: 560px;
  }
}

/* Modern MyCQ-style shell */
:root {
  --surface: #ffffff;
  --surface-soft: #f7faf7;
  --surface-green: #eff9ea;
  --accent: #35c331;
  --accent-dark: #159925;
  --text: #202820;
  --muted: #8a968a;
  --line: #e7eee7;
  --bubble-in: #ffffff;
  --bubble-out: #dcf8cf;
  --soft-shadow: 0 22px 70px rgba(31, 87, 41, 0.18);
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
}

body {
  background:
    radial-gradient(circle at 8% 16%, rgba(113, 222, 60, 0.35), transparent 22rem),
    radial-gradient(circle at 96% 88%, rgba(118, 217, 255, 0.28), transparent 26rem),
    linear-gradient(135deg, #d9ffd4 0%, #f8fff5 45%, #dff6ff 100%);
  color: var(--text);
}

.app-shell {
  width: min(1140px, calc(100vw - 36px));
  padding: 24px 0;
}

.mycq-window {
  min-height: min(720px, calc(100vh - 48px));
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.messenger-layout {
  min-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  overflow: hidden;
}

.app-nav,
.nav-links,
.nav-link,
.search-box,
.chat-filters,
.filter-chip,
.round-action {
  display: none;
}

.app-nav {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 18px 14px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.brand-flower {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-link,
.icon-button,
.round-action,
.filter-chip,
.composer-icon,
.send-button {
  border: 0;
  background: transparent;
  color: inherit;
}

.nav-link {
  min-height: 42px;
  padding: 0 11px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #526052;
  text-align: left;
}

.nav-link.active,
.nav-link:hover {
  background: var(--surface-green);
  color: #16851f;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  background: #fff;
}

.profile-edit-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: #f3f7f3;
  color: #607060;
}

.profile-edit-button:hover {
  background: var(--surface-green);
  color: var(--accent-dark);
}

.mini-avatar,
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dff9d9, #ffffff);
  color: #159925;
  font-weight: 800;
}

.profile-name,
.contact-name {
  font-weight: 700;
}

.status.online {
  color: var(--accent-dark);
  font-size: 12px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #566156;
}

.icon-button:hover,
.round-action:hover,
.composer-icon:hover {
  background: var(--surface-green);
}

.contacts-panel {
  border-right: 1px solid var(--line);
  background: rgba(253, 255, 253, 0.94);
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
}

.contacts-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.search-box {
  height: 40px;
  border-radius: 10px;
  background: #f4f7f4;
  color: var(--muted);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-action,
.delete-contact-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 13px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.delete-contact-button {
  background: #f3f5f3;
  color: #b42b2b;
}

.mobile-back-button {
  display: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f3f7f3;
  color: #526052;
  font-size: 28px;
  line-height: 1;
}

.chat-filters {
  display: flex;
  gap: 8px;
  overflow: auto;
}

.filter-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f5f7f5;
  color: #607060;
  white-space: nowrap;
}

.filter-chip.active {
  background: #dcf7d7;
  color: var(--accent-dark);
}

.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
}

.contact-item {
  position: relative;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.contact-item.active,
.contact-item:hover {
  background: #eaf9e5;
}

.contact-main {
  min-width: 0;
}

.contact-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.contact-time,
.contact-presence,
.contact-preview,
.contact-status {
  color: var(--muted);
  font-size: 12px;
}

.contact-presence {
  color: var(--accent-dark);
  white-space: nowrap;
}

.contact-preview {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-actions {
  margin-top: 6px;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.identity-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  font-size: 11px;
}

.dev-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #f8faf9;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-header {
  min-height: 70px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 12px 18px;
}

.chat-identity,
.chat-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-title {
  margin: 0;
  font-size: 16px;
}

.relay-status {
  color: var(--accent-dark);
  font-size: 12px;
}

.message-history {
  padding: 24px 22px;
  background:
    linear-gradient(rgba(248, 250, 249, 0.92), rgba(248, 250, 249, 0.92)),
    radial-gradient(circle at 30% 20%, rgba(53, 195, 49, 0.06), transparent 18rem);
  overflow: auto;
}

.empty-state {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  margin: 0;
  color: #4d5c4d;
}

.empty-state p {
  max-width: 360px;
  margin: 0;
}

.big-flower {
  width: 42px;
  height: 42px;
}

.message-row {
  display: flex;
  margin: 0 0 12px;
}

.message-row.in {
  justify-content: flex-start;
}

.message-row.out {
  justify-content: flex-end;
}

.message-bubble {
  max-width: min(68%, 520px);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 9px 12px 7px;
  display: grid;
  gap: 4px;
  background: var(--bubble-in);
  box-shadow: 0 2px 8px rgba(31, 50, 31, 0.06);
}

.message-row.out .message-bubble {
  background: var(--bubble-out);
}

.message-name {
  color: #d02222;
  font-size: 13px;
  font-weight: 800;
}

.message-text {
  line-height: 1.35;
}

.message-meta {
  justify-self: end;
  color: #7f907f;
  font-size: 11px;
}

.composer {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 12px;
  padding: 8px;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.message-input {
  min-height: 34px;
  max-height: 120px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 4px;
  resize: none;
  background: transparent;
}

.composer-icon,
.send-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #8a968a;
}

.send-button {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.send-button:disabled {
  opacity: 0.45;
}

.classic-button {
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  padding: 7px 10px;
  font-weight: 700;
  text-shadow: none;
  box-shadow: none;
}

.classic-button.secondary {
  background: #edf3ed;
  color: #526052;
}

@media (max-width: 920px) {
  .app-shell {
    width: 100%;
    padding: 0;
  }

  .mycq-window,
  .messenger-layout {
    min-height: 100svh;
    border-radius: 0;
  }

  .messenger-layout {
    grid-template-columns: minmax(260px, 34vw) 1fr;
  }

  .brand strong,
  .profile-card > div:not(.mini-avatar) {
    display: block;
  }
}

@media (max-width: 700px) {
  .auth-shell {
    width: 100%;
    min-height: 100svh;
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .auth-hero {
    padding: 28px;
  }

  .auth-card {
    padding: 24px;
  }

  .messenger-layout {
    grid-template-columns: 1fr;
  }

  .messenger-layout.mobile-contacts .contacts-panel {
    display: grid;
    min-height: 100svh;
  }

  .messenger-layout.mobile-contacts .chat-panel {
    display: none;
  }

  .messenger-layout.mobile-chat .contacts-panel {
    display: none;
  }

  .messenger-layout.mobile-chat .chat-panel {
    display: grid;
    min-height: 100svh;
  }

  .mobile-back-button {
    display: grid;
    place-items: center;
  }

  .chat-header {
    min-height: 62px;
    padding: 10px 12px;
  }

  .chat-actions {
    gap: 6px;
  }

  .delete-contact-button {
    padding: 8px 10px;
    font-size: 12px;
  }

  .contacts-panel {
    border-right: 0;
    padding: 14px;
  }

  .identity-box {
    max-height: 160px;
    overflow: auto;
  }

  .message-history {
    padding: 16px 12px;
  }

  .message-bubble {
    max-width: 86%;
  }

  .composer {
    margin: 8px;
    border-radius: 14px;
  }
}
