/* ===========================================================
   씹능아 — B급 병맛 시작 스킨.
   ⚠️ 능아 캐릭터/색감 정해지면 여기 변수랑 .mascot 만 갈아끼우면 됨.
   =========================================================== */
:root {
  --hot: #ff2e88;
  --hot2: #ffd23f;
  --ink: #1b1b2f;
  --pass: #18c37d;
  --fail: #ff4d4d;
  --review: #ff9f1c;
  --card: #ffffff;
  --bg: #fff0f6;
}

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

/* [hidden] 가 display:flex/inline-flex 보다 약해서 안 숨던 버그 방지.
   속성 선택자(specificity 0,2,0)로 확실히 눌러줌. */
.whoami[hidden],
.modal-backdrop[hidden],
.me-chip[hidden],
.lightbox[hidden],
.preview[hidden],
.toast[hidden] {
  display: none !important;
}
body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui,
    sans-serif;
  background: repeating-linear-gradient(
      45deg,
      var(--bg),
      var(--bg) 22px,
      #ffe3ef 22px,
      #ffe3ef 44px
    );
  color: var(--ink);
  padding-bottom: 100px;
}

/* ---------- topbar ---------- */
.topbar {
  text-align: center;
  padding: 18px 14px 22px;
  background: linear-gradient(135deg, var(--hot), #ff6ad5);
  color: #fff;
  border-bottom: 5px dashed var(--hot2);
  position: relative;
}
.mascot {
  font-size: 54px;
  line-height: 1;
  animation: jiggle 1.4s ease-in-out infinite;
}
@keyframes jiggle {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.08); }
}
.logo {
  font-size: 40px;
  margin: 6px 0 2px;
  font-weight: 900;
  text-shadow: 3px 3px 0 var(--ink);
  letter-spacing: 2px;
}
.logo span {
  color: var(--hot2);
}
.tagline {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 13px;
  opacity: 0.95;
}
.scoreboard {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.score-chip {
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 2px 2px 0 var(--ink);
}
.score-chip b {
  color: var(--hot);
}

/* ---------- tabs ---------- */
.tabs {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  background: var(--ink);
  border-bottom: 3px solid var(--ink);
}
.tab {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.tab.active {
  background: var(--hot2);
  color: var(--ink);
  opacity: 1;
}

/* ---------- feed ---------- */
.feed {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 12px;
}
.loading {
  text-align: center;
  padding: 40px;
  font-weight: 700;
}
.day-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 16px;
  margin-bottom: 18px;
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
}
.day-head {
  background: var(--hot2);
  padding: 8px 14px;
  font-weight: 900;
  font-size: 16px;
  border-bottom: 3px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.day-dow {
  font-size: 13px;
  opacity: 0.7;
}
.day-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.cell {
  padding: 12px;
  border-right: 2px dashed #ddd;
}
.cell:last-child {
  border-right: none;
}
.cell-user {
  font-weight: 900;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}
.badge.pass { background: var(--pass); }
.badge.fail { background: var(--fail); }
.badge.review { background: var(--review); }
.badge.none { background: #b8b8c8; }

.empty-cell {
  color: #b8b8c8;
  font-weight: 800;
  padding: 14px 0;
  text-align: center;
  font-size: 22px;
}
.empty-cell.pending {
  color: #c9a227;
  font-size: 14px;
}

/* 관리 컨트롤 (삭제/수동 오버라이드) */
.entry-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.mini-btn {
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  background: #fff;
  cursor: pointer;
  line-height: 1.4;
}
.mini-btn.ok { background: #e6fff4; }
.mini-btn.no { background: #fff0f0; }
.mini-btn.del { margin-left: auto; }
.mini-btn:active { transform: translateY(1px); }
.entry {
  margin-bottom: 12px;
}
.thumbs {
  display: flex;
  gap: 6px;
  margin: 6px 0;
  flex-wrap: wrap;
}
.thumbs img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--ink);
  cursor: pointer;
}
.times {
  font-size: 13px;
  font-weight: 700;
}
.times .dur {
  color: var(--hot);
}
.reason {
  font-size: 12px;
  color: #555;
  margin-top: 3px;
}
.warn {
  font-size: 12px;
  color: var(--fail);
  font-weight: 700;
  margin-top: 3px;
}

/* ---------- FAB + modal ---------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--hot);
  color: #fff;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  z-index: 20;
}
.fab:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 30;
}
.modal {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 20px 20px 0 0;
  border: 3px solid var(--ink);
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
}
.modal h2 {
  margin: 0 0 14px;
  font-weight: 900;
}
.modal-close {
  position: absolute;
  right: 14px;
  top: 14px;
  border: none;
  background: none;
  font-size: 22px;
  cursor: pointer;
}
.field-label {
  display: block;
  font-weight: 800;
  margin: 14px 0 6px;
  font-size: 14px;
}
.user-pick {
  display: flex;
  gap: 10px;
}
.user-pick button {
  flex: 1;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
}
.user-pick button.active {
  background: var(--hot);
  color: #fff;
}
.photo-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.photo-slot {
  flex: 1;
  border: 3px dashed var(--ink);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  text-align: center;
}
.slot-title {
  font-weight: 900;
  font-size: 14px;
}
.slot-hint {
  font-size: 11px;
  color: #888;
}
.photo-slot input[type='file'] {
  font-size: 11px;
  width: 100%;
}
.preview {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 6px;
}
.submit-btn {
  width: 100%;
  margin-top: 18px;
  padding: 15px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--hot2);
  font-weight: 900;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}
.submit-btn:disabled {
  opacity: 0.5;
}
.submit-status {
  margin-top: 12px;
  font-weight: 700;
  text-align: center;
  white-space: pre-line;
}

/* ---------- avatar ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--hot2);
  border: 2px solid var(--ink);
  position: relative;
  flex: 0 0 auto;
  vertical-align: middle;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}
.avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.78em;
  color: var(--ink);
  z-index: 0;
}
.avatar-sm { width: 24px; height: 24px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-xl {
  width: 110px;
  height: 110px;
  border-width: 4px;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 44px;
}

/* ---------- whoami (입장 화면) ---------- */
.whoami {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: linear-gradient(160deg, var(--hot), #ff6ad5 70%, var(--hot2));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.whoami-card {
  text-align: center;
  color: #fff;
}
.whoami-card h2 {
  font-size: 30px;
  font-weight: 900;
  margin: 6px 0 2px;
  text-shadow: 3px 3px 0 var(--ink);
}
.whoami-sub {
  margin: 0 0 26px;
  font-weight: 700;
  opacity: 0.95;
}
.whoami-users {
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
}
.whoami-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.whoami-btn:active {
  transform: scale(0.94);
}
.whoami-name {
  font-weight: 900;
  font-size: 17px;
  background: #fff;
  color: var(--ink);
  padding: 4px 14px;
  border-radius: 999px;
  border: 3px solid var(--ink);
}

/* ---------- me chip (헤더 신원) ---------- */
.me-chip {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.me-switch {
  font-size: 11px;
  color: var(--hot);
  font-weight: 800;
  text-decoration: underline;
}

/* ---------- modal identity ---------- */
.modal-me {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 2px dashed var(--ink);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 6px;
}
.modal-me .me-switch {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
}
.modal textarea {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 8px;
  font: inherit;
  resize: vertical;
  margin-top: 4px;
}

/* ---------- 식단 카드 ---------- */
.meal-list {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.meal-card {
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 10px;
  background: #fffdf7;
}
.meal-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
}
.meal-time {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  color: var(--hot);
}
.meal-memo {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: pre-line;
}

/* ---------- 라이트박스 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  border: 3px solid #fff;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  z-index: 40;
  box-shadow: 3px 3px 0 var(--hot);
  max-width: 90vw;
  text-align: center;
}
