/* ================================================================
   ChatJu — theme overlay on Tabler v1.4.0
   ================================================================ */

/* ---- ChatJu design tokens ---- */
:root {
  /* night sea */
  --bg-night:       #1a2840;
  --bg-night-soft:  #1f3050;

  /* warm cream surfaces */
  --surface:        #faf7f1;
  --surface-card:   #fefdfb;
  --surface-white:  #ffffff;

  /* text */
  --text:           #2d2418;
  --text-dim:       #8c8070;
  --text-soft:      #b0a595;

  /* borders */
  --border:         #e0d8cc;
  --border-light:   #ede6da;

  /* sea blue accent */
  --accent:         #5b8fb4;
  --accent-hv:      #4a7d9e;
  --accent-soft:    rgba(91, 143, 180, 0.08);
  --accent-glow:    rgba(91, 143, 180, 0.15);

  /* warm lamp yellow */
  --warm:           #e0b85c;
  --warm-hv:        #cf9f3e;
  --warm-soft:      rgba(224, 184, 92, 0.10);
  --warm-glow:      rgba(224, 184, 92, 0.18);

  /* message bubbles */
  --bubble-me:      #eaf2f7;
  --bubble-other:   #ffffff;

  /* semantic */
  --success:        #6b9e7a;
  --success-soft:   rgba(107, 158, 122, 0.12);
  --danger:         #c96b5a;
  --danger-hv:      #b05a4a;
  --danger-soft:    rgba(201, 107, 90, 0.10);
  --warning:        #d4a84b;
  --warning-soft:   rgba(212, 168, 75, 0.12);

  /* radii */
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;

  /* shadows */
  --shadow-sm:      0 1px 3px rgba(20, 28, 44, 0.06);
  --shadow-md:      0 2px 8px rgba(20, 28, 44, 0.08);
  --shadow-lg:      0 4px 24px rgba(20, 28, 44, 0.12);
}

/* ---- override Tabler base to ChatJu theme ---- */
:root {
  --tblr-body-bg:               var(--surface);
  --tblr-body-color:            var(--text);
  --tblr-body-color-rgb:        45, 36, 24;
  --tblr-muted:                 var(--text-dim);
  --tblr-border-color:          var(--border);
  --tblr-border-radius:         var(--radius);
  --tblr-font-size-base:        0.9375rem;
  --tblr-link-color:            var(--accent);
  --tblr-primary:               var(--accent);
  --tblr-primary-rgb:           91, 143, 180;
  --tblr-secondary:             var(--text-dim);
  --tblr-success:               var(--success);
  --tblr-warning:               var(--warning);
  --tblr-danger:                var(--danger);
  --tblr-card-bg:               var(--surface-card);
  --tblr-card-border-color:     var(--border-light);
  --tblr-badge-font-size:       0.6875rem;
}

/* ---- global base fixes ---- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  font-size: 15px;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 238, 194, 0.34), transparent 26%),
    linear-gradient(180deg, #f3f8fb 0%, #eaf2f7 38%, #edf3f6 68%, #f7f7f3 100%);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}

body {
  display: flex;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

#app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(247, 251, 253, 0.98), rgba(236, 244, 248, 0.96) 34%, rgba(248, 248, 243, 0.98) 100%);
}

/* ---- screens ---- */
.screen { display: flex; flex-direction: column; height: 100%; }
.screen.hidden { display: none !important; }

/* ---- reset a, h1-h6 heading margins from Tabler ---- */
h1, h2, h3, h4, h5, h6 { margin: 0; }
a { color: inherit; text-decoration: none; }

/* ================================================================
   Auth screen
   ================================================================ */
#auth-screen {
  position: relative;
  overflow: hidden;
  padding: 16px;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 237, 188, 0.22), transparent 18%),
    radial-gradient(circle at 18% 22%, rgba(91, 143, 180, 0.14), transparent 24%),
    linear-gradient(180deg, #2b4059 0%, #355371 34%, #426781 58%, #6b8797 84%, #e9f0f3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

#auth-screen::before,
#auth-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#auth-screen::before {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 240, 202, 0.28), transparent 14%),
    radial-gradient(circle at 78% 72%, rgba(154, 194, 219, 0.12), transparent 20%);
}

