:root {
  /* OKLCH Colors */
  --primary: oklch(70% 0.15 250);
  --secondary: oklch(65% 0.2 300);
  --accent: oklch(80% 0.15 150);
  --bg: oklch(98% 0.01 250);
  --text: oklch(20% 0.02 250);
  --error: oklch(60% 0.2 20);
  --success: oklch(70% 0.15 140);
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 15px var(--primary);

  /* Spacing */
  --radius: 1.5rem;
  --gap: 1.5rem;
}

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

body {
  font-family: 'Pretendard', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  /* Subtle noise texture */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-blend-mode: overlay;
  opacity: 0.98;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--gap);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Auth View */
.view-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  text-align: center;
  padding-top: 20vh;
}

.auth-card {
  background: white;
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-card h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

input, textarea, button {
  font-family: inherit;
  font-size: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid oklch(90% 0.01 250);
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px oklch(70% 0.15 250 / 0.1);
}

button {
  background: var(--primary);
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  filter: brightness(1.1);
}

button:active {
  transform: translateY(0);
}

/* Nav Bar */
.nav-bar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 2rem;
  z-index: 1000;
  border: 1px solid rgba(255,255,255,0.3);
}

.nav-item {
  text-decoration: none;
  color: var(--text);
  opacity: 0.6;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.3s;
}

.nav-item.active {
  opacity: 1;
  color: var(--primary);
}

/* Best 10 Section */
.best-10 {
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Loader */
.loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary);
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Diary Card Component */
.diary-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--gap);
  border: 1px solid oklch(95% 0.01 250);
  transition: transform 0.3s;
}

.diary-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

.card-user {
  font-weight: 800;
  color: var(--primary);
}

.card-content {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Emotion Meter */
.emotion-meter {
  display: flex;
  height: 2rem;
  border-radius: 1rem;
  overflow: hidden;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.emotion-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  transition: width 0.5s ease;
}

.emotion-bar.joy { background: oklch(75% 0.15 80); }
.emotion-bar.sad { background: oklch(65% 0.15 250); }
.emotion-bar.anger { background: oklch(60% 0.2 20); }
.emotion-bar.calm { background: oklch(75% 0.1 150); }

.emo-tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  margin-right: 0.4rem;
  color: white;
  text-transform: capitalize;
}

.emo-tag.joy { background: oklch(75% 0.15 80); }
.emo-tag.sad { background: oklch(65% 0.15 250); }
.emo-tag.anger { background: oklch(60% 0.2 20); }
.emo-tag.calm { background: oklch(75% 0.1 150); }

/* Media Inputs */
.media-inputs {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

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

.media-inputs label {
  background: oklch(95% 0.01 250);
  padding: 0.75rem 1.25rem;
  border-radius: 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px dashed oklch(80% 0.01 250);
}

.char-count {
  text-align: right;
  font-size: 0.8rem;
  opacity: 0.5;
  margin-top: 0.25rem;
}

/* Quick Emotion Tags */
.quick-emotion-section {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quick-emotion-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.7;
}

.quick-emotion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.emotion-tag-btn {
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid oklch(90% 0.01 250);
  border-radius: 2rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text);
}

.emotion-tag-btn:hover {
  background: oklch(95% 0.01 250);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.emotion-tag-btn:active {
  transform: translateY(0);
}

/* Button States */
.like-btn.liked {
  background: oklch(70% 0.15 20);
  border-color: oklch(70% 0.15 20);
}

.follow-btn {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 2rem;
  margin-right: 0.5rem;
  transition: all 0.3s;
}

.follow-btn.following {
  background: var(--primary);
  color: white;
}

.card-actions {
  display: flex;
  align-items: center;
}

.card-photo {
  width: 100%;
  border-radius: 1rem;
  margin-bottom: 1rem;
  aspect-ratio: 16/9;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.card-audio {
  width: 100%;
  height: 32px;
  margin-bottom: 1rem;
}

/* Search & Filter */
.search-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

/* Horizontal Calendar */
.calendar-wrapper {
  margin-bottom: 2rem;
  overflow: hidden;
}

.calendar-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.calendar-scroll::-webkit-scrollbar {
  height: 4px;
}

.calendar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.calendar-scroll::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.date-item {
  min-width: 55px;
  height: 75px;
  background: white;
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  border: 1px solid transparent;
}

.date-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.date-item.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.date-item .day {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.7;
}

.date-item .date {
  font-size: 1.1rem;
  font-weight: 800;
}

.date-item.active .day {
  opacity: 1;
}

/* Main Tabs */
.main-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 1rem 0;
  z-index: 100;
  border-bottom: 1px solid oklch(90% 0.01 250);
}

.main-tab-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  font-weight: 700;
  font-size: 1rem;
  background: white;
  color: var(--text);
  border: 1px solid oklch(90% 0.01 250);
  cursor: pointer;
  transition: all 0.3s;
}

