﻿:root {
  --bg-start: #09111f;
  --bg-end: #111f38;
  --card: rgba(11, 20, 36, 0.8);
  --border: rgba(255, 255, 255, 0.08);
  --card-soft: rgba(255, 255, 255, 0.07);
  --text-main: #f5f7fb;
  --text-soft: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #7dd3fc;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; min-height: 100vh; overflow: hidden; font-family: "Manrope", "Noto Sans SC", "Noto Sans JP", sans-serif; color: var(--text-main); background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 28%), radial-gradient(circle at bottom right, rgba(249, 115, 22, 0.2), transparent 24%), linear-gradient(135deg, var(--bg-start), var(--bg-end)); }
button, textarea, input { font: inherit; }
.page-shell { position: relative; height: 100vh; height: 100dvh; padding: 24px; overflow: hidden; }
.ambient { position: absolute; border-radius: 999px; filter: blur(24px); opacity: 0.5; }
.ambient-one { top: 12%; left: -60px; width: 180px; height: 180px; background: rgba(56, 189, 248, 0.25); }
.ambient-two { right: -40px; bottom: 8%; width: 220px; height: 220px; background: rgba(249, 115, 22, 0.18); }
.topbar { position: absolute; top: 24px; right: 24px; z-index: 5; }
.language-picker { position: relative; min-width: 168px; padding: 10px; border-radius: 24px; background: linear-gradient(180deg, rgba(17, 29, 51, 0.88), rgba(8, 17, 31, 0.84)); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06); backdrop-filter: blur(18px); }
.language-picker::after { content: ""; position: absolute; inset: 1px; border-radius: 23px; pointer-events: none; background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 42%); }
.language-trigger { position: relative; z-index: 1; width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid rgba(56, 189, 248, 0.22); border-radius: 18px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)); color: var(--text-main); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.language-trigger:hover { border-color: rgba(125, 211, 252, 0.38); background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06)); }
.language-trigger-label { color: var(--text-soft); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; }
.language-current { margin-left: auto; font-weight: 600; }
.language-trigger-arrow { width: 10px; height: 10px; border-right: 2px solid rgba(125, 211, 252, 0.85); border-bottom: 2px solid rgba(125, 211, 252, 0.85); transform: rotate(45deg) translateY(-2px); transition: transform 0.18s ease; }
.language-picker.open .language-trigger-arrow { transform: rotate(225deg) translateY(-1px); }
.language-menu { position: absolute; top: calc(100% + 10px); right: 0; z-index: 6; width: 100%; padding: 8px; border-radius: 20px; background: linear-gradient(180deg, rgba(17, 29, 51, 0.95), rgba(8, 17, 31, 0.92)); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 22px 40px rgba(0, 0, 0, 0.34); backdrop-filter: blur(18px); }
.language-menu.hidden { display: none; }
.language-option { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--text-main); cursor: pointer; text-align: left; }
.language-option:hover { background: rgba(255, 255, 255, 0.07); }
.language-option.active { background: rgba(56, 189, 248, 0.14); border-color: rgba(56, 189, 248, 0.22); }
.language-option.active::after { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--accent-strong); box-shadow: 0 0 12px rgba(125, 211, 252, 0.5); }
.app-card { position: relative; z-index: 1; display: grid; grid-template-columns: 320px 1fr; gap: 20px; height: calc(100vh - 48px); height: calc(100dvh - 48px); padding-top: 56px; min-height: 0; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.sidebar, .chat-area { display: flex; flex-direction: column; gap: 20px; min-height: 0; }
.current-user-panel, .chat-header, .message-form { display: flex; align-items: center; justify-content: space-between; padding: 24px; }
.user-list-panel { display: flex; flex-direction: column; padding: 24px; flex: 1; min-height: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.online-toggle { width: 100%; padding: 0; border: none; background: none; color: inherit; text-align: left; cursor: pointer; }
.online-toggle.panel-header { margin-bottom: 0; }
.online-toggle-side { display: flex; align-items: center; gap: 10px; }
.online-toggle-arrow { display: none; width: 10px; height: 10px; border-right: 2px solid rgba(125, 211, 252, 0.88); border-bottom: 2px solid rgba(125, 211, 252, 0.88); transform: rotate(45deg) translateY(-1px); transition: transform 0.18s ease; }
.user-list-body { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 16px; }
.online-drawer { position: fixed; inset: 0; z-index: 9; display: grid; place-items: end center; padding: 18px 12px 12px; }
.online-drawer.hidden { display: none; }
.online-drawer-backdrop { position: absolute; inset: 0; border: none; background: rgba(2, 8, 23, 0.56); backdrop-filter: blur(10px); opacity: 0; transition: opacity 0.2s ease; }
.online-drawer-panel { position: relative; z-index: 1; width: min(100%, 480px); max-height: min(74vh, 620px); padding: 18px; border-radius: 28px; display: flex; flex-direction: column; gap: 14px; opacity: 0; transform: translateY(10px) scale(0.98); transform-origin: top right; transition: opacity 0.2s ease, transform 0.2s ease; }
.online-drawer.open .online-drawer-backdrop { opacity: 1; }
.online-drawer.open .online-drawer-panel { opacity: 1; transform: translateY(0) scale(1); }
.online-drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.online-drawer-header-side { display: flex; align-items: center; gap: 10px; }
.online-drawer-close { width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 999px; background: rgba(255, 255, 255, 0.06); color: var(--text-main); cursor: pointer; }
.online-drawer-close:hover { transform: translateY(-1px); }
.mobile-user-list { min-height: 0; max-height: none; padding-right: 4px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-soft); }
.panel-subtle { margin: 10px 0 0; color: var(--text-soft); font-size: 13px; line-height: 1.5; }
h1, h2 { margin: 0; }
.count-badge, .chat-mode-pill { padding: 8px 12px; border-radius: 999px; background: rgba(56, 189, 248, 0.12); color: #d8f3ff; border: 1px solid rgba(56, 189, 248, 0.18); font-size: 13px; }
.user-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.user-list,
.message-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 211, 252, 0.5) rgba(255, 255, 255, 0.05);
}
.user-list::-webkit-scrollbar,
.message-list::-webkit-scrollbar {
  width: 10px;
}
.user-list::-webkit-scrollbar-track,
.message-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}
.user-list::-webkit-scrollbar-thumb,
.message-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.75), rgba(56, 189, 248, 0.45));
  border-radius: 999px;
  border: 2px solid rgba(7, 15, 29, 0.35);
}
.user-list::-webkit-scrollbar-thumb:hover,
.message-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(186, 230, 253, 0.88), rgba(56, 189, 248, 0.68));
}
.user-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 16px; border: 1px solid transparent; border-radius: var(--radius-md); background: var(--card-soft); color: var(--text-main); cursor: pointer; transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
.user-item:hover { transform: translateY(-1px); border-color: rgba(56, 189, 248, 0.3); }
.user-item.current-user { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.35); }
.user-item.active-private { background: rgba(249, 115, 22, 0.16); border-color: rgba(249, 115, 22, 0.4); }
.user-badge { font-size: 12px; padding: 4px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--text-soft); }
.chat-area { min-width: 0; min-height: 0; }
.message-list { flex: 1; min-height: 0; padding: 24px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; }
.message-item { width: fit-content; max-width: min(82%, 720px); padding: 16px 18px; border-radius: 22px 22px 22px 10px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.06)); border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); animation: slide-in 0.2s ease; }
.message-item.own { align-self: flex-end; border-radius: 22px 22px 10px 22px; background: linear-gradient(135deg, rgba(56, 189, 248, 0.24), rgba(37, 99, 235, 0.3)); border-color: rgba(125, 211, 252, 0.24); box-shadow: 0 10px 24px rgba(14, 116, 144, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.message-item.system { align-self: center; width: auto; max-width: 100%; text-align: center; color: #d2e8f8; background: rgba(249, 115, 22, 0.16); border-color: rgba(249, 115, 22, 0.18); }
.message-item.private { border-color: rgba(249, 115, 22, 0.35); box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.12), 0 10px 24px rgba(249, 115, 22, 0.08); }
.message-meta { display: flex; gap: 10px; align-items: center; justify-content: flex-start; margin-bottom: 8px; color: rgba(226, 232, 240, 0.68); font-size: 12px; flex-wrap: wrap; }
.message-item.own .message-meta { color: rgba(232, 248, 255, 0.74); }
.message-content { margin: 0; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.private-banner { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-radius: var(--radius-md); background: rgba(249, 115, 22, 0.15); border: 1px solid rgba(249, 115, 22, 0.22); }
.private-banner.hidden { display: none; }
.message-form { gap: 16px; flex-shrink: 0; }
.composer-shell { position: relative; display: flex; align-items: flex-end; gap: 12px; width: 100%; }
.emoji-picker { position: relative; flex: 0 0 auto; }
.emoji-trigger { width: 52px; height: 52px; border: 1px solid rgba(56, 189, 248, 0.18); border-radius: 18px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04)); color: var(--text-main); font-size: 24px; line-height: 1; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.emoji-trigger:hover { border-color: rgba(125, 211, 252, 0.34); }
.emoji-menu { position: absolute; left: 0; bottom: calc(100% + 12px); z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 276px; padding: 12px; border-radius: 20px; background: linear-gradient(180deg, rgba(17, 29, 51, 0.95), rgba(8, 17, 31, 0.92)); border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 22px 40px rgba(0, 0, 0, 0.34); backdrop-filter: blur(18px); }
.emoji-menu.hidden { display: none; }
.emoji-option { width: 44px; height: 44px; border: 1px solid transparent; border-radius: 14px; background: rgba(255, 255, 255, 0.04); color: var(--text-main); font-size: 22px; cursor: pointer; }
.emoji-option:hover { border-color: rgba(56, 189, 248, 0.22); background: rgba(56, 189, 248, 0.12); }
.message-form textarea { width: 100%; resize: none; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-lg); background: rgba(1, 7, 17, 0.4); color: var(--text-main); padding: 16px 18px; outline: none; }
.message-form textarea:focus, .login-card input:focus { border-color: rgba(56, 189, 248, 0.4); box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.08); }
.primary-btn, .secondary-btn, .private-banner button { border: none; border-radius: 999px; cursor: pointer; transition: transform 0.18s ease, opacity 0.18s ease; }
.primary-btn:hover, .secondary-btn:hover, .private-banner button:hover { transform: translateY(-1px); }
.primary-btn { padding: 14px 20px; background: linear-gradient(135deg, var(--accent), #2563eb); color: white; font-weight: 700; }
.secondary-btn, .private-banner button { padding: 11px 16px; background: rgba(255, 255, 255, 0.09); color: var(--text-main); }
.login-overlay { position: fixed; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; background: rgba(2, 8, 23, 0.5); backdrop-filter: blur(10px); }
.login-overlay.hidden { display: none; }
.login-card { width: min(100%, 440px); padding: 32px; border-radius: 32px; background: rgba(17, 29, 51, 0.92); border: 1px solid var(--border); box-shadow: var(--shadow); }
.auth-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0 20px; padding: 6px; border-radius: 18px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.06); }
.auth-mode-btn { padding: 11px 14px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--text-soft); cursor: pointer; transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease; }
.auth-mode-btn.active { background: rgba(56, 189, 248, 0.14); border-color: rgba(56, 189, 248, 0.2); color: var(--text-main); }
.login-copy { color: var(--text-soft); line-height: 1.6; }
.login-card input { width: 100%; margin: 12px 0; padding: 15px 16px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(3, 12, 24, 0.8); color: var(--text-main); outline: none; }
.login-hint { margin: 0 0 12px; color: var(--text-soft); font-size: 13px; line-height: 1.5; }
.form-error { min-height: 22px; margin: 0 0 12px; color: #fda4af; }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 960px) {
  .app-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 16px;
    padding-top: 74px;
  }

  .chat-area {
    grid-row: 2;
    gap: 16px;
    min-height: 0;
  }

  .sidebar {
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .current-user-panel,
  .user-list-panel {
    min-height: 0;
  }

  .user-list-panel {
    flex: 0 0 auto;
  }

  .chat-header,
  .current-user-panel,
  .message-form,
  .user-list-panel,
  .message-list {
    padding: 18px 20px;
  }

  .message-list {
    min-height: clamp(260px, 44vh, 460px);
  }

  .message-item {
    max-width: min(88%, 680px);
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 12px;
  }

  .topbar {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .language-picker {
    min-width: 0;
    width: 100%;
    padding: 8px;
  }

  .app-card {
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    gap: 12px;
    padding-top: 84px;
  }

  .chat-area {
    gap: 12px;
  }

  .sidebar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
  }

  .chat-header,
  .current-user-panel,
  .message-form,
  .user-list-panel {
    padding: 14px 16px;
    border-radius: 24px;
  }

  .chat-header {
    gap: 10px;
    align-items: flex-start;
  }

  .chat-header .eyebrow,
  .user-list-panel .eyebrow,
  .current-user-panel .eyebrow {
    margin-bottom: 4px;
    font-size: 11px;
  }

  .chat-header h2,
  .user-list-panel h2 {
    font-size: 1.05rem;
    line-height: 1.25;
  }

  #current-user-name {
    font-size: 1.45rem;
    line-height: 1.05;
  }

  .chat-mode-pill,
  .count-badge {
    padding: 6px 10px;
    font-size: 12px;
  }

  .panel-header {
    margin-bottom: 10px;
  }

  .panel-subtle {
    margin-top: 6px;
    font-size: 12px;
  }

  .current-user-panel {
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 136px;
  }

  .current-user-panel > div {
    min-width: 0;
  }

  .current-user-panel .secondary-btn {
    align-self: flex-start;
    padding: 9px 14px;
  }

  .user-list-panel {
    min-height: 136px;
    justify-content: center;
  }

  .online-toggle {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 100%;
  }

  .online-toggle-arrow {
    display: block;
  }

  .user-list-panel {
    max-height: none;
  }

  .user-list-body {
    display: none;
  }

  .online-toggle-arrow {
    transform: rotate(45deg) translateY(-1px);
  }

  .online-drawer-panel {
    width: calc(100vw - 24px);
    max-height: min(78vh, 560px);
    padding: 16px;
    border-radius: 26px;
    transform-origin: top right;
  }

  .mobile-user-list {
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .user-item {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
  }

  .message-list {
    min-height: clamp(280px, 48vh, 520px);
    padding: 14px;
    gap: 10px;
    border-radius: 24px;
  }

  .message-item {
    max-width: min(90%, 320px);
    padding: 13px 14px;
    border-radius: 20px 20px 20px 10px;
  }

  .message-item.own {
    border-radius: 20px 20px 10px 20px;
  }

  .message-item.system {
    max-width: min(76%, 260px);
    padding: 10px 12px;
    border-radius: 18px;
  }

  .message-item.system .message-meta {
    justify-content: center;
    margin-bottom: 6px;
    gap: 8px;
    font-size: 11px;
  }

  .message-item.system .message-content {
    font-size: 13px;
    line-height: 1.45;
  }

  .message-meta {
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
  }

  .private-banner {
    padding: 11px 14px;
    border-radius: 18px;
    gap: 10px;
  }

  .message-form {
    gap: 12px;
    align-items: flex-end;
  }

  .composer-shell {
    gap: 10px;
    align-items: flex-end;
  }

  .emoji-trigger {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    font-size: 20px;
  }

  .emoji-menu {
    left: 0;
    width: min(236px, calc(100vw - 40px));
    padding: 10px;
    border-radius: 18px;
  }

  .message-form textarea {
    min-height: 92px;
    padding: 14px 15px;
    border-radius: 18px;
  }

  .message-form .primary-btn {
    flex: 0 0 auto;
    min-width: 108px;
    padding: 12px 18px;
  }
}