#auth-screen::after {
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 112%, rgba(246, 248, 243, 0.7), rgba(246, 248, 243, 0) 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(236, 244, 248, 0.08) 58%, rgba(244, 247, 243, 0.2) 100%);
  opacity: 0.85;
}

.auth-card {
  position: relative;
  margin: auto;
  box-sizing: border-box;
  width: 100%;
  max-width: 380px;
  padding: 36px 28px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 251, 253, 0.94));
  box-shadow: 0 22px 48px rgba(20, 44, 68, 0.18);
  border: 1px solid rgba(208, 218, 226, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 50% 0, rgba(255, 237, 188, 0.16), transparent 34%);
}

.logo {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #a36f18;
  margin-bottom: 4px;
}

.subtitle {
  text-align: center;
  font-size: 13px;
  color: #394d5c;
  margin-bottom: 24px;
}

/* ---- tabs ---- */
#auth-screen .tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid #cdd7df;
  background: rgba(245, 248, 250, 0.92);
}

#auth-screen .tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #41576a;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

#auth-screen .tab.active {
  background: #5b8fb4;
  color: #fff;
}

/* ---- forms ---- */
.form { display: flex; flex-direction: column; gap: 10px; }
.form.hidden { display: none; }

#auth-screen .form input {
  padding: 10px 12px;
  border: 1px solid #cfd8df;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  outline: none;
  font-family: inherit;
}

#auth-screen .form input::placeholder,
#auth-screen .captcha-input::placeholder {
  color: #7a8794;
  opacity: 1;
}

#auth-screen .form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent-hv); }

#auth-screen .btn-primary {
  background: #3f7598;
  box-shadow: 0 6px 16px rgba(63, 117, 152, 0.22);
  transition: background 0.15s, box-shadow 0.15s;
}

#auth-screen .btn-primary:hover {
  background: #346684;
  box-shadow: 0 8px 18px rgba(63, 117, 152, 0.26);
}

.btn-sm {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-white);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-dim);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--text); }

/* ---- error ---- */
.msg-error {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.msg-error.hidden { display: none; }

/* ---- captcha ---- */
#auth-screen .captcha-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#auth-screen .captcha-question-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#auth-screen .captcha-question {
  font-size: 14px;
  font-weight: 500;
  color: #233746;
}

#auth-screen .captcha-input {
  padding: 10px 12px;
  border: 1px solid #cfd8df;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  outline: none;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

#auth-screen .captcha-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#auth-screen .captcha-refresh-btn {
  font-size: 12px;
  flex-shrink: 0;
  color: #3f5668;
}

/* ---- header — subtle glass ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background:
    linear-gradient(180deg, rgba(252, 254, 255, 0.94), rgba(244, 249, 252, 0.9));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(135, 165, 188, 0.18);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.logo-sm { font-size: 16px; font-weight: 700; color: var(--warm); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-tag {
  font-size: 13px;
  color: #667c8f;
}

/* ---- messages ---- */
#messages-box {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

#messages-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

#messages-list .empty-hint {
  align-self: center;
  width: 100%;
}

/* ---- bubbles — solid, no glass ---- */
.bubble-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 75%;
}

.bubble-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.bubble-sender {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 2px;
  padding: 0 4px;
}

.bubble-body {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}

.bubble-row.mine .bubble-body {
  background: var(--bubble-me);
  border: 1px solid rgba(91, 143, 180, 0.12);
  border-bottom-right-radius: 6px;
}

.bubble-row:not(.mine) .bubble-body {
  background: var(--bubble-other);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 6px;
}

.bubble-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  padding: 0 4px;
}

/* ---- bubble sender name ---- */
.bubble-sender-name {
  font-weight: 500;
}

