/* o-0a Mobile Dedicated Style Sheet (m/style.css) */
:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --accent-color: #ec4899;
  --border-color: #e2e8f0;
  --header-height: 54px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  background-color: var(--bg-main);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  padding-top: 0;
  padding-bottom: 30px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Mobile Header (Top Logo & Actions Header - Scrolls Away) */
.m-header {
  position: relative;
  width: 100%;
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.m-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 1.1rem;
}

.m-logo img {
  height: 28px;
  width: auto;
}

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

.m-btn-login {
  background: var(--primary-color);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
}

.m-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

/* 📌 Key Mobile Top Navigation Bar (Position: Sticky under Logo) */
/* When scrolling down, logo scrolls up and this bar stays pinned at top: 0 */
.m-top-nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--border-color);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.m-top-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 0 4px;
}

.m-top-nav-container::-webkit-scrollbar {
  display: none;
}

.m-top-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 11px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2.5px solid transparent;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.m-top-nav-item svg {
  width: 17px;
  height: 17px;
  stroke: var(--text-muted);
  transition: stroke 0.2s ease;
}

.m-top-nav-item.active {
  color: var(--primary-color);
  font-weight: 900;
  border-bottom-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.06);
}

.m-top-nav-item.active svg {
  stroke: var(--primary-color);
}

.m-nav-util-btn {
  color: #8b5cf6;
}

.m-nav-util-btn.active {
  color: #8b5cf6;
  border-bottom-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.06);
}

.m-nav-util-btn svg {
  stroke: #8b5cf6;
}

/* Hide legacy bottom nav bar */
.m-bottom-nav {
  display: none !important;
}

/* Main Container */
.m-container {
  padding: 14px;
  max-width: 100%;
}

/* Hero Section */
.m-hero-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #311042 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 20px 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
}

.m-hero-badge {
  background: linear-gradient(90deg, #6366f1, #a855f7);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 10px;
}

.m-hero-title {
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.35;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.m-hero-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 14px;
}

.m-hero-quick-btns {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.m-quick-btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Category Sticky Menu Bar (Games / Art / Story) */
.m-cat-nav-wrapper {
  position: sticky;
  top: 45px;
  z-index: 900;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  margin: -14px -14px 14px -14px;
  padding: 8px 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.m-cat-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 2px 2px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  flex: 1;
  scrollbar-width: none;
}

.m-cat-scroll::-webkit-scrollbar {
  display: none;
}

.m-cat-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.m-cat-chip.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

/* Category Drawer & Expand Button */
.m-cat-expand-btn {
  background: none;
  border: none;
  padding: 6px 8px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m-cat-drawer {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border-bottom: 1.5px solid var(--border-color);
  padding: 14px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  z-index: 950;
}

.m-cat-drawer.open {
  display: block;
}

.m-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* Metrics Grid */
.m-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.m-metric-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}

.m-metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.m-metric-val {
  font-size: 1.2rem;
  font-weight: 900;
}

/* Post Cards - 2 Columns Fixed Dimension Grid for Mobile */
.m-card-list,
.m-art-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.m-post-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  height: 250px; /* Fixed height for uniform card layout */
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.m-post-card:active {
  transform: scale(0.98);
}

.m-card-thumb {
  width: 100%;
  height: 115px; /* Fixed height thumbnail */
  object-fit: cover;
  display: block;
  background: #e2e8f0;
  flex-shrink: 0;
}

.m-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  overflow: hidden;
}

.m-card-tag {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--primary-color);
  text-transform: uppercase;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-card-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2.6em;
}

.m-card-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.m-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}

.m-card-meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile Community Custom Styling */
.m-comm-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
  color: #ffffff;
  padding: 18px 14px;
  border-radius: 16px;
  margin-bottom: 14px;
}

.m-comm-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-comm-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.m-comm-card:active {
  transform: scale(0.99);
  background: #f8fafc;
}

.m-comm-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-bottom: 6px;
}

/* Modals & Universal PC Modal Overlay Compatibility */
.modal-overlay,
.m-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

.modal-overlay.active,
.m-modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background: #ffffff;
  width: 95%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  position: relative;
  box-sizing: border-box;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Modal Form Controls Compatibility */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 6px;
  display: block;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.88rem;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  background: #ffffff;
  color: #0f172a;
}

.form-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-code-tab {
  background: #ffffff;
  color: #64748b;
  border: none;
  transition: all 0.2s ease;
}

.btn-code-tab.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.m-modal-sheet {
  background: #ffffff;
  width: 100%;
  max-height: 88vh;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 20px 16px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.2);
}

.m-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

