/* Shared visitor-account UI: login modal, header chip, and the /me page.
 * Colors mirror play.css so it can be dropped onto any page of the app. */
:root {
  --accent: #ff6b81;
  --bg: #08090d;
  --ink: #f6f7fb;
  --muted: rgba(246, 247, 251, .55);
  --line: rgba(255, 255, 255, .14);
}
[hidden] { display: none !important; }

/* ------------------------------ header slot ------------------------------ */
.acct-login-btn {
  padding: 7px 15px; border-radius: 999px; font-size: 12px; letter-spacing: .04em;
  color: var(--ink); background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line); transition: .16s ease; white-space: nowrap;
}
.acct-login-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(255, 107, 129, .08); }
.acct-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 13px 4px 4px;
  border-radius: 999px; font-size: 12px; color: var(--ink);
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line);
  transition: .16s ease; white-space: nowrap; max-width: 180px;
}
.acct-chip:hover { border-color: var(--accent); }
.acct-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.acct-dot {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  color: #0a0a0d; background: var(--accent);
}

/* ------------------------------- login modal ------------------------------ */
.acct-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.acct-backdrop { position: absolute; inset: 0; background: rgba(3, 4, 8, .78); backdrop-filter: blur(8px); }
.acct-card {
  position: relative; width: min(420px, 100%); padding: 34px 32px 26px;
  border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(30, 30, 46, .98), rgba(12, 13, 20, .98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .6);
  animation: acctIn .22s ease both;
}
@keyframes acctIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.acct-close {
  position: absolute; top: 12px; right: 14px; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .07);
  color: var(--muted); font-size: 20px; line-height: 1;
}
.acct-close:hover { color: var(--ink); }
.acct-kicker { font-size: 10px; letter-spacing: .3em; color: var(--accent); font-weight: 700; }
.acct-kicker i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; margin: 0 7px 2px; }
.acct-card h2 { margin: 14px 0 8px; font-size: 26px; font-weight: 600; letter-spacing: .03em; }
.acct-sub { margin: 0 0 22px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.acct-field { display: block; margin-bottom: 14px; }
.acct-field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.acct-field em { font-style: normal; opacity: .6; margin-left: 4px; }
.acct-field input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .3);
  color: var(--ink); font-size: 14px; outline: none; transition: .16s ease;
}
.acct-field input:focus { border-color: var(--accent); background: rgba(0, 0, 0, .45); }
.acct-field input::placeholder { color: rgba(246, 247, 251, .3); }
.acct-error {
  margin: 2px 0 12px; padding: 9px 12px; border-radius: 8px; font-size: 12px;
  color: #ffb3bd; background: rgba(255, 107, 129, .12); border: 1px solid rgba(255, 107, 129, .3);
}
.acct-submit {
  width: 100%; height: 44px; border: 0; border-radius: 9px; margin-top: 4px;
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .06em;
  background: linear-gradient(100deg, var(--accent), #b45cff);
  transition: filter .16s ease;
}
.acct-submit:hover { filter: brightness(1.12); }
.acct-submit:disabled { opacity: .6; cursor: wait; }
.acct-switch { margin-top: 16px; text-align: center; }
.acct-switch button { border: 0; background: none; color: var(--accent); font-size: 12px; padding: 4px; }
.acct-switch button:hover { text-decoration: underline; }
.acct-note { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 11px; line-height: 1.7; color: rgba(246, 247, 251, .38); }

/* -------------------------------- /me page -------------------------------- */
body.me-page { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.me-page a { color: inherit; text-decoration: none; }
body.me-page button { font: inherit; cursor: pointer; }
.me-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 12% 0%, rgba(94, 63, 160, .2), transparent 55%),
              radial-gradient(ellipse at 88% 12%, rgba(28, 110, 120, .16), transparent 55%); }
