:root {
  --bg-base: #0D0B14;
  --bg-card: rgba(24, 20, 38, 0.88);
  --bg-card-solid: #181426;
  --bg-elevated: #231D38;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(250, 0, 255, 0.45);
  --primary: #FA00FF;
  --primary-hover: #D900DE;
  --primary-soft: rgba(250, 0, 255, 0.15);
  --text-main: #F7F5FF;
  --text-sub: #B5AED1;
  --text-muted: #7C739C;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--bg-base);
  color: var(--text-main);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  min-height: 100dvh;
  line-height: 1.48;
  overflow-x: hidden;
}

body.in-room {
  overflow: hidden;
  height: 100dvh;
}

body.in-room #global-topbar,
body.in-room #global-footer {
  display: none;
}

body.in-room #main-view {
  max-width: 100%;
  padding: 0;
  height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Global Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 11, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border-accent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Language Selector */
.lang-select {
  background: rgba(35, 29, 56, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.lang-select.compact {
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(250, 0, 255, 0.32);
}

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

.btn-secondary {
  background: rgba(35, 29, 56, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-ghost {
  color: var(--text-sub);
  padding: 7px 9px;
}

.btn-ghost:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.18);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.38);
}

.btn-success {
  background: rgba(16, 185, 129, 0.18);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.38);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
}

/* Layout & Cards */
.main-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 14px;
}

/* Global Footer */
.site-footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.footer-box {
  background: rgba(24, 20, 38, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.55;
}

.footer-box strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 4px;
  font-size: 12.5px;
}

.footer-box a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

/* Hero */
.hero {
  text-align: center;
  padding: 28px 18px;
  background: radial-gradient(circle at 50% 0%, rgba(250, 0, 255, 0.2), transparent 68%), var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.hero p {
  font-size: 13.5px;
  color: var(--text-sub);
  margin-bottom: 18px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 6px 4px 14px;
  max-width: 440px;
  margin: 0 auto;
}

.search-bar:focus-within {
  border-color: var(--primary);
}

.search-prefix {
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  margin-right: 4px;
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  padding: 8px 4px;
  min-width: 0;
}

/* Forms */
.form-group {
  margin-bottom: 13px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.input, .textarea, .select {
  width: 100%;
  background: rgba(13, 11, 20, 0.88);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
}

.textarea {
  resize: vertical;
  min-height: 74px;
}

/* Creator Grid */
.creator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.creator-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: 0.15s ease;
}

.creator-item:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.creator-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6D28D9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

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

.handle-tag {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

/* ============================================================================
   전체화면 메신저 대화창 레이아웃
   ============================================================================ */
.messenger-screen {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messenger-bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.messenger-bg-dim {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(10, 8, 18, 0.56) 0%,
    rgba(10, 8, 18, 0.44) 50%,
    rgba(10, 8, 18, 0.68) 100%
  );
  pointer-events: none;
}

.chat-theme-obsidian {
  background: radial-gradient(circle at 20% 10%, #24193E 0%, #0D0B14 75%);
}
.chat-theme-neon {
  background: linear-gradient(155deg, #3B0947 0%, #190B2E 52%, #0D0B14 100%);
}
.chat-theme-midnight {
  background: linear-gradient(155deg, #0D2342 0%, #0B1326 60%, #080B14 100%);
}
.chat-theme-sunset {
  background: linear-gradient(155deg, #4A162D 0%, #210E1D 58%, #0E0A12 100%);
}
.chat-theme-emerald {
  background: linear-gradient(155deg, #0B382E 0%, #0A1D1B 58%, #080F0E 100%);
}
.chat-theme-lavender {
  background: linear-gradient(155deg, #2D2152 0%, #191330 60%, #0D0B14 100%);
}

.messenger-header {
  position: relative;
  z-index: 10;
  background: rgba(15, 12, 26, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: env(safe-area-inset-top);
}

.messenger-header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.messenger-back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.messenger-profile {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.messenger-profile .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.messenger-title-wrap {
  min-width: 0;
  flex: 1;
}

.messenger-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messenger-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messenger-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.messenger-body {
  position: relative;
  z-index: 5;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 18px;
}

.messenger-body-inner {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

.room-intro-banner {
  align-self: center;
  max-width: 440px;
  width: 100%;
  text-align: center;
  background: rgba(18, 14, 30, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px 14px;
  margin: auto 0 14px;
}

.room-intro-banner .avatar {
  width: 58px;
  height: 58px;
  font-size: 22px;
  margin: 0 auto 8px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

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

.msg-row.theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14.5px;
  word-break: break-word;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, #FA00FF 0%, #C600E0 100%);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.msg-row.theirs .msg-bubble {
  background: rgba(24, 20, 40, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: #F7F5FF;
  border-bottom-left-radius: 5px;
}

.donation-pill {
  display: inline-block;
  background: rgba(250, 204, 21, 0.22);
  color: #FEF08A;
  border: 1px solid rgba(250, 204, 21, 0.5);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 5px;
}

.msg-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.messenger-footer {
  position: relative;
  z-index: 10;
  background: rgba(15, 12, 26, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
}

.messenger-footer-inner {
  max-width: 760px;
  margin: 0 auto;
}

.composer-addons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.addon-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #EAE6FA;
}

.addon-pill.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: #fff;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #D8D2F0;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 14.5px;
  color: #fff;
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 110px;
  line-height: 1.4;
}

.composer-input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

.composer-input:focus {
  border-color: var(--primary);
}

.composer-send-btn {
  height: 42px;
  padding: 0 16px;
  border-radius: 21px;
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(250, 0, 255, 0.35);
}

.inbox-list-wrap {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inbox-thread-item {
  background: rgba(22, 18, 38, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: 0.15s ease;
}

.inbox-thread-item:hover {
  border-color: var(--primary);
}

.photo-upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(13, 11, 20, 0.75);
  border: 1px dashed rgba(250, 0, 255, 0.45);
  border-radius: var(--radius-md);
  padding: 12px;
}

.photo-preview-thumb {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 18px;
}

.photo-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.stat-val {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.18);
  color: #FCD34D;
}

.badge-approved, .badge-resolved {
  background: rgba(16, 185, 129, 0.18);
  color: #6EE7B7;
}

.badge-rejected {
  background: rgba(239, 68, 68, 0.18);
  color: #FCA5A5;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.list-row:last-child {
  border-bottom: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 4, 10, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-box {
  width: 100%;
  max-width: 430px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-height: 88dvh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toast-container {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 380px);
  pointer-events: none;
}

.toast {
  background: rgba(28, 22, 46, 0.96);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.loading-box {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-sub);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(250, 0, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-note {
  text-align: center;
  padding: 28px 14px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}
