/* ★ the-club stylesheet ★ */

.online-count {
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

@import url('https://fonts.googleapis.com/css2?family=VT323&family=Press+Start+2P&family=Nunito:wght@400;700&display=swap');

:root {
  --bg: #0d0d1a;
  --surface: #14142b;
  --surface2: #1e1e3f;
  --border: #3a3a7a;
  --accent: #7c5cbf;
  --accent2: #c084fc;
  --accent3: #38bdf8;
  --accent4: #f472b6;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --link: #a78bfa;
  --link-hover: #c084fc;
  --tag-bg: #2d1b69;
  --tag-text: #c084fc;
  --green: #4ade80;
  --yellow: #fbbf24;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(124, 92, 191, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(56, 189, 248, 0.06) 0%, transparent 50%);
  min-height: 100vh;
}

/* ─── SCANLINES overlay ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ─── LAYOUT ─── */
.wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─── HEADER ─── */
header {
  border-bottom: 2px solid var(--border);
  padding: 1.5rem 0;
  background: linear-gradient(180deg, rgba(124, 92, 191, 0.15), transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.4rem;
  color: var(--accent2);
  text-shadow: 0 0 20px rgba(192, 132, 252, 0.6), 2px 2px 0 var(--accent);
  letter-spacing: 2px;
}

.site-title span {
  color: var(--accent3);
}

.site-tagline {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  letter-spacing: 1px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

nav a {
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent3);
  background: var(--surface);
  transition: all 0.2s;
  letter-spacing: 1px;
}

nav a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent2);
  text-decoration: none;
}

/* ─── HERO ─── */
.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero h2 {
  font-family: 'VT323', monospace;
  font-size: 2.5rem;
  color: var(--accent4);
  letter-spacing: 2px;
  margin-bottom: 0.75rem;
}

.hero p {
  max-width: 600px;
  margin: 0 auto 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  padding: 3px 8px;
  border: 1px solid;
  border-radius: 3px;
  letter-spacing: 1px;
}

.badge-purple { border-color: var(--accent); color: var(--accent2); background: rgba(124,92,191,0.15); }
.badge-blue   { border-color: var(--accent3); color: var(--accent3); background: rgba(56,189,248,0.1); }
.badge-pink   { border-color: var(--accent4); color: var(--accent4); background: rgba(244,114,182,0.1); }
.badge-green  { border-color: var(--green); color: var(--green); background: rgba(74,222,128,0.1); }

/* ─── MAIN GRID ─── */
main {
  padding: 2.5rem 0;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 750px) {
  .main-grid { grid-template-columns: 1fr; }
}

/* ─── SECTION ─── */
section {
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border);
}

.section-header h2 {
  font-family: 'VT323', monospace;
  font-size: 1.7rem;
  color: var(--accent2);
  letter-spacing: 1px;
}

.section-icon {
  font-size: 1.3rem;
}

/* ─── CARDS ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124, 92, 191, 0.2);
}

.card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--accent3);
}

.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--accent2); text-decoration: none; }

.card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ─── LIST SECTION ─── */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.link-list a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.88rem;
  color: var(--text);
  transition: all 0.15s;
}

.link-list a:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent2);
  text-decoration: none;
  padding-left: 1rem;
}

.link-list a::before {
  content: '›';
  color: var(--accent);
  font-weight: 700;
}

/* ─── SIDEBAR ─── */
.sidebar {
  position: sticky;
  top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.sidebar-box-title {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  padding: 0.6rem 1rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  color: var(--accent2);
  letter-spacing: 1px;
}

.sidebar-box-body {
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.sidebar-box-body p + p { margin-top: 0.5rem; }

.sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
}

.sidebar-links li a {
  font-size: 0.85rem;
  color: var(--link);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(58,58,122,0.4);
  color: var(--text-muted);
}

.stat-row span:last-child { color: var(--green); font-weight: 700; }

/* ─── 88x31 BUTTONS ─── */
.buttons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0.9rem 1rem;
}

.btn88 {
  display: inline-block;
  width: 88px;
  height: 31px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'VT323', monospace;
  font-size: 0.7rem;
  color: var(--accent3);
  text-align: center;
  padding: 2px 4px;
  transition: all 0.1s;
  line-height: 1.2;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
}

.btn88:hover {
  border-color: var(--accent2);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.btn88.pink  { color: var(--accent4); border-color: rgba(244,114,182,0.4); }
.btn88.green { color: var(--green);   border-color: rgba(74,222,128,0.4); }
.btn88.blue  { color: var(--accent3); border-color: rgba(56,189,248,0.4); }

/* ─── MARQUEE ─── */
.marquee-wrap {
  background: var(--surface2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  color: var(--accent4);
  letter-spacing: 1px;
}

.marquee-wrap marquee { display: inline; }

/* ─── FOOTER ─── */
footer {
  border-top: 2px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

footer .footer-heart { color: var(--accent4); }
footer a { color: var(--link); }

/* ─── ABOUT PAGE ─── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) { .about-grid { grid-template-columns: 1fr; } }

.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.info-box h3 {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: var(--accent2);
  margin-bottom: 0.75rem;
  letter-spacing: 1px;
}

/* ─── PIXEL ART DIVIDER ─── */
.divider {
  text-align: center;
  color: var(--border);
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  letter-spacing: 4px;
  margin: 0.5rem 0 1.5rem;
  user-select: none;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }


/* ═══════════════════════════════════
   APP MODE — 3-panel layout
   ═══════════════════════════════════ */

body.app-mode {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── App header ─── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 46px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(124,92,191,0.18), transparent);
  flex-shrink: 0;
}

.app-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.72rem;
  color: var(--accent2);
  text-shadow: 0 0 12px rgba(192,132,252,0.5);
  letter-spacing: 2px;
}

.app-title span { color: var(--accent3); }

.app-nav { display: flex; gap: 0.4rem; }
.app-nav a {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent3);
  background: var(--surface);
  transition: all 0.15s;
  letter-spacing: 1px;
}
.app-nav a.active,
.app-nav a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent2);
  text-decoration: none;
}