/* ---- bubble sender time ---- */
.bubble-sender-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---- composer ---- */
.composer {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.composer input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  font-family: inherit;
}

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-send {
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  background: var(--warm);
  color: #2d2418;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-send:hover { background: var(--warm-hv); }

/* ---- home ---- */
.home-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  isolation: isolate;
  padding: 28px 16px 32px;
  background:
    radial-gradient(circle at top center, rgba(224, 184, 92, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(236, 245, 250, 0.96) 0%, rgba(231, 241, 248, 0.92) 22%, rgba(226, 237, 244, 0.88) 48%, rgba(235, 242, 246, 0.9) 72%, rgba(244, 246, 243, 0.93) 100%);
}

.home-content::before,
.home-content::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.home-content::before {
  background:
    radial-gradient(circle at 50% 5%, rgba(255, 241, 201, 0.54), transparent 16%),
    radial-gradient(circle at 16% 16%, rgba(91, 143, 180, 0.1), transparent 20%);
  opacity: 0.82;
}

.home-content::after {
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 106%, rgba(246, 248, 243, 0.54), rgba(246, 248, 243, 0) 40%),
    linear-gradient(180deg, rgba(110, 158, 190, 0), rgba(110, 158, 190, 0.03) 42%, rgba(87, 130, 162, 0.05) 100%);
  opacity: 0.5;
}

.home-content > * {
  position: relative;
  z-index: 1;
}

.home-hero {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 18px;
  padding: 22px 22px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(248, 252, 255, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: 0 14px 34px rgba(45, 86, 116, 0.07);
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 50%;
  width: 180px;
  height: 180px;
  transform: translate(-50%, -64%);
  background: radial-gradient(circle, rgba(255, 236, 182, 0.42), rgba(255, 236, 182, 0));
  pointer-events: none;
}

.home-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(91, 143, 180, 0.12);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #59748a;
}

.home-logo {
  font-size: 30px;
  font-weight: 700;
  color: var(--warm);
  margin-bottom: 8px;
  position: relative;
}

.home-subtitle {
  font-size: 15px;
  line-height: 1.65;
  color: #5d6f7f;
  max-width: 24em;
  margin: 0 auto;
}

/* ---- avatar picker ---- */
.avatar-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto 18px;
  padding: 14px 16px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow: 0 10px 26px rgba(45, 86, 116, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.avatar-current {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-current-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--border-light);
}

.avatar-current-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.avatar-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 400px;
}

.avatar-option {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.avatar-option:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.avatar-option.active {
  border-color: var(--warm);
  box-shadow: 0 0 0 3px var(--warm-glow);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
}

.feature-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  min-height: 108px;
  padding: 16px 14px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 252, 254, 0.9));
  box-shadow: 0 10px 22px rgba(45, 86, 116, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.72);
  cursor: default;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.feature-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(91, 143, 180, 0), rgba(91, 143, 180, 0.24), rgba(91, 143, 180, 0));
  pointer-events: none;
}

.feature-card.active {
  cursor: pointer;
}

.feature-card.active:hover,
.feature-card-link:hover {
  border-color: var(--accent);
  box-shadow: 0 14px 28px rgba(45, 86, 116, 0.12);
  transform: translateY(-1px);
}

.feature-card.disabled {
  opacity: 0.72;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(247, 249, 251, 0.82));
}

.feature-card.hidden { display: none; }

.feature-card-link {
  cursor: pointer;
}

.feature-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.feature-card .card-hint {
  font-size: 12px;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}

.card-domain {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #6b8598;
  position: relative;
  z-index: 1;
}

.card-poem {
  font-size: 12px;
  line-height: 1.55;
  color: #66798a;
  position: relative;
  z-index: 1;
}

.blog-card {
  border-color: rgba(224, 184, 92, 0.22);
  background:
    radial-gradient(circle at 88% 22%, rgba(255, 238, 194, 0.8), rgba(255, 238, 194, 0) 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 255, 0.9));
}

.blog-card::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 217, 121, 0.8);
  box-shadow: 0 0 0 5px rgba(255, 217, 121, 0.1), 0 0 16px rgba(255, 217, 121, 0.2);
  pointer-events: none;
}

.blog-card .card-title {
  color: #315a77;
}

#home-screen .announcement-banner {
  max-width: 680px;
  margin: 0 auto 16px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 22px rgba(45, 86, 116, 0.075);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#home-screen .announcement-item {
  border-radius: 10px;
}

#home-screen .announcement-global {
  background: rgba(224, 184, 92, 0.16);
  border-left-color: rgba(207, 159, 62, 0.92);
}

#home-screen .announcement-room {
  background: rgba(91, 143, 180, 0.12);
  border-left-color: rgba(74, 125, 158, 0.92);
}

