:root {
  --bg: #0e1014;
  --panel: #12151c;
  --line: #3b4252;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --today: #fb923c;
  --weekend: #60a5fa;
  --sunday: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  overflow-x: hidden;
}

.community-shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3.4rem;
}

.community-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.topbar-user-menu {
  position: relative;
  min-width: 1.45rem;
  min-height: 1.45rem;
}

.brand-kicker {
  margin: 0;
  color: #93c5fd;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.brand-wrap h1 {
  margin: 0.22rem 0 0;
  font-family: 'Do Hyeon', sans-serif;
  font-size: clamp(1.7rem, 3.8vw, 2.9rem);
  line-height: 1.05;
}

.brand-subcopy {
  margin: 0.35rem 0 0;
  max-width: 42ch;
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.45;
}

.community-tabs {
  display: inline-flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.community-tabs a {
  text-decoration: none;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #0f172a;
  padding: 0.36rem 0.72rem;
  font-size: 0.9rem;
}

.hero-strip {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px solid #2f3e57;
  border-radius: 16px;
  background: linear-gradient(90deg, #09101d 0%, #102443 52%, #1b3b5b 100%);
}

.hero-copy {
  margin: 0;
  max-width: 58ch;
  color: #e2e8f0;
  line-height: 1.45;
  font-size: 0.98rem;
}

.hero-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.hero-cta {
  border-color: #2563eb;
  background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
  color: #eff6ff;
  font-weight: 700;
}

.community-grid {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.community-column {
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.8rem;
  margin-bottom: 0.65rem;
}

.section-kicker {
  margin: 0 0 0.12rem;
  color: #93c5fd;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.community-column h2,
#calendarContextTitle {
  margin: 0;
  font-family: 'Do Hyeon', sans-serif;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
}

.section-reset {
  background: #111827;
  border-color: #334155;
  color: #dbeafe;
}

.feed-card {
  border: 1px solid #334155;
  border-radius: 14px;
  background: #0f172a;
  padding: 0.8rem;
}

.feed-card + .feed-card {
  margin-top: 0.55rem;
}

#communityFeedList {
  display: grid;
  gap: 0.55rem;
}

.feed-card-top {
  margin-bottom: 0.45rem;
}

.feed-author-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.feed-author-avatar {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid #60a5fa;
  box-shadow: 0 0 0 2px #0b1220;
}

.feed-author-copy {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
}

.feed-author-name {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: #eff6ff;
}

.feed-author-name-text {
  min-width: 0;
}

.feed-author-flag {
  font-size: 0.95rem;
  line-height: 1;
  flex: 0 0 auto;
}

.feed-meta {
  margin: 0;
  color: #93c5fd;
  font-size: 0.82rem;
}

.feed-card h3 {
  margin: 0.2rem 0 0.25rem;
  font-size: 1.03rem;
}

.feed-card p {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.45;
}

.feed-image-btn {
  margin-top: 0.55rem;
  padding: 0;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  background: #020617;
  width: 100%;
}

.feed-image {
  width: 100%;
  max-height: 220px;
  display: block;
  object-fit: cover;
}

#communityFeedList:empty::before {
  content: "아직 데이터가 없습니다.";
  display: block;
  border: 1px dashed #334155;
  border-radius: 10px;
  padding: 0.7rem;
  color: #94a3b8;
  background: #0b1220;
}

.calendar-shell {
  width: 100%;
}

.calendar-column {
  position: sticky;
  top: 1rem;
}

.calendar-panel {
  min-height: min(78vh, 920px);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  background: linear-gradient(180deg, #171a22 0%, #101319 100%);
  border: 1px solid #2c3240;
  border-radius: 16px;
  overflow: hidden;
}

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1rem 0.7rem;
}

.calendar-title-wrap {
  min-width: 0;
}

#yearLabel {
  margin: 0;
  font-family: 'Do Hyeon', sans-serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: 0.01em;
}

.calendar-meta {
  margin: 0.22rem 0 0;
  color: #93c5fd;
  font-size: 0.86rem;
  line-height: 1.4;
}

.calendar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.month-badge {
  min-width: 2.3rem;
  text-align: center;
  border: 1px solid #4b5563;
  background: #2a2f3a;
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font-weight: 700;
}

