*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f0f10;
  --card: #1e1e22;
  --accent-cyan: #00e5ff;
  --accent-pink: #ff007a;
  --accent-yellow: #ffe600;
  --accent-green: #00ff7f;
  --border: #ffffff;
  --text: #f8f8ff;
  --muted: #a0a0b5;
  --danger: #ff3366;
  --success: #00ff9c;
  --nav-bg: #15151a;
  --input-bg: #141419;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: radial-gradient(circle at top, #222244 0, #050509 55%);
  color: var(--text);
}

.page-body {
  padding-bottom: 70px;
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pixel-border {
  border: 3px solid var(--border);
  box-shadow: 0 0 0 3px #000, 0 0 12px rgba(0,229,255,0.4);
}

.auth-card {
  background: var(--card);
  padding: 20px 18px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.logo-text {
  font-family: 'Press Start 2P', system-ui, sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  margin: 0 0 8px;
  color: var(--accent-cyan);
}

.tagline {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: block;
  text-align: left;
  font-size: 13px;
  margin: 10px 0 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 11px;
  border-radius: 0;
  border: 2px solid #333344;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
}

textarea {
  resize: vertical;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  display: inline-block;
  padding: 9px 14px;
  margin-top: 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 0;
  cursor: pointer;
  border: none;
}

.primary-btn {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-pink));
  color: #000;
}

.secondary-btn {
  background: var(--accent-yellow);
  color: #000;
}

.danger-btn {
  background: var(--danger);
  color: #fff;
}

.error-box,
.success-box {
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

.error-box {
  background: rgba(255, 0, 94, 0.12);
  border-color: #ff4d88;
}

.success-box {
  background: rgba(0, 255, 156, 0.12);
  border-color: #00ff9c;
}

.tabs {
  display: flex;
  margin-bottom: 10px;
  border-bottom: 2px solid #333344;
}

.tab-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--accent-yellow);
  border-bottom: 3px solid var(--accent-yellow);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(90deg, #191924, #101019);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.brand {
  font-family: 'Press Start 2P', system-ui, sans-serif;
  font-size: 13px;
  color: var(--accent-cyan);
}

.user-chip {
  font-size: 13px;
  padding: 4px 8px;
  background: #26263a;
  border-radius: 999px;
}

.page-main {
  padding: 10px 12px 16px;
}

.with-nav {
  padding-bottom: 80px;
}

.card {
  background: var(--card);
  padding: 10px 10px 12px;
  margin-bottom: 10px;
}

.card h2 {
  margin-top: 0;
  font-size: 16px;
}

.card h3 {
  margin-top: 0;
  font-size: 14px;
}

.join-code {
  font-size: 13px;
  color: var(--muted);
}

.logout-link {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
}

.logout-link a {
  color: var(--accent-cyan);
}

.new-post-form textarea {
  font-size: 14px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.file-label {
  font-size: 13px;
  border: 2px dashed #44445a;
  padding: 6px 10px;
  cursor: pointer;
}

.file-label.small {
  padding: 4px 8px;
  border-radius: 4px;
}

.file-label input[type="file"] {
  display: none;
}

.feed {
  margin-top: 10px;
}

.empty-text {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.post-card {
  background: var(--card);
  margin-bottom: 10px;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nickname {
  font-size: 14px;
  font-weight: 600;
}

.meta {
  font-size: 11px;
  color: var(--muted);
}

.post-body {
  margin-top: 6px;
  font-size: 14px;
}

.post-body p {
  margin: 0 0 6px;
}

.post-image img {
  max-width: 100%;
  display: block;
  border-radius: 4px;
}

.post-footer {
  margin-top: 6px;
}

.reaction-row {
  display: flex;
  gap: 6px;
}

.reaction-btn {
  background: #272738;
  border-radius: 999px;
  border: none;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.reaction-btn:hover {
  background: #343454;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--nav-bg);
  display: flex;
  border-top: 3px solid var(--border);
}

.nav-item {
  flex: 1;
  text-align: center;
  padding: 6px 0 4px;
  font-size: 18px;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item span {
  font-size: 10px;
}

.nav-item.active {
  color: var(--accent-yellow);
  text-shadow: 0 0 6px rgba(255,230,0,0.7);
}

.chat-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-window {
  flex: 1;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  background: #111119;
  padding: 8px;
}

.chat-loading {
  font-size: 13px;
  color: var(--muted);
}

.chat-message {
  margin-bottom: 6px;
}

.chat-message.me {
  text-align: right;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.chat-name {
  font-weight: 600;
}

.chat-bubble {
  display: inline-block;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  max-width: 80%;
  font-size: 13px;
}

.chat-message.me .chat-bubble {
  background: var(--accent-cyan);
  color: #000;
}

.chat-message.them .chat-bubble {
  background: #26263a;
  color: var(--text);
}

.chat-image img {
  max-width: 100%;
  margin-top: 4px;
  border-radius: 4px;
}

.chat-form {
  display: flex;
  gap: 4px;
  align-items: center;
  padding-bottom: 8px;
}

.chat-form input[type="text"] {
  flex: 1;
}

.poll-list {
  margin-top: 10px;
}

.poll-card {
  margin-bottom: 10px;
}

.poll-question {
  font-size: 14px;
  margin: 4px 0 8px;
}

.poll-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.poll-option {
  width: 100%;
  margin-bottom: 6px;
  background: #22223a;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
}

.poll-option:hover {
  background: #303055;
}

.opt-meta {
  color: var(--muted);
  font-size: 11px;
}

.member-list {
  margin-top: 10px;
}

.member-card {
  margin-bottom: 8px;
}

.member-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-badge {
  display: inline-block;
  padding: 2px 6px;
  margin-left: 6px;
  font-size: 9px;
  background: var(--accent-pink);
  color: #000;
  border-radius: 10px;
}

.danger-card {
  border-color: var(--danger);
}

.game-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

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

.game-inner {
  background: #151522;
  padding: 10px;
  max-width: 360px;
  width: 90%;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

.game-block {
  font-size: 22px;
  letter-spacing: 3px;
  margin: 8px 0 10px;
  text-align: center;
}

.game-result {
  margin-top: 8px;
  font-size: 13px;
}

.game-result.success {
  color: var(--success);
}

.game-result.fail {
  color: var(--danger);
}

@media (min-width: 768px) {
  .auth-card {
    max-width: 460px;
  }
  .page-main {
    max-width: 560px;
    margin: 0 auto;
  }
}
