/* 라운지 전용. 공통 토큰과 요소 스타일은 patch.css에 있습니다. */

.hub-page {
  display: flex;
  flex-direction: column;
}

/* ---------- 머리 ---------- */
.club-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 28px;
  width: min(1200px, 100% - 32px);
  margin: 0 auto;
  padding: 20px 0 18px;
}

.club-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-patch {
  width: 30px;
  height: 30px;
}

.brand-name {
  font-size: var(--text-md);
  font-weight: 820;
  letter-spacing: -.03em;
}

.club-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.club-nav a {
  padding: 6px 0;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 650;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.club-nav a:hover {
  border-bottom-color: var(--seam-strong);
}

/* ---------- 이어하기 ---------- */
.lounge {
  flex: 1;
  width: min(1200px, 100% - 32px);
  margin: 0 auto;
}

.resume-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--seam-width);
  margin-bottom: 14px;
  padding: 0;
  border: var(--seam-width) solid var(--seam);
  border-radius: var(--radius);
  background: var(--seam);
}

.resume-link {
  flex: 1 1 240px;
  padding: 12px 16px;
  background: var(--mugwort);
  color: var(--on-dye);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
}

.resume-link:hover {
  background: #336648;
}

.resume-link:focus-visible {
  outline: 2px solid var(--on-dye);
  outline-offset: -6px;
}

/* ---------- 조각보 ---------- */
.cloth {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "intro intro intro intro intro intro intro blokus blokus blokus blokus blokus"
    "pres  pres  pres  pres  dav   dav   dav   blokus blokus blokus blokus blokus"
    "halli halli halli halli live  live  how  how    how    how    me     me"
    "chat  chat  chat  chat  chat  chat  chat chat   chat   chat   chat   chat";
  gap: var(--seam-width);
  padding: 0;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--seam-strong);
  overflow: hidden;
}

.patch {
  position: relative;
  min-width: 0;
  padding: clamp(18px, 2.4vw, 32px);
  background: var(--sheet);
}

.patch-intro { grid-area: intro; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
.game-blokus { grid-area: blokus; }
.game-president { grid-area: pres; }
.game-davinci { grid-area: dav; }
.game-halli { grid-area: halli; }
.patch-how { grid-area: how; }
/* 맨 아래 줄: 지금 접속 인원과 내 기록 */
.patch-live { grid-area: live; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; background: var(--indigo); color: var(--on-dye); }
.live-count { font-size: clamp(40px, 5vw, 64px); font-weight: 900; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.live-label { font-size: var(--text-sm); font-weight: 700; line-height: 1.35; }
.patch-me { grid-area: me; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; background: var(--safflower-tint); }
.patch-me h2 { font-size: var(--text-lg); font-weight: 800; }
.patch-me p { color: var(--ink-soft); font-size: var(--text-sm); }
.patch-me strong { display: block; color: var(--ink); font-size: clamp(20px, 1.9vw, 30px); font-weight: 900; letter-spacing: -.03em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.patch-me .btn { align-self: flex-start; white-space: nowrap; }
/* 라운지 대화: 맨 아래 한 줄 전체. 누구나 읽고, 로그인하면 씁니다. */
.patch-chat { grid-area: chat; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block: clamp(16px, 2vw, 24px); }
.lounge-chat-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.lounge-chat-head h2 { font-size: var(--text-lg); font-weight: 800; }
.lounge-chat-note { color: var(--ink-soft); font-size: var(--text-sm); }
.lounge-chat-log {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: clamp(180px, 26vh, 300px);
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: var(--seam-width) solid var(--seam);
  border-radius: var(--radius-small);
  background: color-mix(in srgb, var(--sheet) 55%, #fff);
}
.lounge-chat-log:empty::before { content: '아직 대화가 없어요. 첫 인사를 남겨 보세요.'; margin: auto; color: var(--ink-soft); font-size: var(--text-sm); }
.lounge-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 8px; padding: 4px 6px; border-radius: var(--radius-small); }
.lounge-line.mine { background: color-mix(in srgb, var(--gardenia) 22%, transparent); }
.lounge-line.fresh { animation: lounge-in 360ms var(--ease); }
@keyframes lounge-in { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
.lounge-who { font-weight: 800; white-space: nowrap; max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.lounge-who .lounge-admin { margin-left: 4px; padding: 0 4px; border-radius: 3px; background: var(--ink); color: var(--gardenia); font-size: var(--text-xs); font-weight: 800; vertical-align: 1px; }
.lounge-text { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.lounge-meta { display: flex; align-items: baseline; gap: 6px; color: var(--ink-soft); font-size: var(--text-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lounge-hide { padding: 0 4px; border: 0; background: none; color: var(--safflower); font: inherit; font-weight: 700; cursor: pointer; }
.lounge-hide:hover { text-decoration: underline; }
.lounge-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.lounge-chat-form input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius-small);
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
}
.lounge-chat-form input:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }
.lounge-chat-form input:disabled { background: color-mix(in srgb, var(--sheet) 70%, var(--seam)); }
.lounge-chat-form .btn { height: 42px; white-space: nowrap; }
.lounge-chat-error { color: var(--safflower); font-size: var(--text-sm); }
@media (prefers-reduced-motion: reduce) { .lounge-line.fresh { animation: none; } }
@media (max-width: 600px) {
  .lounge-line { grid-template-columns: minmax(0, 1fr) auto; }
  .lounge-text { grid-column: 1 / -1; grid-row: 2; }
}

.patch-intro h1 {
  font-size: var(--text-display);
  font-weight: 830;
  letter-spacing: -.045em;
  line-height: 1.02;
}

.patch-intro p {
  max-width: 34em;
  color: var(--ink-soft);
  font-size: var(--text-md);
}

.patch-intro strong {
  color: var(--ink);
}

/* 게임 조각: 조각 전체가 하나의 링크 */
.patch-game {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  min-height: 250px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color var(--quick) var(--ease);
}

.patch-game:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: -9px;
}

.game-text {
  display: grid;
  gap: 6px;
}

.patch-game h2 {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -.035em;
}

.patch-game:hover h2 {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .18em;
}

.game-line {
  max-width: 26em;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.game-facts {
  font-size: var(--text-xs);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* 조각마다 다른 물 */
.game-blokus { background: var(--indigo-tint); }
.game-blokus:hover { background: #c6d3e5; }
.game-blokus .game-line, .game-blokus .game-facts { color: var(--ink-soft); }

.game-president { background: var(--safflower); color: var(--on-dye); }
.game-president:hover { background: #a62c38; }

.game-davinci { background: var(--ink); color: var(--on-dye); }
.game-davinci:hover { background: #262e2a; }

.game-halli { background: var(--gardenia); }
.game-halli:hover { background: #d69b1d; }

.patch-how { background: var(--mugwort); color: var(--on-dye); }

.patch-how h2 {
  font-size: var(--text-lg);
  font-weight: 780;
}

.patch-how ol {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding-left: 1.3em;
  font-size: var(--text-sm);
}

.patch-how li::marker {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- 조각 그림 ---------- */
.art {
  align-self: flex-start;
}

.art-blokus {
  --cell: clamp(22px, 3.1vw, 42px);
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(8, var(--cell));
  gap: 2px;
  align-self: flex-end;
  padding: 2px;
  background: #b9c6d8;
}

.art-blokus i {
  grid-column: var(--x);
  grid-row: var(--y);
  border-radius: 1px;
}

.c-blue { background: var(--piece-blue); }
.c-yellow { background: var(--piece-yellow); }
.c-red { background: var(--piece-red); }
.c-green { background: var(--piece-green); }

.art-cards {
  display: flex;
  padding-left: 6px;
}

.mini-card {
  display: grid;
  align-content: space-between;
  width: 54px;
  height: 76px;
  margin-left: -14px;
  padding: 6px 7px;
  border: 1.5px solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  font-size: var(--text-md);
  font-weight: 800;
  line-height: 1;
  transform: rotate(var(--turn, 0deg));
  transform-origin: 50% 100%;
}

.mini-card:first-child { margin-left: 0; --turn: -7deg; }
.mini-card:last-child { --turn: 7deg; }
.mini-card i { justify-self: end; font-style: normal; font-size: var(--text-lg); }
.mini-card.red { color: var(--safflower); }

.patch-game:hover .mini-card:first-child { --turn: -11deg; }
.patch-game:hover .mini-card:last-child { --turn: 11deg; }
.mini-card { transition: transform var(--steady) var(--ease); }

.art-tiles {
  display: flex;
  gap: 4px;
}

.mini-tile {
  display: grid;
  place-items: center;
  width: 30px;
  height: 44px;
  border-radius: var(--radius-small);
  font-size: var(--text-md);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mini-tile.dark { background: #36413c; color: var(--on-dye); border: 1.5px solid #6b7670; }
.mini-tile.light { background: var(--sheet); color: var(--ink); border: 1.5px solid var(--sheet); }
.mini-tile.hidden-tile::after {
  content: "";
  width: 12px;
  height: 2px;
  background: currentColor;
  opacity: .6;
}

.art-fruit {
  display: flex;
  gap: 8px;
}

.mini-fruit-card {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  height: 84px;
  padding: 6px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--sheet);
}

.mini-fruit-card img {
  width: 22px;
  height: 22px;
}

/* ---------- 꼬리 ---------- */
.club-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  width: min(1200px, 100% - 32px);
  margin: 0 auto;
  padding: 20px 0 28px;
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

/* ---------- 좁은 화면 ---------- */
@media (max-width: 959px) {
  .cloth {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "intro intro intro intro intro intro"
      "blokus blokus blokus blokus blokus blokus"
      "pres pres pres dav dav dav"
      "halli halli halli halli live live"
      "how how how how me me"
      "chat chat chat chat chat chat";
  }

  .game-blokus { flex-direction: row; align-items: flex-end; }
}

@media (max-width: 600px) {
  .club-header { position: relative; padding-top: 14px; }
  .club-nav { gap: 2px 16px; }
  /* 계정 버튼은 상표 줄 오른쪽 끝에 올립니다(게임 메뉴 뒤에 붙으면 혼자 셋째 줄로 떨어집니다). */
  .club-nav .account-chip { position: absolute; top: 13px; right: 0; }

  .cloth {
    grid-template-columns: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "intro intro" "blokus blokus" "pres pres" "dav dav" "halli halli" "live me" "chat chat" "how how";
  }

  .patch-game { min-height: 0; }
  .game-blokus { flex-direction: column; align-items: stretch; }
  .art-blokus { align-self: flex-start; --cell: 15px; }
}

@media (max-width: 359px) {
  /* 상표와 한 줄에 두려고, 게임 화면처럼 닉네임 첫 글자만 담은 칸으로 줄입니다. */
  .club-header .account-chip { flex: none; width: 40px; min-width: 40px; height: 36px; padding: 0; overflow: visible; font-size: 0; }
  .club-header .account-chip::before { content: attr(data-initial); font-size: 14px; font-weight: 850; }
}
