/* Shared styles for the login, register, and leaderboard pages.
   The homepage (index.html) keeps its own inline styles with the same palette. */
:root {
  --page-top: #eef6fc;
  --page-mid: #cfe4f5;
  --page-bot: #b3d3ec;
  --navy: #3f6d94;
  --navy-2: #5a8bb4;
  --navy-dark: #2c4f70;
  --tab: #a9cde9;
  --panel: #5b84ab;
  --orange: #ff7a18;
  --orange-2: #ffa43a;
  --yellow: #ffd23f;
  --link: #1b4f8a;
  --white: #ffffff;
  --muted: #e4eff9;
  --text-dark: #1d3550;
  --error-bg: #8b1e2d;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--white);
  font-family: Arial, Helvetica, sans-serif; font-size: 14px;
  background: linear-gradient(180deg, var(--page-top) 0%, var(--page-mid) 40%, var(--page-bot) 100%);
}
a { text-decoration: none; }
h1, h2 { margin: 0; }

/* Masthead */
.masthead { max-width: 1000px; margin: 0 auto; padding: 14px 16px 10px; }
.logo {
  font-family: 'Arial Black', Impact, sans-serif; font-size: 40px; font-weight: 900;
  letter-spacing: -1px; color: var(--white); text-shadow: 2px 2px 0 var(--navy-dark); white-space: nowrap;
}
.logo a { color: inherit; }
.logo span { color: var(--orange); font-style: italic; }
.logo small { font-size: 16px; color: var(--yellow); letter-spacing: 0; margin-left: 6px; }