/* ─── App body ─── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.panel-heading {
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  color: var(--accent2);
  letter-spacing: 1px;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}

/* ─── Novel sidebar ─── */
.novel-sidebar {
  width: 185px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
}

.chapter-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0.5rem;
  flex: 1;
}

.ch-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'VT323', monospace;
  font-size: 0.98rem;
  letter-spacing: 0.5px;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.3;
}

.ch-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent2);
}

.ch-btn.active {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent2);
}

.novel-blurb {
  padding: 0.75rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.55;
  border-top: 1px solid var(--border);
}

/* ─── Reader panel ─── */
.reader-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-bar {
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--accent3);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.feed-empty {
  color: var(--border);
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  text-align: center;
  margin-top: 3rem;
  letter-spacing: 2px;
}

.reader-para {
  font-size: 0.87rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 0.9rem 0;
}

.scene-break {
  text-align: center;
  color: var(--border);
  font-family: 'VT323', monospace;
  font-size: 1rem;
  letter-spacing: 4px;
  padding: 0.4rem 0;
  user-select: none;
}

@keyframes bubbleIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Chess panel ─── */
.chess-panel {
  width: 348px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
}

#chess-lobby {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.your-code-row {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-family: 'VT323', monospace;
}

.code-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

#peer-id {
  color: var(--accent3);
  font-size: 0.68rem;
  word-break: break-all;
  flex: 1;
  font-family: monospace;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all 0.15s;
}

.copy-btn:hover { color: var(--accent3); border-color: var(--accent3); }

.lobby-buttons { display: flex; flex-direction: column; gap: 0.45rem; }

.chess-btn {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  letter-spacing: 1px;
  padding: 0.38rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent3);
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}

.chess-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent2);
}

.chess-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chess-btn:disabled:hover { background: var(--surface); color: var(--accent3); border-color: var(--border); }

.host-btn { border-color: rgba(56,189,248,0.35); }

.join-row { display: flex; gap: 0.4rem; }
.join-row .chess-btn { width: auto; flex-shrink: 0; }

.join-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.38rem 0.6rem;
  outline: none;
  font-family: monospace;
  min-width: 0;
  transition: border-color 0.15s;
}
.join-input:focus { border-color: var(--accent); }
.join-input:disabled { opacity: 0.45; }

.lobby-status {
  font-family: 'VT323', monospace;
  font-size: 0.92rem;
  color: var(--accent4);
  letter-spacing: 0.5px;
  min-height: 1.1em;
}

.lobby-help {
  font-size: 0.75rem;
  color: var(--border);
  line-height: 1.5;
}

/* ─── Chess game ─── */
#chess-game {
  display: none;
  flex-direction: column;
}

.chess-status {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  text-align: center;
  padding: 0.35rem 0.5rem;
  letter-spacing: 1px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: calc(100% - 1.5rem);
  margin: 0.75rem auto;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}

.chess-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  aspect-ratio: 1;
  position: relative;
  transition: filter 0.1s;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 82%;
}

.chess-cell.light { background-color: #28284c; }
.chess-cell.dark  { background-color: #17172c; }

.chess-cell.selected  { background-color: rgba(56,189,248,0.38) !important; }
.chess-cell.in-check  { background-color: rgba(244,114,182,0.38) !important; }
.chess-cell.last-from { background-color: rgba(192,132,252,0.18) !important; }
.chess-cell.last-to   { background-color: rgba(192,132,252,0.25) !important; }

.chess-cell.valid-move::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(74,222,128,0.55);
  pointer-events: none;
}

.chess-cell.valid-capture::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 3px solid rgba(74,222,128,0.55);
  pointer-events: none;
}

.chess-cell:hover { filter: brightness(1.3); }


.move-list {
  padding: 0 0.75rem 0.25rem;
  font-family: 'VT323', monospace;
  font-size: 0.88rem;
  color: var(--text-muted);
  max-height: 70px;
  overflow-y: auto;
  letter-spacing: 0.5px;
  line-height: 1.6;
}

.move-entry { margin-right: 2px; }

.resign-btn {
  margin: 0.2rem 0.75rem 0.75rem;
  border-color: rgba(244,114,182,0.3);
  color: var(--accent4);
}

.resign-btn:hover {
  background: rgba(244,114,182,0.15) !important;
  color: var(--accent4) !important;
  border-color: var(--accent4) !important;
}