#home-screen .scope-global {
  background: rgba(224, 184, 92, 0.24);
  color: #8c6c23;
}

#home-screen .scope-room {
  background: rgba(91, 143, 180, 0.2);
  color: #355f7d;
}

#rooms-screen,
#chat-screen {
  background: linear-gradient(180deg, #f8faf9 0%, #f4f6f4 100%);
}

#rooms-screen .header,
#chat-screen .header {
  background: linear-gradient(180deg, rgba(253, 254, 254, 0.96), rgba(247, 249, 248, 0.94));
  border-bottom-color: transparent;
  box-shadow: none;
}

#rooms-screen .rooms-content,
#chat-screen #messages-box {
  background: #f8f7f2;
}

#rooms-screen .announcement-banner,
#chat-screen .announcement-banner {
  padding: 8px 14px;
  background: rgba(249, 249, 245, 0.76);
  border-bottom: none;
  box-shadow: none;
}

#chat-announcements:not(.hidden) + #messages-box {
  border-top: 1px solid rgba(210, 216, 210, 0.9);
}

#rooms-screen .announcement-item,
#chat-screen .announcement-item {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

#rooms-screen .announcement-global,
#rooms-screen .announcement-room,
#chat-screen .announcement-global,
#chat-screen .announcement-room {
  order: 0;
}

#home-screen .announcement-global,
#rooms-screen .announcement-global,
#chat-screen .announcement-global {
  order: 1;
}

#home-screen .announcement-room,
#rooms-screen .announcement-room,
#chat-screen .announcement-room {
  order: 2;
}

#rooms-screen .announcement-global,
#chat-screen .announcement-global {
  background: rgba(224, 184, 92, 0.08);
  border-left-color: rgba(207, 159, 62, 0.52);
}

#rooms-screen .announcement-room,
#chat-screen .announcement-room {
  background: rgba(91, 143, 180, 0.08);
  border-left-color: rgba(74, 125, 158, 0.58);
}

#rooms-screen .scope-global,
#chat-screen .scope-global {
  background: rgba(224, 184, 92, 0.14);
  color: #92722b;
}

#rooms-screen .scope-room,
#chat-screen .scope-room {
  background: rgba(91, 143, 180, 0.14);
  color: #3d6b89;
}

/* ---- rooms ---- */
.rooms-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
}

.rooms-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.room-card {
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface-card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  margin-bottom: 10px;
}

.room-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.room-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.room-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  line-height: 1.4;
}

.room-card-count {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

/* ---- room badge ---- */
.room-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
}

/* ================================================================
   Admin — Tabler-enhanced, non-structural
   ================================================================ */
.admin-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

/* admin tabs — underline style with Tabler badge pattern */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.admin-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.admin-tab:hover { color: var(--text); }

.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.admin-tab-panel.hidden { display: none; }

/* admin section — card pattern */
.admin-section {
  background: var(--surface-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.admin-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.btn-refresh {
  font-size: 12px;
  padding: 3px 10px;
}

.empty-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px 0;
}

/* list scroll constraints */
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 100%;
}

.visible-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 100%;
}

.invite-list, .term-list, #admin-rooms-list, #admin-room-members-list, #admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 40vh;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 100%;
}

/* ---- admin list items ---- */
.pending-item,
.visible-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.pending-meta,
.visible-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.pending-content,
.visible-content {
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
  word-break: break-word;
}

.pending-matched {
  font-size: 12px;
  color: var(--danger);
  margin-bottom: 8px;
}

.pending-actions,
.visible-actions {
  display: flex;
  gap: 8px;
}

/* ---- admin action buttons ---- */
.btn-approve {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  background: var(--success);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.btn-approve:hover { background: #5d8f5d; }

.btn-delete {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.btn-delete:hover { background: var(--danger-hv); }

.btn-delete-sm {
  padding: 3px 10px;
  border: none;
  border-radius: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.btn-delete-sm:hover { background: var(--danger-hv); }

/* ---- admin forms ---- */
.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.inline-form input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  min-width: 0;
}

.inline-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.inline-form .btn-primary {
  flex-shrink: 0;
}

.inline-form-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-form-col input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  font-family: inherit;
}

.inline-form-col input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.inline-form-col .btn-primary {
  width: 100%;
}

/* ---- result & batch ---- */
.invite-result {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}
.invite-result.hidden { display: none; }

.batch-terms-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.batch-terms-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.batch-result {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 14px;
  font-weight: 500;
}
.batch-result.hidden { display: none; }

/* ---- invite & term items ---- */
.invite-item, .term-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
}

.invite-item .code {
  font-family: monospace;
  font-weight: 600;
  color: var(--text);
}

.invite-item .meta {
  color: var(--text-dim);
  font-size: 12px;
}

.term-item .term-text {
  font-weight: 500;
  color: var(--danger);
}

/* ---- admin room management ---- */
.admin-room-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 6px;
}