button {
  border: 1px solid #4b5563;
  background: #2a2f3a;
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  cursor: pointer;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #171a21;
}

.weekday {
  text-align: center;
  padding: 0.6rem 0.2rem;
  border-right: 1px solid var(--line);
  color: #d1d5db;
  font-weight: 500;
}

.weekday:last-child { border-right: 0; }

.calendar-grid {
  border-bottom: 1px solid var(--line);
  height: 100%;
  grid-template-rows: repeat(var(--weeks, 6), minmax(0, 1fr));
}

.mobile-yesterday-bar {
  display: none;
}

.dry-period-stat {
  margin: 0;
  padding: 0.35rem 1rem 0.55rem;
  color: #dbeafe;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.day-cell {
  position: relative;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.7rem;
}

.day-cell:nth-child(7n) { border-right: 0; }
.day-cell.muted { color: #6b7280; }
.day-cell .num {
  display: block;
  font-size: clamp(1.4rem, 2vw, 2.25rem);
  line-height: 1;
  font-weight: 700;
  margin-bottom: 1.9rem;
}

.drink-mark {
  position: absolute;
  left: 0.45rem;
  top: 0.4rem;
  width: clamp(2.4rem, 3.2vw, 3.4rem);
  height: clamp(2.4rem, 3.2vw, 3.4rem);
  pointer-events: none;
  z-index: 2;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.98;
  mix-blend-mode: screen;
  filter: saturate(1.2) contrast(1.08);
}

.drink-mark::before,
.drink-mark::after {
  content: none;
}

.drink-mark.drank {
  background-image: url('/assets/marks/red-pencil-slash.svg');
  transform: rotate(-3deg);
  left: 0.2rem;
  top: 0.22rem;
  width: clamp(2.7rem, 3.35vw, 3.55rem);
  height: clamp(2.7rem, 3.35vw, 3.55rem);
}

.drink-mark.no-drink {
  background-image: url('/assets/marks/red-pencil-circle.svg');
  transform: rotate(-8deg);
  left: 0.03rem;
  top: 0.02rem;
  width: clamp(3.05rem, 3.9vw, 4.15rem);
  height: clamp(3.05rem, 3.9vw, 4.15rem);
  opacity: 0.97;
}

.write-btn {
  position: absolute;
  top: 2.7rem;
  right: 0.7rem;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid #64748b;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 7px;
  padding: 0;
}

.today-avatar {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}

.account-menu-wrap {
  position: relative;
  z-index: 20;
}

.account-menu-wrap.in-calendar {
  position: absolute;
  top: 2.72rem;
  right: 0.72rem;
  z-index: 10;
}

.today-public-avatar-wrap {
  position: absolute;
  right: 0.55rem;
  top: 0.55rem;
  z-index: 8;
}

.today-public-avatar-wrap.has-user-avatar {
  top: 2.95rem;
}

.today-public-avatar-btn {
  border: 1px solid #60a5fa;
  background: #0f172a;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 0 0 2px #0f1116;
}

.today-public-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.day-public-posts {
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  bottom: 0.45rem;
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: calc(100% - 0.9rem);
  z-index: 7;
}

.public-day-avatar-btn {
  position: relative;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #60a5fa;
  background: #0f172a;
  overflow: hidden;
  box-shadow: 0 0 0 1px #0f1116;
}

.public-day-avatar-btn + .public-day-avatar-btn {
  margin-left: -0.5rem;
}

.public-day-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.public-day-flag {
  position: absolute;
  right: -0.18rem;
  bottom: -0.16rem;
  font-size: 0.58rem;
  line-height: 1;
  background: #0f172a;
  border-radius: 999px;
  box-shadow: 0 0 0 1px #0f1116;
}

.public-day-summary-btn,
.public-day-count-btn {
  font-size: 0.7rem;
  color: #cbd5e1;
  background: #111827;
  border: 1px solid #475569;
  border-radius: 999px;
  padding: 0.08rem 0.35rem;
  line-height: 1.2;
}

.public-day-count-btn {
  margin-left: auto;
  color: #dbeafe;
  background: #0f172a;
}

.today-avatar-btn {
  border: 1px solid #64748b;
  background: #1e293b;
  border-radius: 999px;
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  overflow: hidden;
}

.avatar-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  margin-top: 0.4rem;
  min-width: 150px;
  border: 1px solid #475569;
  border-radius: 10px;
  background: #0f172a;
  box-shadow: 0 10px 20px #00000066;
  overflow: hidden;
}