.me-head {
  height: 68px; padding: 0 clamp(16px, 4vw, 56px); display: flex;
  align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07); background: rgba(8, 9, 13, .62);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5;
}
.me-brand { display: flex; align-items: center; gap: 12px; font-size: 14px; letter-spacing: .05em; }
.brand-mark { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 14px var(--accent); }
.me-head-links { display: flex; align-items: center; gap: 18px; }
.me-head-links > a { font-size: 12px; color: var(--muted); }
.me-head-links > a:hover { color: var(--accent); }
.me-main { max-width: 1120px; margin: 0 auto; padding: clamp(34px, 6vh, 64px) clamp(16px, 4vw, 40px) 70px; }
.me-kicker { font-size: 11px; letter-spacing: .34em; color: var(--accent); font-weight: 600; }
.me-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.me-hero h1 { margin: 14px 0 8px; font-size: clamp(28px, 4.6vw, 46px); font-weight: 600; letter-spacing: .04em; }
.me-hero p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.me-logout { padding: 9px 18px; border-radius: 999px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); background: rgba(255, 255, 255, .05); }
.me-logout:hover { color: var(--ink); border-color: var(--accent); }
.me-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 38px; }
.me-stat { padding: 18px 20px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(255, 255, 255, .035); }
.me-stat span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .08em; margin-bottom: 8px; }
.me-stat strong { font-size: 28px; font-weight: 600; letter-spacing: .02em; }
.me-stat strong em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 6px; }
.me-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 0 18px; font-size: 15px; font-weight: 600; letter-spacing: .06em; }
.me-section-title small { font-size: 11px; font-weight: 400; color: var(--muted); }
.me-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.me-card { display: grid; grid-template-columns: 108px 1fr; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .09); background: rgba(255, 255, 255, .035); }
.me-cover { position: relative; min-height: 190px; background: #10121b; }
/* Covers are 16:9 key art; soften the cropped centre so the card body stays readable. */
.me-cover::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 9, 13, .05), rgba(8, 9, 13, .46)); }
.me-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-cover .me-cover-fallback { position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 34px; color: rgba(255, 255, 255, .18); }
.me-card-body { padding: 15px 16px 16px; min-width: 0; }
.me-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); }
.me-cat { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.me-card h3 { margin: 10px 0 4px; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-author { margin: 0 0 12px; font-size: 11px; color: var(--muted); }
.me-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-bottom: 12px; }
.me-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.me-endings { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.me-ending { font-size: 10px; padding: 3px 8px; border-radius: 5px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: rgba(246, 247, 251, .38); background: rgba(255, 255, 255, .05); border: 1px solid transparent; }
.me-ending.unlocked { color: #ffe3a8; background: rgba(232, 167, 93, .13); border-color: rgba(232, 167, 93, .3); }
.me-bookmark { font-size: 11px; color: var(--accent); margin-bottom: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.me-primary, .me-ghost { padding: 7px 13px; border-radius: 7px; font-size: 11px; }
.me-primary { border: 0; color: #fff; background: var(--accent); }
.me-primary:hover { filter: brightness(1.12); }
.me-ghost { border: 1px solid var(--line); background: transparent; color: var(--muted); }
.me-ghost:hover { color: var(--ink); border-color: var(--accent); }
.me-guest { padding: 36px 30px; border-radius: 16px; text-align: center;
  border: 1px dashed rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .025); }
.me-guest h2 { margin: 0 0 10px; font-size: 22px; font-weight: 600; }
.me-guest p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.me-guest-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.me-guest-actions button { padding: 10px 22px; border-radius: 8px; font-size: 13px; }
.me-guest-actions .primary { border: 0; color: #fff; background: var(--accent); }
.me-guest-actions .outline { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.me-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); }
.me-foot { padding: 22px clamp(16px, 4vw, 56px) 34px; text-align: center; font-size: 11px; color: rgba(246, 247, 251, .3); }

@media (max-width: 640px) {
  .me-card { grid-template-columns: 84px 1fr; }
  .me-cover { min-height: 170px; }
  .acct-card { padding: 28px 22px 22px; }
  .me-grid { grid-template-columns: 1fr; }
}