/* Tabs */
.tabs { max-width: 1000px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; align-items: flex-end; }
.tabs a {
  font-weight: 700; font-size: 14px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-dark); background: var(--tab); padding: 10px 22px 8px;
  border-radius: 10px 10px 0 0; border: 2px solid var(--navy); border-bottom: none;
}
.tabs a:hover { background: #bcd9ef; }
.tabs a.active { background: var(--white); color: var(--navy-dark); }

/* Sub navigation */
.subnav { background: var(--navy); border-top: 2px solid var(--navy-2); border-bottom: 2px solid var(--navy-dark); }
.subnav-inner {
  max-width: 1000px; margin: 0 auto; padding: 9px 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.subnav-links a { color: var(--white); font-weight: 700; font-size: 13px; }
.subnav-links a:hover { color: var(--yellow); }
.account { font-size: 13px; color: var(--muted); }
.account a { color: var(--yellow); font-weight: 700; }
.account strong { color: var(--white); }

/* Page content */
.page { max-width: 1000px; margin: 16px auto 0; padding: 0 16px 28px; }
.panel {
  background: var(--panel); border: 3px solid var(--navy-dark); border-radius: 8px;
  padding: 18px; box-shadow: 0 3px 0 rgba(0,0,0,.12);
}
.panel h2 {
  font-family: 'Arial Black', Impact, sans-serif; font-style: italic; font-size: 26px;
  color: var(--orange); text-transform: uppercase; text-shadow: 2px 2px 0 var(--navy-dark);
  margin-bottom: 14px;
}
.panel p { margin: 0 0 14px; color: var(--muted); line-height: 1.45; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
.field input {
  width: 100%; padding: 9px 10px; font: inherit; color: var(--text-dark);
  border: 2px solid var(--navy-dark); border-radius: 6px; background: var(--white);
}
.field input:focus { outline: 3px solid var(--yellow); outline-offset: 0; }
.field .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.btn {
  display: inline-block; text-align: center; color: #222; font-family: 'Arial Black', Impact, sans-serif;
  font-size: 15px; text-transform: uppercase; background: var(--yellow); cursor: pointer;
  border: 2px solid var(--navy-dark); border-radius: 6px; padding: 8px 16px; box-shadow: 0 3px 0 var(--navy-dark);
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.orange { background: var(--orange); color: #fff; }
.message:empty { display: none; }
.message { font-weight: 700; padding: 8px 10px; border-radius: 6px; background: var(--error-bg); color: var(--white); }
.switch { margin-top: 14px; color: var(--muted); }
.switch a { color: var(--yellow); font-weight: 700; }

/* Leaderboard table */
.board { width: 100%; border-collapse: collapse; background: var(--white); color: #222; border-radius: 6px; overflow: hidden; }
.board th, .board td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #d6e4f0; }
.board th { background: var(--navy); color: var(--white); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.board td.num, .board th.num { text-align: right; font-variant-numeric: tabular-nums; }
.board tr:nth-child(even) td { background: #f3f8fc; }
.board tr:first-child td.name { font-weight: 700; }
.board a { color: var(--link); font-weight: 700; }
.board .rank { font-family: 'Arial Black', Impact, sans-serif; color: var(--navy-dark); width: 60px; }
.panel .status { margin: 14px 0 0; font-weight: 700; color: var(--muted); }
.panel .status:empty { display: none; }

/* Profile page */
[hidden] { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.message.ok { background: #2f7a4b; }
.page-status { font-weight: 700; color: var(--muted); margin: 0 0 14px; }
.page-status a { color: var(--yellow); }
.panel + .panel { margin-top: 14px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; color: var(--white); text-transform: uppercase; letter-spacing: .5px; }
.profile-meta { margin: -6px 0 14px; font-size: 13px; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.block {
  background: var(--white); color: #000; border: 2px solid var(--navy-dark);
  border-radius: 6px; padding: 12px 14px;
}
.block h3 {
  margin: 0 0 8px; font-family: 'Arial Black', Impact, sans-serif; font-size: 14px;
  text-transform: uppercase; color: var(--link);
}
.block p { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.block ul { margin: 0; padding-left: 18px; line-height: 1.6; }
.block p, .block li { color: #000; }
.block a { color: var(--link); font-weight: 700; }
.block .muted { color: #000; font-style: italic; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.actions p { margin: 0; }
.actions .message { width: 100%; }
.btn.small { font-size: 13px; padding: 5px 10px; box-shadow: 0 2px 0 var(--navy-dark); }
.form.wide { max-width: 640px; }
.field textarea {
  width: 100%; min-height: 96px; padding: 9px 10px; font: inherit; color: var(--text-dark);
  border: 2px solid var(--navy-dark); border-radius: 6px; background: var(--white); resize: vertical;
}
.field textarea:focus { outline: 3px solid var(--yellow); outline-offset: 0; }
.list-plain { margin: 0; padding-left: 18px; line-height: 1.7; color: var(--white); }
.list-plain a { color: var(--yellow); font-weight: 700; }
.comments { list-style: none; padding: 0; margin: 14px 0 18px; display: flex; flex-direction: column; gap: 10px; }
.comment {
  background: var(--white); color: var(--text-dark); border: 2px solid var(--navy-dark);
  border-radius: 6px; padding: 10px 12px;
}
.comment-head { font-size: 13px; margin-bottom: 4px; }
.comment-head a { color: var(--link); font-weight: 700; }
.comment-head .muted { color: #5b6b7b; }
.comment-body { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { max-width: 640px; }
.panel .status { color: var(--muted); }

/* Top 8 friends (MySpace-style tiles) */
.top8 {
  list-style: none; margin: 0 0 14px; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.top8 li {
  background: var(--white); color: #000; border: 2px solid var(--navy-dark); border-radius: 6px;
  padding: 10px 8px; min-height: 46px; text-align: center; overflow-wrap: anywhere;
  display: flex; align-items: center; justify-content: center;
}
.top8 li a { color: var(--link); font-weight: 700; }
.top8 li.empty { background: #e9f1f8; font-style: italic; }
.top8 li.wide { grid-column: 1 / -1; }
.top8 li.slot { padding: 8px; }
.top8 select {
  width: 100%; padding: 8px; font: inherit; color: var(--text-dark);
  border: 2px solid var(--navy-dark); border-radius: 6px; background: var(--white);
}
.top8-form { margin: 0; }

/* Level and XP */
.level-box { margin: 0 0 14px; max-width: 460px; }
.level-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; color: var(--white); }
.level-row strong {
  font-family: 'Arial Black', Impact, sans-serif; font-size: 20px; text-transform: uppercase;
  color: var(--yellow); text-shadow: 2px 2px 0 var(--navy-dark);
}
.xp-bar {
  height: 16px; margin-top: 8px; background: #2f4f6e; border: 2px solid var(--navy-dark);
  border-radius: 8px; overflow: hidden;
}
.xp-bar span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
}
.xp-text { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* Trophy case */
.trophy-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.trophy-list li {
  background: var(--white); color: #000; border: 2px solid var(--navy-dark); border-radius: 6px;
  padding: 10px 12px; overflow-wrap: anywhere;
}
.trophy-list strong { display: block; margin-bottom: 4px; font-size: 15px; }
.trophy-list span { display: block; font-size: 13px; line-height: 1.4; }
.trophy-list .muted { color: #000; font-style: italic; }
.trophy-select {
  width: 100%; padding: 8px; font: inherit; color: var(--text-dark);
  border: 2px solid var(--navy-dark); border-radius: 6px; background: var(--white);
}

/* Profile themes. Set on <body> by the profile page from a fixed list (see api/profile_style.php). */
body[data-profile-theme="midnight"] { background: linear-gradient(180deg, #0b1026 0%, #1b2650 100%); --panel: #26336b; }
body[data-profile-theme="sunset"] { background: linear-gradient(180deg, #ffb88c 0%, #de6262 100%); --panel: #8e3b5b; }
body[data-profile-theme="mint"] { background: linear-gradient(180deg, #d9f7e8 0%, #8fd3b6 100%); --panel: #3f8f72; }
body[data-profile-theme="bubblegum"] { background: linear-gradient(180deg, #ffe3f1 0%, #f7a8d4 100%); --panel: #b65a9c; }
body.has-accent-color .panel h2 { color: var(--custom-accent); }

.suspended-banner {
  background: var(--error-bg); color: var(--white); font-weight: 700;
  padding: 8px 12px; border-radius: 6px; margin: 0 0 14px;
}
.headline { margin: -6px 0 14px; font-style: italic; color: var(--yellow); font-size: 15px; overflow-wrap: anywhere; }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--white); }
.field input[type="color"] { width: 64px; height: 36px; padding: 2px; border: 2px solid var(--navy-dark); border-radius: 6px; background: var(--white); }

/* Leaderboard scope toggle */
.scope-tabs { display: flex; gap: 6px; margin: 0 0 14px; }
.scope-tabs a {
  font-weight: 700; color: var(--text-dark); background: var(--tab);
  padding: 6px 14px; border: 2px solid var(--navy); border-radius: 8px 8px 0 0; border-bottom: none;
}
.scope-tabs a.active { background: var(--white); color: var(--navy-dark); }

/* Notifications */
.notif-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notif-list li {
  background: var(--white); color: #000; border: 2px solid var(--navy-dark); border-radius: 6px;
  padding: 10px 12px; overflow-wrap: anywhere;
}
.notif-list li.unread { border-color: var(--orange); border-width: 3px; }
.notif-list .when { display: block; font-size: 12px; color: #444; margin-top: 4px; }
.notif-list a { color: var(--link); font-weight: 700; }
.notif-actions { margin-top: 14px; }
.account .badge {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px;
  background: var(--orange); color: #fff; font-weight: 700; font-size: 12px; text-align: center;
}

/* Admin home cards */
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.admin-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  background: var(--white); color: #000; border: 2px solid var(--navy-dark); border-radius: 8px;
  box-shadow: 0 3px 0 var(--navy-dark);
}
.admin-card:hover { border-color: var(--orange); }
.admin-card strong {
  font-family: 'Arial Black', Impact, sans-serif; font-size: 18px; text-transform: uppercase; color: var(--link);
}
.admin-card span { font-size: 14px; line-height: 1.4; }

/* Profile layout: two columns, comments across both */
.profile-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.card-head, .section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.section-head h3 { margin: 18px 0 8px; }
.profile-edit-form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.profile-edit-form .section-head { margin-top: 4px; }
.profile-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.profile-col .panel { margin-top: 0; }
.profile-col .profile-grid { grid-template-columns: 1fr; }
.comments-panel { margin-top: 14px; }

/* Comment pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.pager-text { font-weight: 700; color: var(--white); }
.pager .btn:disabled { opacity: .5; }

/* View as visitor */
.view-as-link { margin: -6px 0 14px; }
.view-as-link a { color: var(--yellow); font-weight: 700; }
.visitor-banner {
  background: var(--navy-dark); color: var(--white); font-weight: 700;
  padding: 10px 14px; border-radius: 6px; margin: 0 0 14px; border: 2px solid var(--orange);
}
.visitor-banner a { color: var(--yellow); }

/* Comment text, author level, and vote arrows */
.comment, .comment p, .comment .comment-body { color: #000; }
.comment .author-level { font-size: 12px; font-weight: 700; color: #000; }
.vote-btn { min-width: 34px; font-size: 14px; line-height: 1; padding: 5px 8px; }

/* Threaded comments: replies, votes, reply box, @mentions */
.comment-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.comment-actions .btn.small { color: #000; }
.vote-score { font-size: 13px; font-weight: 700; color: #000; margin-right: 4px; }
.comment .mention { color: var(--link); font-weight: 700; }
.replies {
  list-style: none; margin: 10px 0 0 18px; padding: 0 0 0 12px;
  border-left: 3px solid var(--navy); display: flex; flex-direction: column; gap: 8px;
}
.comment.reply { background: #f3f8fc; }
.reply-form { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.reply-form textarea {
  width: 100%; min-height: 60px; padding: 8px; font: inherit; color: var(--text-dark);
  border: 2px solid var(--navy-dark); border-radius: 6px; background: var(--white); resize: vertical;
}
.reply-form .message { margin: 0; }

/* Unread notifications count in the top bar */
.account .unread-count { color: #ff2b2b; font-weight: 700; }

/* Footer */
footer {
  background: var(--navy); border-top: 3px solid var(--navy-dark); text-align: center;
  padding: 16px; font-size: 12px; color: var(--muted);
}
footer a { color: var(--yellow); font-weight: 700; }

@media (max-width: 560px) {
  .logo { font-size: 30px; }
  .tabs a { padding: 8px 12px 6px; font-size: 12px; }
  .subnav-inner { justify-content: center; }
  .panel { padding: 14px; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-columns { grid-template-columns: 1fr; }
  .top8 { grid-template-columns: repeat(2, 1fr); }
  .trophy-list { grid-template-columns: repeat(2, 1fr); }
}
