/* Copilot Feature-dle · reusable components */

/* ---------- buttons (pills, as in the brand collateral) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 48px; padding: .7rem 1.4rem;
  border: 2px solid transparent; border-radius: var(--r-pill); background: var(--blue); color: #fff;
  font: 700 1rem/1.1 var(--font-head); text-decoration: none; text-align: center; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--navy); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-accent { background: var(--yellow); color: var(--navy); }
.btn-accent:hover { background: var(--yellow-75); color: var(--navy); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--blue); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--navy-10); }
.btn-ghost:hover { background: var(--blue-10); border-color: var(--blue); color: var(--navy); }
.btn-outline-light { background: transparent; color: #fff; border-color: #fff; }
.btn-outline-light:hover { background: #fff; color: var(--blue); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { background: #fff; color: var(--red); border-color: var(--red-50); }
.btn-danger-ghost:hover { background: var(--red-10); color: var(--red); border-color: var(--red); }
.btn-link { background: none; border: 0; padding: .4rem .25rem; min-height: 44px; color: var(--blue); text-decoration: underline; text-underline-offset: .2em; font-weight: 700; }
.btn-link:hover { background: none; color: var(--navy); transform: none; box-shadow: none; }
.btn-sm { min-height: 40px; padding: .4rem 1rem; font-size: .88rem; }
.btn-lg { min-height: 58px; padding: .85rem 1.9rem; font-size: 1.05rem; }
.btn-icon { padding: 0; width: 44px; min-height: 44px; }
.btn small { font: 400 .78rem var(--font-body); opacity: .85; }
.btn .ic { flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1rem 0 0; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .28rem .8rem; border-radius: var(--r-pill); font: 700 .78rem/1.25 var(--font-head); background: var(--c-tint, var(--blue-10)); color: var(--navy); white-space: nowrap; }
.chip .dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--c, var(--blue)); flex: none; }
.chip-solid { background: var(--c); color: var(--c-ink); }
.chip-locked { background: var(--navy-10); color: var(--grey); }
.dots { display: inline-flex; gap: 2px; }
.dots i { width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; opacity: .3; }
.dots i.on { opacity: 1; }
.temp-hot { background: var(--orange); color: var(--navy); }
.temp-warm { background: var(--yellow); color: var(--navy); }
.temp-cold { background: var(--blue-50); color: var(--navy); }
.temp-correct { background: var(--green); color: var(--navy); }
.temp-skip { background: var(--grey-10); color: var(--grey); }

/* ---------- cards ---------- */
.card { background: #fff; border: 2px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.1rem, 2.5vw, 1.75rem); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.banner { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.25rem; border-radius: var(--r-md); background: var(--c-tint); color: var(--navy); border: 2px solid var(--c); margin: 0 0 1.25rem; }
.banner > .ic { flex: none; color: var(--navy); }
.banner p { margin: 0; flex: 1; }
.banner ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.note { display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border-radius: var(--r-sm); background: var(--c-tint); color: var(--navy); font-weight: 500; margin: .6rem 0 0; }

/* ---------- form controls ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, .label, .field > label { display: block; padding: 0; font: 700 .9rem/1.3 var(--font-head); color: var(--navy); margin-bottom: .5rem; }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: .7rem 1.2rem; border: 2px solid var(--navy-50); border-radius: var(--r-pill); background: #fff; color: var(--navy); font: 400 1rem var(--font-body); transition: border-color .15s, box-shadow .15s; }
.textarea { border-radius: var(--r-md); resize: vertical; font-family: Consolas, "Courier New", monospace; font-size: .88rem; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--grey-50); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--navy-75); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); outline: 3px solid var(--navy); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
.input-lg { min-height: 60px; font-size: 1.15rem; padding-inline: 1.6rem; }
.select { appearance: none; padding-right: 2.6rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312134B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; background-size: 1.1rem; }
.field { margin: 0 0 1.25rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.field.grow { flex: 1 1 240px; }
.inline-form { display: flex; gap: .6rem; margin-top: 1rem; }
.inline-form .input { flex: 1; }
.search { position: relative; }
.search > span { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--grey); pointer-events: none; display: flex; }
.search .input { padding-left: 2.8rem; }
.check { display: flex; align-items: center; gap: .7rem; margin: .5rem 0 1rem; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }
.help { font-size: .85rem; color: var(--grey); margin: .5rem .25rem 0; }

.pill-radios { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill-radio { position: relative; display: inline-flex; }
.pill-radio input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pill-radio > span { display: inline-flex; align-items: center; gap: .45rem; min-height: 46px; padding: .55rem 1.15rem; border: 2px solid var(--navy-10); border-radius: var(--r-pill); background: #fff; font: 700 .9rem var(--font-head); color: var(--navy); transition: background-color .15s, border-color .15s; }
.pill-radio:hover > span { border-color: var(--blue-50); background: var(--blue-10); }
.pill-radio input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.pill-radio input:focus-visible + span { outline: 3px solid var(--navy); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
.pill-radio.is-locked > span { background: var(--navy-10); border-style: dashed; color: var(--grey); }
.pill-radio input:disabled { cursor: not-allowed; }
.pill-radio small { font: 400 .72rem var(--font-body); opacity: .9; }

.switch { display: flex; gap: 1rem; align-items: flex-start; padding: .9rem 0; cursor: pointer; border-top: 1px solid var(--line); position: relative; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 30px; margin: 0; cursor: pointer; }
.track { flex: none; width: 52px; height: 30px; border-radius: var(--r-pill); background: var(--navy-50); position: relative; transition: background-color .2s; margin-top: 2px; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--navy); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
.switch-text { display: flex; flex-direction: column; }
.switch-text small { color: var(--grey); font-size: .85rem; line-height: 1.4; }

.seg { display: inline-flex; flex-wrap: wrap; gap: .2rem; padding: .3rem; margin: 1.25rem 0 1.5rem; background: var(--blue-10); border-radius: var(--r-pill); }
.seg a { display: inline-flex; align-items: center; gap: .45rem; padding: .6rem 1.2rem; border-radius: var(--r-pill); font: 700 .92rem var(--font-head); text-decoration: none; color: var(--navy); }
.seg a:hover { background: #fff; }
.seg a[aria-current="page"] { background: var(--blue); color: #fff; }

.tabs { display: flex; gap: .4rem; overflow-x: auto; padding: .35rem .25rem; margin: 1rem 0; }
.tab { display: inline-flex; align-items: center; gap: .45rem; min-height: 46px; padding: .55rem 1.1rem; border: 2px solid var(--line); border-radius: var(--r-pill); background: #fff; font: 700 .9rem var(--font-head); white-space: nowrap; color: var(--navy); }
.tab:hover { background: var(--blue-10); border-color: var(--blue-50); }
.tab[aria-selected="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- visual bits ---------- */
.ic { flex: none; vertical-align: middle; }
.ring { position: relative; width: var(--sz, 88px); height: var(--sz, 88px); display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring-track { stroke: var(--navy-10); }
.ring-arc { stroke: var(--c); transition: stroke-dashoffset .8s ease; }
.ring-label { z-index: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.1; text-align: center; }
.ring-label strong { font: 700 calc(var(--sz, 88px) * .22) var(--font-head); color: var(--navy); }
.ring-label small { font-size: .72rem; color: var(--grey); }
.bar { height: 12px; border-radius: var(--r-pill); background: var(--navy-10); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--c); transition: width .6s ease; }
.medal { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--c); color: var(--c-ink); flex: none; }
.medal.is-locked { background: var(--navy-10); color: var(--navy-75); }
.medal-lg { width: 72px; height: 72px; }
.stars { display: inline-flex; gap: 2px; }
.star svg { fill: none; stroke: var(--navy-50); }
.star.on svg { fill: var(--yellow); stroke: var(--navy); }
.dotrow { display: inline-flex; gap: 6px; }
.dotrow i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--navy-50); background: #fff; }
.dotrow i.used { background: var(--navy-50); }

