:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', var(--font-primary);

  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-hover: #192238;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;

  --primary: #6366f1;
  --primary-light: #818cf8;

  --border-color: #1e293b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.sleepspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

.restheader {
  width: 100%;
  background: transparent;
  position: relative;
  z-index: 100;
}

.headerlayout {
  background-color: rgba(19, 27, 46, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);

  position: sticky;
  top: 0;
  z-index: 101;

  width: 100%;
  margin: 0;
  padding: 1rem 1.5rem;

  display: flex;
  justify-content: center;
  align-items: center;
}

.sleepbrand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 0;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-main);
  text-decoration: none;
  text-align: center;
}

.brandimage {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.branddetail {
  color: var(--primary);
}


.sleepnav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.sleepnav a:hover {
  color: var(--text-main);
}

.sleepnav {
  width: 100%;
  background-color: rgba(19, 27, 46, 0.85);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
}

.sleepnav ul {
  display: flex;
  list-style: none;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}


.btn-signin {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-main) !important;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.btn-signin:hover {
  border-color: var(--primary);
  background-color: rgba(99, 102, 241, 0.1);
}

.sleeptopic {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.topictag {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.sleeptopic h1 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.thread-meta-bar {
  display: flex;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
}

.sleepthreads {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.post-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
}

.post-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.post-card.is-op {
  border-left: 4px solid var(--primary);
}

.post-user-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.post-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.post-user-info {
  display: flex;
  flex-direction: column;
}

.post-username {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.post-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-text p {
  color: #cbd5e1;
  font-size: 1.025rem;
  margin-bottom: 1rem;
}

.post-text p:last-child {
  margin-bottom: 0;
}

.modern-reply-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-top: 3rem;
  opacity: 0.85;
}

.modern-reply-box h3 {
  font-family: var(--font-heading);
  margin-bottom: 0.25rem;
}

.modern-reply-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.modern-reply-box textarea {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--text-main);
  font-family: inherit;
  resize: none;
  margin-bottom: 1rem;
}

.mattressbutton {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    padding: 0.8rem 1.35rem;
    border-radius: 50px;
    font-weight: 900;
    -webkit-text-stroke: 0.4px currentColor;
    text-align: center;
    justify-content: center;
    font-size: 1.02rem;
    text-decoration: none;
    box-shadow: 0 8px 25px -4px rgba(16, 185, 129, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: pulse-subtle 3s infinite;
}

.mattressbutton:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px -4px rgba(16, 185, 129, 0.7);
    color: #ffffff;
}

@keyframes pulse-subtle {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .mattressbutton {
        bottom: 12px;
        right: 12px;
        padding: 0.4rem 0.75rem;  
        font-size: 0.75rem;        
        border-radius: 30px;
        box-shadow: 0 4px 15px -2px rgba(16, 185, 129, 0.4);
    }
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: not-allowed;
  opacity: 0.7;
}

@media (max-width: 640px) {

  .headerlayout {
    padding: 0.85rem 1rem;
  }

  .sleepbrand {
    font-size: 1.05rem;
    gap: 0.5rem;
  }

  .brandimage {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .sleepnav {
    padding: 0.65rem 1rem;
  }

  .sleepnav ul {
    gap: 2rem;
  }

  .sleepnav a {
    font-size: 0.9rem;
  }

  .sleeptopic h1 {
    font-size: 1.75rem;
  }
}

@media (max-width: 360px) {

  .sleepbrand {
    font-size: 0.95rem;
  }

  .sleepnav ul {
    gap: 1.5rem;
  }
}

@media (max-width: 360px) {
  .sleepbrand {
    font-size: 0.95rem;
  }

  .sleepnav ul {
    gap: 1.5rem;
  }
}