.admin-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.admin-room-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.status-active {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 500;
}

.status-inactive {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 500;
}

.admin-room-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.admin-room-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.admin-room-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-edit-room, .btn-toggle-room, .btn-members-room {
  font-size: 12px;
  padding: 3px 10px;
}

/* ---- member management ---- */
#member-user-select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

#member-user-select:focus {
  border-color: var(--accent);
}

.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 4px;
}

.member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.member-role {
  font-size: 11px;
  color: var(--text-dim);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-white);
}

.btn-remove-member {
  font-size: 11px;
  padding: 2px 8px;
}

/* ---- admin user list — list-like row layout, non-structural ---- */
.user-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 4px;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

.user-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.user-item-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.user-item-id {
  font-size: 11px;
  color: var(--text-dim);
  font-family: monospace;
  width: 44px;
  flex-shrink: 0;
}

.user-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 120px;
}

.user-item-role {
  font-size: 11px;
  color: var(--accent);
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  font-weight: 500;
}

.user-item-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
  flex-shrink: 0;
}

.user-item-note-edit {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  margin-top: 4px;
}

.user-item-note-edit.hidden { display: none; }
.user-item-note.hidden { display: none; }

.note-edit-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  font-family: inherit;
}

.note-edit-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.user-note-text {
  color: var(--text);
  font-style: italic;
}

.user-note-empty {
  color: var(--text-dim);
  font-size: 12px;
}

.btn-edit-note {
  font-size: 12px;
  padding: 3px 10px;
  align-self: flex-start;
  margin-top: 4px;
}

