.home-page {
  max-width: 1400px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}

@media (max-width: 600px) {
  .home-page {
    width: calc(100% - 12px);
  }
}

.home-floating-actions {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  gap: 10px;
}

.widget-heading {
  color: var(--color-base-deep);
  font-size: 20px;
  margin: 0 0 10px;
  font-family: var(--font-heading);
}

.empty-msg {
  color: var(--color-sub-light);
  font-size: 0.85rem;
  text-align: center;
  padding: 10px 0;
}

/* ---------- Dashboard grid ---------- */

.home-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-areas:
    "album album yt yt"
    "album album today today"
    "bottomrow bottomrow bottomrow bottomrow";
  /* The hero row (album + yt) previously had no minimum height, so it just
     auto-sized to whatever the youtube embed's 16:9 aspect-ratio happened to
     produce at that column width — a modest ~190px, nowhere near the large
     photo-forward hero from the reference. This floor makes both hero cards
     genuinely large; the middle row still auto-sizes to 오늘의 일정's content. */
  /* Row 1 (album's top half + yt) is smaller than before, and row 2 (album's
     bottom half + 오늘의 일정) now has its own floor instead of auto-sizing to
     whatever the schedule list's content happened to need — the net effect is
     the banner/youtube shrink a bit while 오늘의 일정 grows, using the space
     freed from row 1 without changing 앨범's own overall height much (it still
     spans both rows). */
  grid-template-rows: minmax(320px, auto) minmax(260px, auto) auto;
  gap: 16px;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* Same pattern as .page-content in theme.css (schedule/upbo/songbook) — home
   uses its own dashboard grid instead of that shared class, so it needs its
   own copy of the rule. */
.home-dashboard.content-loading {
  opacity: 0;
  transform: translateY(10px);
}

.home-widget {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(244, 168, 195, 0.22);
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
}

.widget-album {
  grid-area: album;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Hero-scale cards (character photo, video thumbnail) get a bigger radius
   than the smaller cards below, mirroring how the reference design escalates
   size with a card's visual prominence. Both also sit directly above another
   card with only a 16px row gap (album → 공지/방송상태 in bottomrow, yt →
   오늘의 일정) — --shadow-glow's 40px blur reached past that gap and visibly
   bled onto whatever was below, so both get the smaller shadow the regular
   cards use instead of the full hero glow. */
.widget-album,
.widget-yt {
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
}

.widget-live {
  flex: 1.3;
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  transition: transform .1s ease;
}

.widget-live.is-disabled {
  cursor: default;
  /* No thumbnail image to sit the caption over when offline, so bottom-align
     (meant for the LIVE state's photo overlay) just left the text pinned to
     the bottom edge of an otherwise empty card. Vertically centered reads
     correctly for a plain status message instead — horizontally it stays
     left-aligned, matching the reference (only the up-down position moves). */
  align-items: center;
}

/* .widget-caption is position:absolute + bottom:0 by default (needed to sit
   the LIVE state's caption over the bottom of a photo) — that overrides any
   flex alignment entirely, which is why align-items:center above alone did
   nothing. Releasing it back into normal flow only when offline (no photo
   underneath to anchor to) is what actually lets the centering take effect. */
.widget-live.is-disabled .widget-caption {
  position: static;
  padding: 16px;
}

.widget-live.is-disabled:hover {
  transform: none;
}

.widget-live:hover {
  transform: translateY(-2px);
}

.live-chip {
  left: auto;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  background: rgba(20, 20, 20, 0.7);
  font-weight: bold;
  letter-spacing: 0.5px;
}

.live-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3b30;
  flex-shrink: 0;
}

.widget-today {
  grid-area: today;
  padding: 20px 22px;
}

.widget-notice {
  flex: 1.7;
  padding: 20px 22px;
}

.widget-yt {
  grid-area: yt;
  height: 100%;
}

.home-bottom-row {
  grid-area: bottomrow;
  display: grid;
  /* Independent of the album/yt column split above — this is where 공지 +
     방송상태 get most of the width, 디데이 stays narrow, and the shortcut
     buttons take what's left. Free to cross past the visual centre line. */
  grid-template-columns: 2.9fr 0.6fr 1fr;
  /* Named areas (rather than relying on auto-placement) keep each child
     pinned to its own column even while 디데이 is display:none before its
     data loads — auto-placement would otherwise close the gap and slide the
     shortcut buttons into 디데이's column, then visibly snap back over once
     it appears. Named areas hold that column's width reserved regardless. */
  grid-template-areas: "bottomleft dday navgrid";
  gap: 16px;
  align-items: stretch;
}