.avatar-menu-btn {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #1e293b;
  background: transparent;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 0;
  color: #e2e8f0;
}

.avatar-menu-btn:last-child {
  border-bottom: 0;
}

.avatar-menu-btn:hover {
  background: #1e293b;
}

.avatar-menu-btn.danger {
  color: #fca5a5;
}

.public-post-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.public-post-modal[hidden] {
  display: none !important;
}

.feed-image-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
}

.feed-image-modal[hidden] {
  display: none !important;
}

.day-roster-modal {
  position: fixed;
  inset: 0;
  z-index: 1110;
  display: grid;
  place-items: center;
}

.day-roster-modal[hidden] {
  display: none !important;
}

.day-roster-backdrop {
  position: absolute;
  inset: 0;
  background: #000000bf;
  backdrop-filter: blur(3px);
}

.day-roster-dialog {
  position: relative;
  width: min(460px, calc(100vw - 1rem));
  max-height: calc(100dvh - 1rem);
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 16px;
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  padding: 0.95rem;
  box-shadow: 0 24px 80px #00000066;
}

.day-roster-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
}

.day-roster-kicker {
  margin: 0;
  color: #93c5fd;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day-roster-title {
  margin: 0.2rem 0 0.8rem;
  font-family: 'Do Hyeon', sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
}

.day-roster-list {
  display: grid;
  gap: 0.5rem;
}

.day-roster-user {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-align: left;
  border-color: #334155;
  background: #0b1220;
  padding: 0.7rem;
}

.day-roster-avatar {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #60a5fa;
  flex: 0 0 auto;
}

.day-roster-copy {
  min-width: 0;
  display: grid;
  gap: 0.06rem;
}

.day-roster-name {
  color: #eff6ff;
  font-weight: 700;
}

.day-roster-handle {
  color: #93c5fd;
  font-size: 0.82rem;
}

.day-roster-preview {
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.4;
}

.feed-image-backdrop {
  position: absolute;
  inset: 0;
  background: #000000bf;
  backdrop-filter: blur(3px);
}

.feed-image-dialog {
  position: relative;
  width: min(1100px, calc(100vw - 1rem));
  max-height: calc(100dvh - 1rem);
}

.feed-image-close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  z-index: 2;
}

.feed-image-full {
  width: 100%;
  max-height: calc(100dvh - 1rem);
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid #334155;
  background: #020617;
}

.public-post-backdrop {
  position: absolute;
  inset: 0;
  background: #00000080;
  backdrop-filter: blur(4px);
}

.public-post-dialog {
  position: relative;
  width: min(680px, calc(100vw - 1rem));
  max-height: calc(100dvh - 1rem);
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 16px;
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  padding: 0.9rem;
  box-shadow: 0 24px 80px #00000066;
}

.public-post-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  padding: 0;
}

.public-post-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-right: 2.2rem;
}

.public-post-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #475569;
  background: #1e293b;
}