.btn-save-note {
  font-size: 12px;
  padding: 3px 10px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.btn-save-note:hover { background: #5d8f5d; }

/* ---- Phase 5C: user status badge ---- */
.user-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
}

.status-muted {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-banned {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---- Phase 5C: user status action buttons ---- */
.user-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-status-mute,
.btn-status-ban,
.btn-status-active {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.btn-status-mute {
  background: var(--warning-soft);
  color: var(--warning);
}
.btn-status-mute:hover {
  background: var(--warning);
  color: #fff;
}

.btn-status-ban {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-status-ban:hover {
  background: var(--danger);
  color: #fff;
}

.btn-status-active {
  background: var(--success-soft);
  color: var(--success);
}
.btn-status-active:hover {
  background: var(--success);
  color: #fff;
}

/* ================================================================
   Phase 5E-A: Announcement banner
   ================================================================ */
.announcement-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.announcement-banner.hidden { display: none; }

.announcement-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  background: var(--surface-card);
  font-size: 13px;
  line-height: 1.45;
}

.announcement-global {
  border-left-color: var(--warm);
  background: var(--warm-soft);
}

.announcement-room {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.announcement-scope {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.scope-global {
  background: rgba(224, 184, 92, 0.20);
  color: #9a7b2e;
}

.scope-room {
  background: rgba(91, 143, 180, 0.18);
  color: #3d6d8e;
}

.announcement-content {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ---- desktop: more horizontal padding ---- */
@media (min-width: 641px) {
  .announcement-banner {
    padding: 10px 24px;
  }
}

/* ================================================================
   Responsive
   ================================================================ */
@media (min-width: 641px) {
  body { padding: 18px; }

  #app {
    max-width: 1040px;
    height: calc(100dvh - 36px);
    border-radius: 24px;
    box-shadow: 0 20px 44px rgba(32, 56, 82, 0.12);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
  }

  /* auth full-viewport overlay */
  #auth-screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    background:
      radial-gradient(circle at 50% 14%, rgba(255, 237, 188, 0.2), transparent 15%),
      radial-gradient(circle at 22% 24%, rgba(91, 143, 180, 0.12), transparent 18%),
      radial-gradient(circle at 78% 26%, rgba(123, 167, 198, 0.08), transparent 16%),
      linear-gradient(180deg, #2b425b 0%, #355775 32%, #436d88 56%, #668696 80%, #e9f0f3 100%);
  }

  #auth-screen::before {
    background:
      radial-gradient(circle at 50% 18%, rgba(255, 239, 198, 0.34), transparent 11%),
      radial-gradient(circle at 74% 30%, rgba(191, 220, 236, 0.12), transparent 14%),
      radial-gradient(circle at 16% 68%, rgba(132, 176, 204, 0.12), transparent 16%);
  }

  #auth-screen::after {
    inset: 0;
    background:
      radial-gradient(ellipse at 50% 108%, rgba(246, 248, 243, 0.72), rgba(246, 248, 243, 0) 42%),
      linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(224, 236, 242, 0.08) 52%, rgba(239, 244, 245, 0.14) 74%, rgba(246, 247, 242, 0.2) 100%);
    opacity: 0.9;
  }

  .auth-card {
    box-shadow: 0 28px 64px rgba(18, 40, 61, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(249, 252, 253, 0.88));
    border-color: rgba(255, 255, 255, 0.6);
  }

  #home-screen {
    background:
      linear-gradient(180deg, rgba(238, 245, 250, 0.92), rgba(231, 240, 247, 0.88) 34%, rgba(244, 247, 247, 0.94) 100%);
  }

  #home-screen .header {
    padding-left: 22px;
    padding-right: 22px;
    background:
      linear-gradient(180deg, rgba(252, 254, 255, 0.9), rgba(242, 248, 251, 0.88));
  }

  .home-content {
    padding: 22px 28px 34px;
  }

  .home-content::before {
    background:
      radial-gradient(circle at 50% 4%, rgba(255, 241, 201, 0.46), transparent 14%),
      radial-gradient(circle at 18% 18%, rgba(91, 143, 180, 0.08), transparent 18%);
  }

  .home-content::after {
    inset: 0;
  }

  .home-hero {
    max-width: 560px;
    margin-bottom: 16px;
    padding: 20px 22px 17px;
  }

  /* home: 3-column grid */
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 760px;
  }

  .avatar-picker,
  #home-screen .announcement-banner {
    max-width: 760px;
  }

  #rooms-screen .rooms-content {
    background: linear-gradient(180deg, #f8f9f6 0%, #f3f4ef 100%);
  }

  #chat-screen .header,
  #rooms-screen .header {
    padding-left: 20px;
    padding-right: 20px;
  }

  #chat-screen .announcement-banner,
  #rooms-screen .announcement-banner {
    padding-left: 20px;
    padding-right: 20px;
  }

  #chat-screen .room-nickname-area {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* chat: reading-first bubble width — others narrower, mine tightest */
  .bubble-row { max-width: 54%; }
  .bubble-row.mine { max-width: 48%; }

  /* chat: more breathing room for messages & composer */
  #messages-box { padding: 24px; }
  .composer { padding: 10px 24px; }

  /* admin: wider content */
  .admin-content {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 20px 16px;
  }
}

/* ---- mobile ---- */
@media (max-width: 640px) {
  html, body, #app { max-width: 100%; overflow-x: hidden; }
  .header { padding: 10px 12px; }
  #messages-box { padding: 10px; }
  .composer { padding: 8px 10px; }
  .home-content {
    padding: 18px 12px 26px;
  }
  .home-content::after {
    bottom: 4%;
    height: 110px;
  }
  .home-hero {
    margin-bottom: 16px;
    padding: 22px 16px 18px;
    border-radius: 20px;
  }
  .home-kicker {
    margin-bottom: 10px;
    padding: 5px 10px;
    font-size: 11px;
  }
  .home-logo {
    font-size: 24px;
  }
  .home-subtitle {
    font-size: 14px;
  }
  .avatar-picker {
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 12px 14px;
  }
  .avatar-current {
    gap: 8px;
  }
  .avatar-current-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }
  .avatar-options {
    gap: 6px;
    max-width: 320px;
  }
  .card-grid {
    gap: 10px;
  }
  .feature-card {
    min-height: 104px;
    padding: 14px 12px;
  }
  .card-domain {
    font-size: 10px;
  }
  .card-poem {
    font-size: 11px;
  }
  #home-screen .announcement-banner {
    margin-bottom: 16px;
    padding: 10px;
    border-radius: 16px;
  }
  .admin-tabs {
    -webkit-overflow-scrolling: touch;
  }
  .user-item-actions {
    margin-left: 0;
    margin-top: 4px;
  }
  .admin-content {
    padding: 12px 8px;
  }
  .admin-section {
    padding: 12px;
  }
  .inline-form {
    flex-wrap: wrap;
  }
  .inline-form input {
    min-width: 120px;
  }
  .user-item-info {
    gap: 6px;
  }
}

