/* rtime 游戏厅 — 留言板 (self-contained, matches the hub aesthetic) */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --panel: #fff; --panel-2: #f5f4ff; --panel-3: #faf9ff;
  --text: #2a2746; --muted: #7d7aa0; --faint: #a6a2c8;
  --line: rgba(80,70,160,.12); --line-2: rgba(80,70,160,.08);
  --accent: #6c63ff; --accent-2: #8f7bff; --on-accent: #fff;
  --danger: #e76a6a; --shadow: rgba(90,70,180,.16);
  --r-lg: 22px; --r-md: 14px; --r-sm: 10px;
  font-family: ui-rounded, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system,
               "PingFang SC", "Microsoft YaHei", sans-serif;
}
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text); min-height: 100dvh; position: relative; overflow-x: hidden;
  background: linear-gradient(168deg, #eceaff 0%, #f6ecff 46%, #fff7fb 100%);
}
body::before, body::after {
  content: ""; position: fixed; z-index: 0; border-radius: 50%; pointer-events: none;
  filter: blur(70px); opacity: .5;
}
body::before { width: 44vw; height: 44vw; left: -12vw; top: -10vw; background: radial-gradient(circle, #b9a6ff, transparent 70%); }
body::after { width: 40vw; height: 40vw; right: -14vw; top: 24vh; background: radial-gradient(circle, #ffb3e6, transparent 70%); }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.top {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; max-width: 720px; margin: 0 auto;
}
.back {
  display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px 8px 10px;
  border-radius: 999px; background: rgba(255,255,255,.8); color: var(--muted); font-weight: 700;
  box-shadow: 0 3px 12px var(--shadow); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.back:active { transform: scale(.95); }
.back__ico { font-size: 1.2rem; line-height: 1; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.18rem; }
.brand__name { background: linear-gradient(100deg, #6c63ff, #c44be0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.whoami { margin-left: auto; color: var(--muted); font-size: .9rem; font-weight: 600; }

.gate { position: relative; z-index: 2; display: grid; place-items: center; padding: 14vh 22px; }
.gate__card { max-width: 360px; text-align: center; background: var(--panel); border-radius: var(--r-lg); padding: 34px 26px; box-shadow: 0 16px 46px var(--shadow); }
.gate__emoji { font-size: 2.6rem; }
.gate__title { margin: 10px 0 6px; font-size: 1.2rem; font-weight: 800; }
.gate__sub { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.6; }
.gate__link { display: inline-block; margin-top: 16px; color: var(--accent); font-weight: 700; }

.wrap { position: relative; z-index: 2; max-width: 720px; margin: 0 auto; padding: 4px 18px 60px; }

/* ---------- compose ---------- */
.compose {
  background: var(--panel); border-radius: var(--r-lg); padding: 16px;
  box-shadow: 0 8px 26px var(--shadow); border: 1px solid var(--line-2);
}
.compose__row { display: flex; gap: 11px; }
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 1.1rem; text-transform: uppercase;
  background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: #fff;
}
.compose__text {
  flex: 1; min-width: 0; resize: none; border: none; outline: none; background: transparent;
  font: inherit; font-size: 1rem; color: var(--text); line-height: 1.5; padding: 9px 0;
}
.compose__text::placeholder { color: var(--faint); }
.compose__preview { position: relative; margin: 8px 0 0 53px; width: fit-content; }
.compose__preview img { max-width: 200px; max-height: 160px; border-radius: 12px; display: block; box-shadow: 0 4px 12px var(--shadow); }
.preview__x {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--text); color: #fff; font-size: .8rem; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.compose__bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-left: 53px; }
.iconbtn {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; background: var(--panel-2); color: var(--accent);
  font-weight: 700; font-size: .88rem;
}
.iconbtn:active { transform: scale(.96); }
.compose__count { color: var(--faint); font-size: .8rem; margin-left: auto; font-variant-numeric: tabular-nums; }
.btn { padding: 9px 20px; border-radius: 11px; font-weight: 800; font-size: .95rem; box-shadow: 0 4px 12px var(--shadow); transition: transform .1s, filter .2s, opacity .2s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: var(--on-accent); }
.compose__err { margin: 10px 0 0 53px; color: var(--danger); font-size: .85rem; font-weight: 600; }

/* ---------- feed ---------- */
.feed-head { margin: 24px 4px 12px; }
.feed-head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--muted); }
.feed { display: flex; flex-direction: column; gap: 12px; }
.msg {
  background: var(--panel); border-radius: var(--r-md); padding: 14px 15px;
  box-shadow: 0 5px 18px var(--shadow); border: 1px solid var(--line-2);
  animation: pop .35s cubic-bezier(.2,.8,.3,1.1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.msg__head { display: flex; align-items: center; gap: 10px; }
.msg__avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; text-transform: uppercase; color: #fff; }
.msg__who { font-weight: 800; }
.msg__who .tag { font-size: .64rem; font-weight: 800; margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: #fff; vertical-align: middle; }
.msg__who .tag--guest { background: #2e9e74; }
.msg__time { color: var(--faint); font-size: .78rem; }
.msg__del { margin-left: auto; color: var(--faint); font-size: .95rem; padding: 4px 7px; border-radius: 8px; }
.msg__del:hover { color: var(--danger); background: rgba(231,106,106,.1); }
.msg__text { margin: 9px 0 0; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.msg__img { margin-top: 10px; }
.msg__img img { max-width: 100%; max-height: 320px; border-radius: 12px; cursor: zoom-in; display: block; box-shadow: 0 3px 10px var(--shadow); }
.feed__empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: .95rem; }

/* avatar color variants (hashed by name in JS) */
.c0 { background: linear-gradient(160deg,#8f7bff,#6c63ff); }
.c1 { background: linear-gradient(160deg,#3ec8c8,#3f8fd0); }
.c2 { background: linear-gradient(160deg,#f6a85b,#ef7d4e); }
.c3 { background: linear-gradient(160deg,#5bbf73,#2e9e74); }
.c4 { background: linear-gradient(160deg,#e06aa0,#c44be0); }
.c5 { background: linear-gradient(160deg,#f0795a,#d04f3a); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(10,8,30,.85); cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(10px);
  z-index: 120; background: var(--text); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; opacity: 0; transition: opacity .25s, transform .25s; box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  .top { padding: 12px 14px; }
  .wrap { padding: 4px 12px 56px; }
  .compose__bar, .compose__preview, .compose__err { padding-left: 0; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }
