/* CozyPuzzle refresh (cz7) — presentation layer only.
   Keeps the original top bar, footer and backgrounds; tidies the lobby, adds the side panels.
   To undo, remove the <link href="/cozy-refresh.css"> line from the pages. */

/* ---------- hero: compact, straight, no badges ---------- */
.portal:not(.paintPortal) .playFacts { display: none !important; }
.portal:not(.paintPortal) .playDescription { display: none !important; }
.portal:not(.paintPortal) .playPanel {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: center;
  gap: 24px;
  padding: 24px 28px !important;
  text-align: left;
}
.portal:not(.paintPortal) .playHeading { display: flex !important; align-items: center; gap: 16px; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; }
.portal:not(.paintPortal) .playChoices { display: flex !important; flex-direction: column; gap: 12px; margin: 0 !important; border: 0 !important; }
.portal:not(.paintPortal) .playChoice { padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; }
.portal:not(.paintPortal) .playChoice + .playChoice { border: 0 !important; }
.portal:not(.paintPortal) .playChoice .choiceIcon,
.portal:not(.paintPortal) .playChoice h2,
.portal:not(.paintPortal) .playChoice p { display: none !important; }
.portal:not(.paintPortal) .playChoice button { width: 100%; margin: 0 !important; }
@media (max-width: 760px) {
  .portal:not(.paintPortal) .playPanel { grid-template-columns: 1fr; }
}

/* ---------- old "more games" blocks and the Friends tab move to the side panels ---------- */
.portal .dailyGames,
body.portal .sketch-more,
[data-table-tab="friends"],
[data-table-panel="friends"],
[data-paint-tab="friends"],
[data-paint-panel="friends"] { display: none !important; }

/* ---------- table / room rows: no overlap, previews stay inside ---------- */
.portal .roomList { display: flex !important; flex-direction: column; gap: 12px !important; }
.portal .roomList > * { margin: 0 !important; }
.portal .tableCard { align-items: center; overflow: hidden; }
.portal .tablePicture { flex: none; width: 64px !important; height: 64px !important; overflow: hidden; border-radius: 8px; }
.portal .tablePicture img { width: 100% !important; height: 100% !important; object-fit: cover; }
.portal .tableCardMain { min-width: 0; }
.portal .tableCardMain > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- three-column shell (built by cozy-social.js) ---------- */
.czShell { display: grid; grid-template-columns: 240px minmax(0, 1fr) 260px; gap: 22px; align-items: start; }
.czCenter { min-width: 0; }
.czCenter > :first-child { margin-top: 0 !important; }
.czSide { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 1200px) {
  #portal.portal:not(.paintPortal) .siteWrap,
  body.portal main.siteWrap,
  .paintPortal .siteWrap { max-width: 1600px !important; }
}
@media (max-width: 1199px) {
  .czShell { grid-template-columns: minmax(0, 1fr); }
  .czCenter { order: 1; }
  .czLeft { order: 2; position: static; }
  .czRight { order: 3; position: static; }
}