/* ================================================================
   Phase 5E-A Pass C: Admin announcement management
   ================================================================ */

.announce-create-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.announce-create-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.announce-scope-radios {
  display: flex;
  gap: 16px;
  align-items: center;
}

.announce-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.announce-radio-label input[type="radio"] {
  accent-color: var(--accent);
}

#announce-room-select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
}

#announce-room-select:focus {
  border-color: var(--accent);
}

#announce-room-select.hidden { display: none; }

/* ---- announcement list items ---- */
#admin-announcements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
}

.announce-admin-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.announce-admin-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.announce-scope-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.announce-scope-global {
  background: rgba(224, 184, 92, 0.20);
  color: #9a7b2e;
}

.announce-scope-room {
  background: rgba(91, 143, 180, 0.18);
  color: #3d6d8e;
}

.announce-room-name {
  font-size: 12px;
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
}

.announce-status-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

.announce-admin-content {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 8px;
  word-break: break-word;
  white-space: pre-wrap;
}

.announce-admin-content.hidden { display: none; }

.announce-edit-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
}

.announce-edit-textarea:focus {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.announce-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-save-announce {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-save-announce:hover { background: #5d8f5d; }

.announce-admin-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.announce-admin-actions {
  display: flex;
  gap: 6px;
}

.announce-admin-actions.hidden { display: none; }

.btn-edit-announce,
.btn-toggle-announce {
  font-size: 12px;
  padding: 3px 10px;
}

/* ================================================================
   Phase 5E-B: Admin list filter button groups
   ================================================================ */

.filter-group {
  display: flex;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.filter-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.filter-btn:hover { color: var(--text); }

.filter-btn.active {
  background: var(--accent);
  color: #fff;
}

.section-header .filter-group {
  margin-left: auto;
  margin-right: 8px;
}

@media (max-width: 640px) {
  .filter-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ================================================================
   Phase 5E-D: Room nickname editor
   ================================================================ */

.room-nickname-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 13px;
  color: #72818e;
  background: linear-gradient(180deg, rgba(250, 250, 247, 0.98), rgba(245, 246, 242, 0.96));
  border-bottom: none;
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}

.room-nickname-display {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.room-nickname-label {
  color: #80909b;
  flex-shrink: 0;
}

.room-nickname-value {
  color: var(--text);
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-nickname-hint {
  color: #7d8a96;
  font-size: 12px;
  white-space: nowrap;
}

.room-nickname-edit {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.nickname-input-inline {
  width: 80px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-white);
  outline: none;
  font-family: inherit;
}

.nickname-input-inline:focus {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.nickname-edit-btn,
.nickname-save-btn,
.nickname-cancel-btn {
  font-size: 12px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.nickname-save-btn {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.nickname-save-btn:hover { background: #5d8f5d; }

@media (max-width: 640px) {
  .room-nickname-area {
    gap: 4px;
  }

  .nickname-input-inline {
    width: 80px;
  }
}

/* Prevent iOS Safari from auto-zooming focused form controls. */
@media (max-width: 640px) {
  input,
  textarea,
  select,
  .auth-card input,
  .auth-card textarea,
  .auth-card select,
  .captcha-row input,
  .captcha-input,
  .composer input,
  .message-input,
  .room-nickname-area input,
  .nickname-input-inline,
  .inline-form input,
  #member-user-select {
    font-size: 16px !important;
  }

  button,
  input,
  textarea,
  select,
  a {
    touch-action: manipulation;
  }
}