.main-tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

/* Enhanced News Card */
.news-card {
  background: white;
  padding: 0; /* Remove padding for header image feel */
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid oklch(90% 0.01 250);
  transition: transform 0.3s, box-shadow 0.3s;
}

.news-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.news-card-header {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  padding: 2rem 1.5rem;
  color: white;
  position: relative;
}

.news-card-header::after {
  content: "뉴스";
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 2px;
  opacity: 0.5;
}

.news-link-display {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.news-card-body {
  padding: 1.5rem;
}

.news-comment-box {
  background: oklch(98% 0.01 250);
  padding: 1rem;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary);
}

/* Split Dashboard Layout */
#app {
  max-width: 1400px; /* Wider for dashboard */
  margin: 0 auto;
  padding: 1rem;
}

.dashboard-container {
  display: grid;
  grid-template-columns: 400px 1fr; /* Fixed width for diary, fluid for news */
  gap: 2rem;
  height: calc(100vh - 2rem);
  overflow: hidden;
}

/* Left Column: Diary */
.diary-column {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  border: 1px solid oklch(90% 0.01 250);
}

.diary-column::-webkit-scrollbar { width: 5px; }
.diary-column::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* Right Column: News */
.news-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.news-column::-webkit-scrollbar { width: 5px; }
.news-column::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 10px; }

/* Repositing Best Grid inside columns if needed, or removing it */
.best-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .dashboard-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  #app { height: auto; }
}

.live-badge {
  background: white;
  color: #ff4b2b;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.65rem;
  font-weight: 900;
  vertical-align: middle;
  margin-right: 0.25rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.news-card.live {
  border-left: none;
  border: 2px solid #ff4b2b;
}

/* Newspaper Aesthetic */
.newspaper-container {
  background: #fdfcf8; /* Paper-like background */
  padding: 2rem;
  border: 1px solid #d3d3d3;
  box-shadow: 10px 10px 0px #e0e0e0;
  font-family: 'Georgia', serif;
  color: #1a1a1a;
}

.newspaper-header {
  text-align: center;
  border-bottom: 4px double #1a1a1a;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
}

.newspaper-title {
  font-size: 3.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -2px;
  margin: 0;
}

.newspaper-meta {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #1a1a1a;
  padding: 0.5rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.news-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

.cat-tag {
  padding: 0.3rem 0.8rem;
  background: #1a1a1a;
  color: white;
  font-size: 0.75rem;
  cursor: pointer;
  transition: opacity 0.3s;
}

.cat-tag.active {
  background: #ff4b2b;
}

/* Newspaper Style Section Title */
.newspaper-section-header {
  text-align: center;
  border-bottom: 3px double #1a1a1a;
  border-top: 1px solid #1a1a1a;
  margin: 3rem 0 1.5rem;
  padding: 0.5rem 0;
}

.newspaper-section-title {
  font-family: 'Georgia', serif;
  font-size: 2.2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -1px;
  margin: 0;
  color: #1a1a1a;
  display: block;
}

/* News Article Card (Newspaper Style) */
.article-card {
  border-bottom: 1px solid #ccc;
  padding: 1.5rem 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.article-card:last-child {
  border-bottom: none;
}

.article-headline {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: #1a1a1a;
  display: block;
}

.article-headline:hover {
  color: #ff4b2b;
}

.article-content {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #333;
  column-count: 2; /* Newspaper column look */
  column-gap: 1.5rem;
}

.article-footer {
  font-size: 0.8rem;
  font-weight: 700;
  color: #666;
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.article-meta-info {
  display: flex;
  gap: 1rem;
}

.share-to-disc-btn {
  background: transparent;
  border: 1px solid #ddd;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 4px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.share-to-disc-btn:hover {
  background: #1a1a1a;
  color: white;
  border-color: #1a1a1a;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .article-content {
    column-count: 1;
  }
  .newspaper-title {
    font-size: 2.5rem;
  }
}

@media (max-width: 480px) {

  .best-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  #app {
    padding: 1rem;
  }
  .nav-bar {
    width: 90%;
    bottom: 1rem;
    justify-content: space-around;
  }
}