/* letter tiles (name shape + answer reveal) */
.name-tiles { display: flex; flex-wrap: wrap; gap: .6rem 1.1rem; --tw: clamp(1.7rem, 6vw, 2.6rem); }
.name-word { display: inline-flex; gap: .25rem; }
.tile { width: var(--tw); height: calc(var(--tw) * 1.18); display: inline-grid; place-items: center; border: 2px solid var(--navy-50); border-radius: calc(var(--tw) * .22); background: #fff; font: 700 calc(var(--tw) * .52) var(--font-head); color: var(--navy); }
.tile-punct { border: 0; background: none; width: auto; min-width: .55em; }
.tile.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.answer { margin: .75rem 0 .25rem; }
.answer .tile.is-on { background: var(--green); border-color: var(--green); color: var(--navy); }
.is-loss .answer .tile.is-on { background: var(--yellow); border-color: var(--yellow); }
.tile.is-flip { animation: flipin .55s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i) * 70ms + 200ms); }
@keyframes flipin { from { transform: rotateX(90deg) scale(.8); opacity: 0; } to { transform: rotateX(0) scale(1); opacity: 1; } }

/* ---------- Pip + wordmark ---------- */
.pip { overflow: visible; display: block; }
.pip-ears { transform-origin: 110px 96px; animation: wiggle 3.6s ease-in-out infinite; }
.pip-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
.pip-wave { transform-origin: 166px 166px; animation: wave 2.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 40% { transform: rotate(-3deg); } 60% { transform: rotate(3deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-14deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.wordmark { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1; font-size: 2rem; }
.wm-top { font: 700 .4em/1 var(--font-head); background: var(--yellow); color: var(--navy); padding: .32em .9em; border-radius: var(--r-pill); margin-bottom: .6em; letter-spacing: .02em; }
.wm-main { font: 900 1em/1 var(--font-head); letter-spacing: -.02em; display: inline-flex; align-items: center; }
.wm-tile { display: inline-grid; place-items: center; width: .8em; height: .98em; border-radius: .2em; margin-left: .07em; font-weight: 900; }
.wm-t1 { background: var(--green); color: var(--navy); }
.wm-t2 { background: var(--yellow); color: var(--navy); }
.wm-t3 { background: var(--pink); color: #000; }
.es-logo { display: block; height: auto; }
.tagline { font: 700 1rem var(--font-head); }

/* ---------- dialogs ---------- */
dialog.dlg { border: 0; padding: 0; background: transparent; max-width: min(92vw, 580px); width: 100%; max-height: 92vh; overflow: visible; color: var(--navy); }
dialog.dlg::backdrop { background: rgba(18, 19, 75, .6); backdrop-filter: blur(3px); }
.dlg-card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 90vh; overflow: hidden; animation: dlgin .25s ease both; }
@keyframes dlgin { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem .5rem; }
.dlg-head h2 { margin: 0; font-size: clamp(1.3rem, 1rem + 1vw, 1.7rem); }
.dlg-body { padding: .5rem 1.5rem 1.25rem; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; padding: 1rem 1.5rem 1.25rem; border-top: 2px solid var(--line); background: var(--blue-10); }
dialog.dlg-wide { max-width: min(94vw, 900px); }
.dlg-sheet .more-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.more-link { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border-radius: var(--r-md); text-decoration: none; color: var(--navy); font: 700 1rem var(--font-head); background: var(--blue-10); }
.more-link span { flex: 1; }
.more-link:hover { background: var(--blue); color: #fff; }
.player-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .5rem; }
.player-row { display: flex; align-items: center; gap: .9rem; width: 100%; padding: .6rem .9rem .6rem .6rem; border: 2px solid var(--line); border-radius: var(--r-pill); background: #fff; text-align: left; }
.player-row:hover { border-color: var(--blue-50); background: var(--blue-10); }
.player-row.is-me { border-color: var(--blue); background: var(--blue-10); }
.pr-text { display: flex; flex-direction: column; flex: 1; line-height: 1.25; }
.pr-text small { color: var(--grey); }
.welcome { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: center; }
.welcome-art { background: var(--blue-10); border-radius: 50% 50% var(--r-lg) var(--r-lg); padding: 1rem 1rem 0; }
.ticks { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.ticks li { display: flex; gap: .6rem; align-items: flex-start; }
.ticks .ic { color: var(--green); background: var(--navy); border-radius: 50%; padding: 3px; margin-top: .2rem; box-sizing: content-box; width: 14px; height: 14px; }

/* ---------- toasts + confetti ---------- */
.toasts { position: fixed; z-index: 120; left: 50%; bottom: 1.25rem; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: .5rem; pointer-events: none; width: min(92vw, 520px); }
.toast { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.2rem; border-radius: var(--r-pill); background: var(--navy); color: #fff; font: 700 .92rem var(--font-head); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(14px) scale(.96); transition: opacity .3s, transform .3s; }
.toast.in { opacity: 1; transform: none; }
.toast-good { background: var(--green); color: var(--navy); }
.confetti { position: fixed; inset: 0; z-index: 110; pointer-events: none; }
@media (max-width: 1020px) { .toasts { bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); } dialog.dlg-sheet { margin-bottom: 0; max-width: 100vw; } .dlg-sheet .dlg-card { border-radius: var(--r-lg) var(--r-lg) 0 0; } }
@media (max-width: 560px) { .welcome { grid-template-columns: 1fr; justify-items: center; text-align: left; } .dlg-head, .dlg-body, .dlg-foot { padding-inline: 1.1rem; } }