/* panels: the site's own card look */
.czPanel { background: #fffaf0; border: 2px solid #4b3422; border-radius: 12px; box-shadow: 0 5px 0 #a6845b; padding: 14px; color: #322418; font-family: Nunito, "Trebuchet MS", sans-serif; }
.czPanel h2 { margin: 0 0 10px; font-size: 17px; font-weight: 900; color: #322418; display: flex; align-items: center; justify-content: space-between; }
.czPanel h2 small { font-size: 12px; font-weight: 800; color: #8a6a50; }
.czGames { display: flex; flex-direction: column; gap: 8px; }
.czGame { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid #674a30; border-radius: 9px; background: #fff4df; color: #392c22; text-decoration: none; }
.czGame:hover { background: #ffe9c2; }
.czGame.isHere { background: #ffd56b; }
.czGame img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.czGame strong { display: block; font-size: 15px; font-weight: 900; }
.czGame small { display: block; font-size: 12px; color: #6b5340; line-height: 1.25; }

.czFriends { display: flex; flex-direction: column; gap: 4px; }
.czGroup { margin: 8px 0 2px; font-size: 11px; font-weight: 900; letter-spacing: .06em; color: #8a6a50; }
.czFriend { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; }
.czFriend:hover { background: #f6e8cf; }
.czAvatar { position: relative; flex: none; width: 36px; height: 36px; }
.czAvatar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #ead9bb; }
.czDot { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid #fffaf0; }
.czDot.online { background: #23a55a; }
.czDot.away { background: #f0b232; }
.czDot.away::after { content: ""; position: absolute; left: -1px; top: -1px; width: 7px; height: 7px; border-radius: 50%; background: #fffaf0; }
.czDot.offline { background: #80848e; }
.czDot.offline::after { content: ""; position: absolute; left: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #fffaf0; }
.czFriend.isOffline { opacity: .6; }
.czFriend > div:last-child { min-width: 0; }
.czFriend strong { display: block; font-size: 14px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.czFriend small { display: block; font-size: 12px; color: #6b5340; }
.czEmpty { font-size: 13px; color: #6b5340; margin: 4px 0; }
.czInvite { display: flex; align-items: center; gap: 8px; padding: 8px; margin-bottom: 8px; border: 2px solid #4b3422; border-radius: 9px; background: #e4f3e6; font-size: 13px; }
.czInvite span { flex: 1; min-width: 0; }
.czBtn { border: 2px solid #4b3422; border-radius: 8px; background: #ffd56b; color: #322418; font: 800 13px Nunito, sans-serif; padding: 6px 10px; cursor: pointer; text-decoration: none; }
.czBtn.ghost { background: #fff4df; }

/* add-friend button in the top bar */
.czAddFriend { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-right: 8px; border: 2px solid #4b3422; border-radius: 9px; background: #fffaf0; cursor: pointer; vertical-align: middle; position: relative; padding: 0; }
.czAddFriend img { width: 20px; height: 20px; }
.czAddFriend b { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #d9534f; color: #fff; font: 900 11px/18px Nunito, sans-serif; }
dialog.czDialog { width: min(420px, calc(100vw - 32px)); padding: 20px; }
dialog.czDialog h2 { margin: 0 0 12px; font-size: 20px; }
dialog.czDialog form { display: flex; gap: 8px; }
dialog.czDialog input { flex: 1; min-width: 0; padding: 9px 11px; border: 2px solid #674a30; border-radius: 8px; font: 700 15px Nunito, sans-serif; }
.czMsg { min-height: 18px; margin: 8px 0 0; font-size: 13px; font-weight: 700; }
.czRequests { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.czRequest { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.czRequest span { flex: 1; }
.czClose { display: block; margin: 16px 0 0 auto; }

/* ---------- Pixel Paint: same panels, pixel-art look ---------- */
.paintPortal .pixelHeroActions { grid-template-columns: 1fr !important; max-width: 420px; }
.paintPortal .czPanel { background: #f3e5c4; border: 3px solid #16282c; border-radius: 0; box-shadow: 6px 6px 0 #16282c; font-family: LanaPixel, monospace; }
.paintPortal .czPanel h2 { font-family: LanaPixel, monospace; font-weight: 400; letter-spacing: .04em; text-transform: uppercase; }
.paintPortal .czGame { border: 3px solid #16282c; border-radius: 0; background: #fff6e0; box-shadow: 3px 3px 0 #16282c; }
.paintPortal .czGame:hover { background: #ffe9b8; }
.paintPortal .czGame.isHere { background: #f2c34d; }
.paintPortal .czGame img { width: 32px; height: 32px; image-rendering: pixelated; }
.paintPortal .czGame strong, .paintPortal .czFriend strong { font-weight: 400; }
.paintPortal .czGame small, .paintPortal .czFriend small { font-family: Nunito, sans-serif; }
.paintPortal .czAvatar img { border-radius: 0; border: 2px solid #16282c; }
.paintPortal .czDot { border-radius: 0; border-color: #f3e5c4; }
.paintPortal .czDot::after { border-radius: 0 !important; background: #f3e5c4 !important; }
.paintPortal .czFriend { border-radius: 0; }
.paintPortal .czFriend:hover { background: #ead6a8; }
.paintPortal .czBtn { border: 3px solid #16282c; border-radius: 0; box-shadow: 3px 3px 0 #16282c; background: #f2c34d; font-family: LanaPixel, monospace; font-weight: 400; }
.paintPortal .czInvite { border: 3px solid #16282c; border-radius: 0; background: #cfe9d9; }
.paintPortal .czAddFriend { border: 3px solid #16282c; border-radius: 0; background: #f3e5c4; box-shadow: 3px 3px 0 #16282c; }
.paintPortal .czAddFriend img { image-rendering: pixelated; width: 24px; height: 24px; }

/* ---------- cz9: fill large screens, roomier side columns ---------- */
.czShell { gap: 40px; grid-template-columns: 250px minmax(0, 1fr) 270px; }
@media (min-width: 1700px) {
  #portal.portal:not(.paintPortal) .siteWrap, body.portal .site-header, body.portal main.siteWrap, .paintPortal .siteWrap { zoom: 1.15; }
  .czShell { gap: 56px; }
}
@media (min-width: 2100px) {
  #portal.portal:not(.paintPortal) .siteWrap, body.portal .site-header, body.portal main.siteWrap, .paintPortal .siteWrap { zoom: 1.3; }
}
/* Sketch lobby: plain block so the shell spans the full width */
body.portal #lobbyDialog.lobby { display: block !important; max-width: none !important; }
/* add-friend button sits inside the account area, centred with the bell */
#accountArea, #sketchAccount { display: flex !important; align-items: center; gap: 8px; }
.czAddFriend { margin: 0 !important; flex: none; }
/* empty friends list: the sleeping sketcher */
.czSleep { width: 86px; height: 86px; margin: 4px auto 6px; background: url('/assets/sketch/ref-waiting.svg') 0 0 / 86px 344px no-repeat; animation: czSleep 2.4s steps(4) infinite; }
@keyframes czSleep { to { background-position: 0 -344px; } }
@media (prefers-reduced-motion: reduce) { .czSleep { animation: none; } }
.czEmpty { text-align: center; }
/* Pixel Paint: drop the decorative footer line under the hero */
.paintPortal .pixelHeroFoot { display: none !important; }
/* Sketch language picker: same flags as the puzzle site */
#languageMenu .languageOption img, #languageBtn img { width: 21px !important; height: 16px !important; object-fit: cover; border: 1px solid #7b6b54; display: block; }

/* ---------- cz12: doodle backgrounds use the puzzle colour and drift like the puzzle page ---------- */
@keyframes czDoodleDrift { to { background-position: 520px 520px; } }
body.portal, body.in-room { background-color: #d9bf98 !important; animation: czDoodleDrift 60s linear infinite; }
@media (prefers-reduced-motion: reduce) { body.portal, body.in-room { animation: none; } }
.czDismiss { padding: 4px 6px; line-height: 0; }
.czDismiss img { width: 16px; height: 16px; }
/* chat actions: add friend + "..." menu (report) on every game's table chat */
.czChatRow { position: relative; }
.czChatAct { position: absolute; top: 2px; right: 2px; display: flex; gap: 4px; opacity: 0; transform: translateY(-2px); transition: opacity .15s, transform .15s; }
.czChatRow:hover .czChatAct, .czChatRow:focus-within .czChatAct { opacity: 1; transform: none; }
@media (hover: none) { .czChatAct { opacity: .85; transform: none; } }
.czMini { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 2px solid #4b3422; border-radius: 8px; background: #fff8ea; box-shadow: 0 2px 0 #4b3422; cursor: pointer; }
.czMini:hover { background: #ffe9c2; }
.czMini:active { transform: translateY(2px); box-shadow: none; }
.czMini img { width: 15px; height: 15px; }
.czMini img[src*="pixel-ui"] { image-rendering: pixelated; }
.czMini.sent { background: #cfeed8; }
.czMini:disabled { cursor: default; }
.czMore { grid-auto-flow: column; gap: 2px; }
.czMore i { display: block; width: 4px; height: 4px; border-radius: 50%; background: #4b3422; }
.czMenu { position: absolute; z-index: 60; min-width: 190px; padding: 6px; background: #fffaf0; border: 2px solid #4b3422; border-radius: 12px; box-shadow: 0 5px 0 #a6845b, 0 18px 40px rgba(40, 24, 12, .25); animation: czMenuIn .14s ease-out; }
@keyframes czMenuIn { from { opacity: 0; transform: translateY(-4px); } }
.czMenu button { display: block; width: 100%; padding: 9px 11px; border: 0; border-radius: 8px; background: none; color: #322418; font: 800 14px Nunito, sans-serif; text-align: left; cursor: pointer; }
.czMenu button:hover { background: #ffe9c2; }
.czMenu button.danger { color: #b5523c; }
.czMenu button.danger:hover { background: #fde0d6; }
dialog.czReport { width: min(440px, calc(100vw - 32px)); background: #fffaf0; border: 2px solid #4b3422; border-radius: 14px; box-shadow: 0 7px 0 #6b4c32, 0 25px 70px #160d06aa; color: #322418; font-family: Nunito, sans-serif; }
dialog.czReport::backdrop { background: rgba(40, 24, 12, .45); }
.czReportHint { margin: -4px 0 12px; color: #6b5340; font-weight: 700; font-size: 14px; }
.czReasons { display: grid; gap: 8px; margin-bottom: 12px; }
.czReasons label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 2px solid #d9c3a1; border-radius: 10px; background: #fff4df; font-weight: 800; cursor: pointer; }
.czReasons label:has(input:checked) { border-color: #4b3422; background: #ffe2a3; }
dialog.czReport .czReasons input { flex: none; width: 16px; height: 16px; padding: 0; margin: 0; accent-color: #b5523c; }
dialog.czReport textarea { display: block; width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid #674a30; border-radius: 10px; font: 700 14px Nunito, sans-serif; resize: vertical; background: #fff; }
dialog.czReport .czMsg { min-height: 18px; margin: 8px 0 0; color: #b5523c; font-weight: 800; }
.czDialogActions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.czDialogActions .czBtn { height: 40px; padding: 0 16px; font-size: 14px; box-shadow: 0 3px 0 #4b3422; }
.czBtn.ghost { background: #fff8ea; }
.czToast { position: fixed; left: 50%; bottom: 24px; z-index: 70; padding: 11px 18px; border: 2px solid #4b3422; border-radius: 10px; background: #fffaf0; box-shadow: 0 4px 0 #4b3422; color: #322418; font: 900 14px Nunito, sans-serif; opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.czToast.show { opacity: 1; transform: translate(-50%, 0); }
/* keep the add-friend icon dead centre even where the page styles every header button (home, paint) */
#accountArea .czAddFriend, #sketchAccount .czAddFriend, .czAddFriend { box-sizing: border-box !important; width: 40px !important; min-width: 40px !important; height: 40px !important; padding: 0 !important; display: inline-grid !important; place-items: center !important; justify-content: center !important; text-indent: 0 !important; gap: 0 !important; }
.czAddFriend img { display: block !important; width: 20px !important; height: 20px !important; margin: 0 !important; }

/* ---------- notifications + find players (cz16) ---------- */
#accountArea > .notificationButton, #accountArea > .notificationPanel, #accountArea .notificationPanel, #sketchAccount details:has(> .notificationButton) { display: none !important; }
.czBell b, .czAddFriend b { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; box-sizing: border-box; border: 2px solid #fffaf0; border-radius: 10px; background: #d9534f; color: #fff; font: 900 11px/15px Nunito, sans-serif; text-align: center; }
#accountArea, #sketchAccount { gap: 8px; }
.czNotif { position: fixed; z-index: 2147483000; width: min(360px, calc(100vw - 16px)); max-height: min(520px, calc(100vh - 90px)); display: flex; flex-direction: column; background: #fffaf0; border: 2px solid #4b3422; border-radius: 14px; box-shadow: 0 6px 0 #c9a77c, 0 18px 40px rgba(50, 36, 24, .28); color: #322418; font-family: Nunito, sans-serif; overflow: hidden; animation: czPop .16s ease-out both; }
@keyframes czPop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.czNoteHead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 2px dashed #e2cba6; }
.czNoteHead strong { font-size: 17px; font-weight: 900; }
.czNoteHead span { font-size: 12px; font-weight: 800; color: #9a7a55; }
.czNoteList { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.czNote { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 11px; row-gap: 8px; padding: 10px 12px 10px 14px; border: 2px solid #ead6b4; border-radius: 11px; background: #fff; }
.czNote.isNew { background: #fff3d6; border-color: #e7c486; }
.czNoteIcon { position: absolute; left: 4px; top: 10px; bottom: 10px; width: 4px; border-radius: 3px; background: #c9a77c; }
.czNoteIcon-request { background: #e2664f; }
.czNoteIcon-invite { background: #5ea978; }
.czNoteIcon-accepted { background: #4f8fd1; }
.czNoteCopy { min-width: 0; font-size: 13px; line-height: 1.3; color: #5b4532; }
.czNoteCopy strong { display: block; font-size: 14px; font-weight: 900; color: #322418; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.czNoteCopy small { display: block; margin-top: 2px; font-size: 11px; font-weight: 800; color: #a88a66; }
.czNoteActions { grid-column: 2; display: flex; gap: 6px; }
.czNoteActions .czBtn { height: 32px; padding: 0 14px; display: inline-flex; align-items: center; box-shadow: 0 2px 0 #4b3422; }
.czNoteEmpty { display: grid; justify-items: center; gap: 4px; padding: 18px 16px 22px; text-align: center; }
.czNoteEmpty p { margin: 0; max-width: 240px; font-size: 13px; font-weight: 700; color: #8a6d4f; }
.czNoteToast { position: fixed; right: 18px; bottom: 18px; z-index: 2147483001; width: min(340px, calc(100vw - 32px)); padding: 6px; background: #fffaf0; border: 2px solid #4b3422; border-radius: 14px; box-shadow: 0 5px 0 #c9a77c, 0 16px 34px rgba(50, 36, 24, .3); transform: translateY(24px); opacity: 0; transition: transform .24s ease, opacity .24s ease; font-family: Nunito, sans-serif; }
.czNoteToast.show { transform: none; opacity: 1; }
.czNoteToast .czNote { border: 0; background: transparent; padding-right: 30px; }
.czNoteX { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 2px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; }
.czNoteX:hover { border-color: #e2cba6; background: #fff4df; }
.czNoteX img { width: 16px; height: 16px; }
dialog.czPeople { width: min(480px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 40px)); padding: 0; display: none; flex-direction: column; overflow: hidden; border: 2px solid #4b3422; border-radius: 16px; background: #fffaf0; box-shadow: 0 7px 0 #c9a77c, 0 24px 60px rgba(30, 20, 12, .35); color: #322418; font-family: Nunito, sans-serif; }
dialog.czPeople[open] { display: flex; }
dialog.czPeople::backdrop { background: rgba(40, 28, 18, .45); }
.czPeopleHead { position: relative; padding: 18px 20px 4px; }
.czPeopleHead h2 { margin: 0 !important; font-size: 21px !important; font-weight: 900; }
.czPeopleHead .czNoteX { top: 14px; right: 14px; }
.czSearch { display: flex; align-items: center; gap: 8px; margin: 10px 20px 12px; padding: 0 12px; height: 42px; border: 2px solid #674a30; border-radius: 10px; background: #fff; }
.czSearch img { width: 18px; height: 18px; opacity: .7; }
.czSearch input { flex: 1; min-width: 0; border: 0 !important; outline: 0; padding: 0 !important; background: transparent; font: 700 15px Nunito, sans-serif; color: #322418; }
.czUsers { overflow-y: auto; padding: 0 12px 14px; border-top: 2px dashed #e2cba6; }
.czUsers .czGroup { margin: 12px 8px 6px; font: 900 11px Nunito, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #a07c55; }
.czUser { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px; border-radius: 11px; }
.czUser:hover { background: #fff1d8; }
.czUser .czAvatar, .czNote .czAvatar { width: 40px; height: 40px; }
.czUser .czAvatar img, .czNote .czAvatar img { width: 40px; height: 40px; }
.czUser.isOffline .czAvatar img { filter: saturate(.55); opacity: .8; }
.czUserInfo strong { display: block; font-size: 15px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.czUserInfo small { display: block; font-size: 12px; font-weight: 700; color: #8a6d4f; }
.czUser:not(.isOffline) .czUserInfo small { color: #3d8a5a; }
.czUserAct .czBtn { height: 34px; padding: 0 14px; box-shadow: 0 2px 0 #4b3422; white-space: nowrap; }
.czTag { display: inline-block; padding: 6px 11px; border-radius: 8px; background: #e4f3e6; border: 2px solid #9cc7a6; color: #2f6b45; font: 900 12px Nunito, sans-serif; }
.czTag.ghost { background: #f6ecd9; border-color: #e2cba6; color: #8a6d4f; }
.czNote .czDot, .czUser .czDot { width: 13px; height: 13px; }
/* pixel pages (Pixel Paint, PAWPALS) */
.czNotif.isPixel, .czNoteToast.isPixel, .paintSetup.czPeople, body:has(#pawHome) dialog.czPeople { border-radius: 0; border-width: 3px; border-color: #2b2233; box-shadow: 5px 5px 0 #2b2233; }
.czNotif.isPixel .czNote, .czNoteToast.isPixel .czNote, .czNotif.isPixel .czBtn, .czNoteToast.isPixel .czBtn { border-radius: 0; }

/* new close-up avatars fill their frame edge to edge (no padding ring) */
img[src*="/api/avatar/"] { padding: 0 !important; object-fit: cover !important; background: none !important; }
.czGame img[src*="px-palette"] { width: 36px !important; height: 36px !important; image-rendering: pixelated; }