.public-post-author {
  margin: 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.public-post-country-flag {
  font-size: 1rem;
  line-height: 1;
}

.public-post-handle {
  margin: 0.05rem 0 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

.public-post-image-wrap {
  margin-top: 0.8rem;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  background: #020617;
}

.public-post-image {
  display: block;
  width: 100%;
  max-height: 42dvh;
  object-fit: contain;
  object-position: center;
}

.public-post-title {
  margin: 0.75rem 0 0.15rem;
  font-family: 'Do Hyeon', sans-serif;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
}

.public-post-date {
  margin: 0;
  color: #93c5fd;
  font-size: 0.9rem;
}

.public-post-body {
  margin: 0.7rem 0 0;
  white-space: pre-wrap;
  line-height: 1.6;
  color: #e5e7eb;
}

.write-btn svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.weekday.sun,
.day-cell.sun .num { color: var(--sunday); }
.weekday.sat,
.day-cell.sat .num { color: var(--weekend); }
.day-cell.today .num { color: var(--today); }

@media (max-width: 768px) {
  .community-shell {
    width: calc(100vw - 1rem);
    padding-top: 0.7rem;
  }

  .brand-subcopy {
    max-width: none;
    font-size: 0.88rem;
  }

  .community-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .calendar-column {
    position: static;
  }

  .hero-strip {
    margin-top: 0.6rem;
    padding: 0.75rem 0.8rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-shell {
    width: 100%;
  }

  .calendar-panel {
    min-height: calc(100dvh - 1.2rem);
    grid-template-rows: auto auto auto auto 1fr;
    border-radius: 12px;
  }

  .calendar-toolbar {
    padding: 0.8rem 0.7rem 0.55rem;
  }

  #yearLabel {
    font-size: clamp(1.6rem, 8vw, 2.2rem);
  }

  .weekday {
    padding: 0.45rem 0.1rem;
    font-size: 0.92rem;
  }

  .mobile-yesterday-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem 0.6rem;
    border-top: 1px solid #232a37;
    border-bottom: 1px solid #2d3645;
    background: #121722;
  }

  .mobile-yesterday-label {
    margin: 0;
    font-size: 0.86rem;
    color: #cbd5e1;
    letter-spacing: 0.01em;
  }

  .mobile-yesterday-btn {
    border-color: #2563eb;
    background: #1d4ed8;
    color: #eff6ff;
    padding: 0.32rem 0.62rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
  }

  .dry-period-stat {
    padding: 0.3rem 0.7rem 0.5rem;
    font-size: 0.82rem;
  }

  .day-cell {
    min-height: 0;
    height: auto;
    padding: 0.5rem 0.38rem;
  }

  .day-cell .num {
    font-size: clamp(1rem, 4.6vw, 1.4rem);
    margin-bottom: 1.6rem;
  }

  .drink-mark {
    left: 0.25rem;
    top: 0.35rem;
    width: 2.4rem;
    height: 2.4rem;
  }

  .drink-mark.drank {
    left: 0.02rem;
    top: 0.12rem;
    width: 2.45rem;
    height: 2.45rem;
  }

  .drink-mark.no-drink {
    left: -0.03rem;
    top: -0.02rem;
    width: 2.85rem;
    height: 2.85rem;
  }

  .write-btn {
    top: 2.1rem;
    right: 0.38rem;
    width: 1.3rem;
    height: 1.3rem;
  }

  .today-avatar {
    width: 1.2rem;
    height: 1.2rem;
  }

  .account-menu-wrap.in-calendar {
    top: 2.15rem;
    right: 0.38rem;
  }

  .today-avatar-btn {
    width: 1.25rem;
    height: 1.25rem;
  }

  .avatar-menu.mobile-centered {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-top: 0;
    width: min(280px, calc(100vw - 1.4rem));
    z-index: 1200;
    border-radius: 12px;
    box-shadow: 0 18px 36px #00000099;
  }

  .avatar-menu-backdrop {
    position: fixed;
    inset: 0;
    background: #00000066;
    backdrop-filter: blur(1px);
    z-index: 1190;
  }

  .today-public-avatar-wrap {
    top: 0.5rem;
    right: 0.45rem;
  }

  .today-public-avatar-wrap.has-user-avatar {
    top: 2.75rem;
  }

  .day-public-posts {
    left: 0.35rem;
    right: 0.35rem;
    bottom: 0.35rem;
    gap: 0.2rem;
    max-width: calc(100% - 0.7rem);
  }

  .public-day-avatar-btn {
    width: 1.2rem;
    height: 1.2rem;
  }

  .public-day-flag {
    font-size: 0.5rem;
  }

  .public-day-summary-btn,
  .public-day-count-btn {
    font-size: 0.62rem;
    padding: 0.05rem 0.28rem;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .public-post-dialog {
    width: calc(100vw - 0.6rem);
    max-height: calc(100dvh - 0.6rem);
    padding: 0.75rem;
    border-radius: 14px;
  }

  .day-roster-dialog {
    width: calc(100vw - 0.6rem);
    max-height: calc(100dvh - 0.6rem);
    padding: 0.75rem;
    border-radius: 14px;
  }

}