.dashboard-row-bottom-left {
  grid-area: bottomleft;
  display: flex;
  gap: 16px;
}

.nav-mini-grid {
  grid-area: navgrid;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
}

.widget-dday {
  grid-area: dday;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
  text-align: center;
}

.dday-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dday-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dday-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--color-base-deep);
  font-family: var(--font-heading);
}

.dday-item + .dday-item {
  border-top: 1px solid #f4dde5;
  padding-top: 10px;
}

@media (max-width: 720px) {
  .home-dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "album"
      "yt"
      "today"
      "bottomrow";
    /* Desktop's 3-row height template doesn't match mobile's 4 stacked areas
       (album and yt split into separate rows here) — reset explicitly with a
       smaller hero minimum suited to phone width. */
    grid-template-rows: minmax(300px, auto) auto auto auto;
  }
  .home-bottom-row {
    grid-template-columns: 1fr;
    /* This was the actual bug: only the column COUNT was reduced to 1 here,
       but the area MAP (inherited from desktop) still described a single row
       with three side-by-side slots — a 1-column track trying to satisfy a
       3-across map is what squished 디데이 and effectively hid pieces of the
       row instead of each section getting its own line. */
    grid-template-areas:
      "bottomleft"
      "dday"
      "navgrid";
  }
  .dashboard-row-bottom-left {
    flex-direction: column;
  }
  .widget-album {
    height: 300px;
  }
  /* Desktop's .widget-yt / .youtube-embed-wrap fill height:100% of their
     explicit hero-row height. On mobile that row is auto-sized instead — a
     height:100% child inside an auto-height row has nothing definite to fill,
     which computed to 0 and made the video widget effectively disappear.
     Restoring a real aspect-ratio here makes it self-sizing again. */
  .widget-yt {
    height: auto;
  }
  .youtube-embed-wrap {
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .widget-dday {
    flex-direction: row;
    justify-content: center;
  }
  .dday-item + .dday-item {
    border-top: none;
    border-left: 1px solid #f4dde5;
    padding-top: 0;
    padding-left: 16px;
  }
}

/* ---------- Album (full-bleed, no label) ---------- */

.album-carousel {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  background: var(--color-bg);
}

.album-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
}

.album-track img {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}

.album-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 340px;
  color: var(--color-sub-light);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* ---------- Live widget ---------- */

.live-caption {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
}

.widget-live.has-thumbnail::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.5) 0%,
    transparent 25%,
    transparent 65%,
    rgba(0, 0, 0, 0.75) 100%
  );
  pointer-events: none;
}

.widget-live.has-thumbnail .live-caption {
  position: relative;
  z-index: 2;
}

.widget-live.has-thumbnail .live-text,
.widget-live.has-thumbnail .live-sub {
  color: #ffffff;
}

.live-text {
  font-family: var(--font-heading);
  font-size: 17px;
  color: var(--color-text);
  font-weight: normal;
}

.live-sub {
  font-size: 13px;
  color: var(--color-sub-light);
  margin-top: 2px;
}

/* ---------- Today's schedule ---------- */

.widget-today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.widget-today-header .widget-heading {
  margin: 0;
}

.today-date-badge {
  background: #fdf1f1;
  color: var(--color-base-deep);
  border-radius: var(--radius-full);
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 700;
}

.today-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.upcoming-schedule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.upcoming-schedule-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upcoming-schedule-label {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--color-base-deep);
  margin-bottom: 4px;
}

.upcoming-schedule-text {
  font-size: 15px;
  color: #5c4a4f;
  font-weight: 600;
  background: #fff7f9;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: inset 0 0 0 1px rgba(244, 168, 195, 0.2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-schedule-text + .upcoming-schedule-text {
  margin-top: 4px;
}

/* Just adds the pointer cursor on top of the box styling above — the box
   shape itself (same as 오늘의 일정's badges) already signals it's clickable,
   so no separate hover color change is needed. */