@media (max-width: 640px) {
  .page-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.03fr) minmax(0, 0.97fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 12px;
    align-content: stretch;
  }

  .topbar {
    position: static;
    grid-column: 2;
    grid-row: 1;
    z-index: 2;
  }

  .app-card,
  .sidebar {
    display: contents;
  }

  .language-picker {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 8px;
    border-radius: 24px;
  }

  .language-trigger {
    min-height: 68px;
    padding: 12px;
    border-radius: 16px;
  }

  .language-trigger-label {
    font-size: 11px;
  }

  .current-user-panel {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-height: 148px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
  }

  .current-user-panel > div {
    min-width: 0;
    width: 100%;
  }

  .current-user-panel .secondary-btn {
    align-self: flex-start;
  }

  .user-list-panel {
    grid-column: 2;
    grid-row: 2;
    min-height: 68px;
    padding: 14px 16px;
    display: flex;
    align-items: stretch;
    justify-content: center;
  }

  .online-toggle {
    min-height: 100%;
    align-items: center;
  }

  .online-toggle > div {
    min-width: 0;
  }

  .user-list-body {
    display: none;
  }

  .chat-area {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 0;
    gap: 12px;
  }

  .chat-header,
  .message-form,
  .message-list,
  .private-banner {
    width: 100%;
  }

  .message-list {
    min-height: 0;
  }
}


@media (prefers-reduced-motion: reduce) {
  .online-drawer-backdrop,
  .online-drawer-panel {
    transition-duration: 0.01ms;
  }
}

