/* Cards, ribbons and Clubs (web/js/profile.js, ribbons.js, clubs.js, emblem.js). Pixel pictures are drawn by the game on canvases;
   the page only stretches them, so they stay sharp. */

.link-btn { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.link-btn:hover b { text-decoration: underline; }
canvas.ribbon-pic, canvas.emblem-pic, canvas.card-banner, canvas.banner-swatch, canvas.portrait-deco, canvas.emblem-grid { image-rendering: pixelated; }

/* ---- a card ---- */
.card-view { --accent: #17b566; position: relative; display: grid; gap: 0; border-radius: 16px; overflow: hidden; border: 2px solid var(--accent); background: #fffdf8; }
.card-banner { display: block; width: 100%; height: 96px; }
.card-head { position: relative; display: flex; gap: 12px; align-items: flex-end; padding: 0 14px; margin-top: -34px; }
.card-names { display: grid; gap: 2px; padding-bottom: 6px; min-width: 0; flex: 1; }
.card-name { margin: 0 !important; font-size: 21px; line-height: 1.15; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; text-shadow: 0 1px 0 #fffdf8, 0 0 6px #fffdf8; }
.card-pronouns { font-size: 12px; font-weight: 600; color: var(--muted); }
.card-title, .card-group { align-self: start; font-size: 12px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 999px; padding: 1px 10px; }
.card-role { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.card-status { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.card-body { padding: 8px 14px 10px; display: grid; gap: 4px; }
.card-body h3 { margin: 10px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card-bio { margin: 0; overflow-wrap: anywhere; }
.card-where { margin: 6px 0 0; font-size: 14px; }
.card-facts { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.card-club { display: flex; gap: 10px; align-items: center; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 6px 12px 6px 6px; cursor: pointer; text-align: left; margin-top: 6px; width: fit-content; max-width: 100%; }
.card-club span { display: grid; }
.card-club i { font-size: 12px; color: var(--muted); font-style: normal; }
.card-ribbons { display: flex; flex-wrap: wrap; gap: 8px; }
.card-ribbons.big { gap: 12px; }
.ribbon-tap { border: 0; background: none; padding: 0; cursor: pointer; line-height: 0; border-radius: 4px; }
.ribbon-tap:focus-visible { outline: 3px solid var(--accent, var(--green-deep)); outline-offset: 2px; }
.ribbon-tap[aria-pressed="true"] canvas { outline: 3px solid var(--green-deep); outline-offset: 2px; }
.card-ribbon-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-pets { display: flex; gap: 10px; flex-wrap: wrap; }
.card-pet { display: grid; justify-items: center; font-size: 12px; font-weight: 700; }
.card-stickers { display: flex; gap: 8px; }
.sticker { display: inline-flex; border: 2px dashed var(--line); border-radius: 10px; padding: 3px; background: #fff; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 14px; border-top: 2px solid var(--line); background: #faf5e6; }
.layout-wide .card-banner { height: 120px; }
.layout-wide .card-head { margin-top: -50px; }
.layout-showcase .card-banner { height: 56px; }
.layout-showcase .card-head { margin-top: -26px; }
.card-view.character .card-name { font-size: 22px; }

/* the portrait and its frame */
.portrait { position: relative; display: grid; place-items: center; background: #fffdf8; border: 3px solid var(--accent); flex: none; }
.portrait-face { image-rendering: pixelated; display: block; }
.portrait-deco { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.portrait.f-round { border-radius: 50%; overflow: hidden; }
.portrait.f-square { border-radius: 6px; }
.portrait.f-tag { border-radius: 14px 14px 6px 6px; border-width: 4px; }
.portrait.f-tag::before { content: ""; position: absolute; top: 3px; left: 50%; width: 14px; height: 5px; margin-left: -7px; border-radius: 3px; background: var(--accent); opacity: .55; }
.portrait.f-leaf { border-radius: 10px; border-color: #58b84a; }
.portrait.f-snow { border-radius: 10px; border-color: #9bd4f2; }
.portrait.f-paw { border-radius: 10px; border-color: #ee8a2b; }
.portrait.f-club { border-radius: 8px; border-width: 4px; box-shadow: 0 0 0 2px #fffdf8, 0 0 0 5px var(--accent); }
.portrait.f-gold { border-radius: 8px; border-color: #d9a521; box-shadow: 0 0 0 2px #f6d84a; }
.portrait-club { position: absolute; right: -6px; bottom: -6px; border-radius: 6px; background: #fffdf8; }

/* ---- the editor ---- */
.card-preview { margin: 6px 0 14px; }
.edit-sec { margin: 0 0 10px; }
.edit-sec h3 { margin: 12px 0 4px; font-size: 13px; }
.edit-sec textarea, .edit-sec input, .edit-sec select, .edit-row input, .edit-row select { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: .5em .8em; background: #fff; }
.edit-row { display: grid; gap: 4px; font-weight: 700; font-size: 13px; margin: 6px 0; }
.edit-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--panel) 30%); padding-top: 14px; }
.banner-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.banner-opt { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 4px; display: grid; gap: 2px; font-size: 12px; font-weight: 700; cursor: pointer; }
.banner-opt[aria-pressed="true"] { border-color: var(--green-deep); background: #e5f7ec; }
.banner-opt:disabled { opacity: .5; cursor: not-allowed; }
.banner-swatch { width: 100%; height: 34px; border-radius: 8px; }
.accent-pick, .emblem-pal { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.sticker-pick { display: flex; gap: 6px; flex-wrap: wrap; max-height: 150px; overflow: auto; }
.sticker-opt { border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 2px; cursor: pointer; line-height: 0; }
.sticker-opt[aria-pressed="true"] { border-color: var(--green-deep); background: #e5f7ec; }

/* ---- ribbons ---- */
canvas.ribbon-pic.locked { opacity: .9; }
.ribbon-pop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(22, 21, 28, .35); cursor: pointer; animation: ribbon-in .28s ease-out; }
.ribbon-pop-in { display: grid; gap: 6px; justify-items: center; text-align: center; background: var(--panel); border: 3px solid var(--gold); border-radius: 20px; padding: 18px 26px; max-width: min(92vw, 380px); box-shadow: var(--shadow); }
.ribbon-pop-in small { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ribbon-pop-in b { font-size: 19px; }
.ribbon-pop-in span { color: var(--ink-soft); }
@keyframes ribbon-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ribbon-pop { animation: none; } }

.book-head h2 { margin-bottom: 0; }
.rank-bar { height: 10px; border-radius: 999px; background: #efe7d4; overflow: hidden; margin: 6px 0; }
.rank-bar i { display: block; height: 100%; background: var(--gold); }
.pin-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pin-slot { min-width: 144px; min-height: 48px; border: 2px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 12px; background: #fff; padding: 0; }
.pin-slot.full { border-style: solid; border-color: var(--gold); cursor: pointer; line-height: 0; }
.pin-slot.off { opacity: .5; }
.book-filter { margin: 10px 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
.book-filter .chip { white-space: nowrap; }
.book-cat h3 small { color: var(--muted); font-weight: 600; }
.ribbon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.ribbon-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 8px; }
.ribbon-card.lock { background: #f6f3ea; }
.ribbon-card .btn, .ribbon-card .slot-pick { grid-column: 1 / -1; justify-self: start; }
.ribbon-text { display: grid; gap: 1px; min-width: 0; }
.ribbon-text .how { font-size: 13px; color: var(--ink-soft); }
.ribbon-text .hint { font-size: 12px; }
.prog { position: relative; display: block; height: 14px; background: #efe7d4; border-radius: 999px; overflow: hidden; margin-top: 3px; }
.prog i { display: block; height: 100%; background: var(--green-deep); opacity: .75; }
.prog em { position: absolute; inset: 0; font-size: 11px; font-style: normal; font-weight: 800; text-align: center; line-height: 14px; }
.slot-pick { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- clubs ---- */
.emblem-pic { display: block; }
.club-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.club-names { min-width: 0; display: grid; gap: 2px; }
.club-names h3 { margin: 0 !important; font-size: 21px !important; color: var(--ink); }
.club-wait { background: #fff8e6; border: 2px solid var(--gold); border-radius: 12px; padding: 8px 12px; margin: 8px 0; font-weight: 700; }
.club-row .club-pic { border: 0; background: none; padding: 0; cursor: pointer; line-height: 0; }
.club-row { grid-template-columns: auto 1fr auto; }
.club-page h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.club-settings { margin-top: 12px; }
.emblem-editor { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.emblem-left { display: grid; gap: 8px; justify-items: start; }
.emblem-grid { width: 224px; height: 224px; border: 2px solid var(--line); border-radius: 8px; touch-action: none; cursor: crosshair; background: #fff; }
.emblem-preview { display: flex; gap: 10px; align-items: end; }
.emblem-right { display: grid; gap: 8px; min-width: 0; }
@media (max-width: 560px) { .emblem-editor { grid-template-columns: 1fr; } .emblem-grid { width: 100%; height: auto; aspect-ratio: 1; max-width: 320px; } }
.club-page .club-names h3 { text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 21px !important; margin: 0 !important; }
.club-head { margin-bottom: 14px; } .club-head .emblem-pic { flex: none; }
.card-title, .card-group { justify-self: start; }
/* the name sits on paper, not on the banner, so it reads on every banner */
.card-names { background: #fffdf8; border: 2px solid var(--accent); border-radius: 12px; padding: 6px 12px 8px; margin-bottom: 8px; box-shadow: 0 2px 0 rgba(0, 0, 0, .08); }
.card-name { text-shadow: none !important; color: var(--ink); }
.card-head { align-items: flex-end; }