.upcoming-schedule-clickable {
  cursor: pointer;
}

.today-schedule-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
  column-gap: 8px;
  background: #fff7f9;
  color: #5c4a4f;
  font-weight: 600;
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(244, 168, 195, 0.2);
  cursor: pointer;
}

/* Groups one event's time-badge + title together so, when there are several
   events in one box, a pair wraps to the next line as a unit instead of the
   time badge splitting away from its own title. */
.today-schedule-pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.today-schedule-time {
  background: #ffffff;
  color: var(--color-base-deep);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.day-events-list-title {
  text-align: center;
  font-size: 1.15rem;
}

.today-schedule-more {
  display: inline-block;
  background: #fdf1f1;
  color: var(--color-base-deep);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  text-decoration: none;
}

/* ---------- Notice ---------- */

.notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.notice-tag {
  background: var(--color-base-deep);
  color: #ffffff;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

.notice-date {
  color: var(--color-sub-light);
  font-size: 0.75rem;
}

.notice-image {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  max-height: 140px;
  object-fit: cover;
}

.notice-title {
  font-family: var(--font-heading);
  font-weight: normal;
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.notice-desc {
  color: var(--color-sub);
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notice-more {
  display: inline-block;
  margin-top: 10px;
  color: var(--color-base-deep);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- YouTube (embedded player, full width) ---------- */

.youtube-embed-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000000;
}

.youtube-embed-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.youtube-embed-wrap .empty-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

/* ---------- Station widget (bg image + label chip) ---------- */

.widget-bg-img {
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

.widget-label-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.75rem;
}

.widget-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 24px 12px 10px;
  font-size: 0.85rem;
}

/* ---------- Nav shortcuts (small 2x2 grid) ---------- */

.nav-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 14px rgba(244, 168, 195, 0.22);
  color: var(--color-sub);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .1s ease, color .1s ease, box-shadow .1s ease;
}

.nav-shortcut:hover {
  color: var(--color-base-deep);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(244, 168, 195, 0.14);
}

/* ---------- Edit panel ---------- */

.home-edit-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
  border: 1px dashed var(--color-base);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 18px;
}

.home-edit-panel label {
  font-size: 0.85rem;
  color: var(--color-sub);
  margin-top: 14px;
  margin-bottom: 4px;
}

.home-edit-panel label:first-of-type {
  margin-top: 4px;
}

.home-edit-panel input,
.home-edit-panel textarea,
.home-edit-panel select {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-base);
  background: #ffffff;
  color: var(--color-text);
  font-family: 'Noto Sans KR', sans-serif;
}

.album-edit-row {
  display: flex;
  gap: 8px;
}

.dday-edit-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.dday-edit-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.dday-edit-row input[type="date"] {
  flex-shrink: 0;
  width: auto;
}

.album-edit-row input {
  flex: 1;
}

.album-edit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.album-edit-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 6px 10px;
}

.album-edit-list-row img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.album-edit-list-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--color-sub);
}

.upbo-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: #f8d7da;
  border: none;
  border-radius: 50%;
  color: #a83a4a;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}

.upbo-remove-btn:hover {
  background: var(--color-base-deep);
  color: #ffffff;
}

/* ---------- Event members popup (mirrors schedule page styling) ---------- */

.event-members-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 4px;
}

.event-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  width: 64px;
}

.event-member img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-bg);
}

.event-member span {
  font-size: 0.8rem;
  color: var(--color-sub-light);
  line-height: 1.2;
  word-break: keep-all;
}

.event-member.no-image {
  justify-content: center;
}

/* Matches the schedule page: gray silhouette for names SOOP doesn't know. */
.event-member.no-image::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #ececf0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b6b1b8'%3E%3Cpath d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-4.4 0-8 2.4-8 5.3V22h16v-2.7c0-2.9-3.6-5.3-8-5.3Z'/%3E%3C/svg%3E");
  background-size: 74%;
  background-position: center;
  background-repeat: no-repeat;
}

.event-member-banner.no-image::before {
  display: none;
}

.event-member-banner {
  width: 100%;
}

.event-member-banner img {
  width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: var(--radius-lg);
  object-fit: contain;
}

/* ---------- Event members popup: centered title + time (mirrors schedule) ---------- */

