/* What should we eat and watch: swipe cards, hand-off, match chips, result. */
.tool { --ew-p1: 167 60 255; --ew-p2: 236 72 153; --ew-who: var(--ew-p1); }
.tool .ew-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tool .ew-who { color: rgb(var(--ew-who)); }
.tool .ew-head .tool-sub { margin: 2px 0 0; }
.tool .ew-progress { height: 6px; border-radius: 3px; background: rgb(var(--ink) / .08); overflow: hidden; }
.tool .ew-progress span { display: block; height: 100%; width: 0; border-radius: 3px; background: rgb(var(--ew-who)); transition: width .25s ease-out; }

.tool .ew-stack { position: relative; height: 300px; }
.tool .ew-card {
  position: absolute; inset: 0; border-radius: 28px; padding: 24px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 8px;
  background: var(--surface); box-shadow: var(--shadow); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
  transition: transform .26s cubic-bezier(.2, 0, 0, 1), opacity .22s ease-out;
}
.tool { --ew-eat: #FFE6B8; --ew-watch: #D6E4FF; }
@media (prefers-color-scheme: dark) { .tool { --ew-eat: #4B2350; --ew-watch: #24305E; } }
.tool .ew-card.ew-eat { background: linear-gradient(160deg, var(--ew-eat) 0%, var(--surface) 75%); }
.tool .ew-card.ew-watch { background: linear-gradient(160deg, var(--ew-watch) 0%, var(--surface) 75%); }
.tool .ew-card:not(.is-top) { transform: translateY(10px) scale(.95); opacity: .6; }
.tool .ew-card.is-drag { transition: none; cursor: grabbing; }
.tool .ew-card.is-gone { opacity: 0; pointer-events: none; }
.tool .ew-card .ew-t { font-size: 34px; line-height: 40px; font-weight: 950; letter-spacing: -.02em; color: rgb(var(--ink)); text-wrap: balance; }
.tool .ew-card .ew-d { font-size: 16px; line-height: 23px; font-weight: 650; color: rgb(var(--ink) / .65); max-width: 30ch; text-wrap: pretty; }
.tool .ew-tag { display: inline-block; padding: 4px 10px; border-radius: 10px; font-size: 12px; line-height: 16px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; background: rgb(var(--ink) / .07); color: rgb(var(--ink) / .7); }
.tool .ew-stamp { position: absolute; top: 22px; padding: 4px 12px; border-radius: 10px; border: 3px solid; font-size: 22px; font-weight: 950; letter-spacing: .06em; opacity: 0; transition: opacity .1s; }
.tool .ew-stamp-yes { left: 20px; color: #12A26B; transform: rotate(-12deg); opacity: var(--yes, 0); }
.tool .ew-stamp-no { right: 20px; color: #D1365F; transform: rotate(12deg); opacity: var(--no, 0); }
.tool .ew-card.is-yes .ew-stamp-yes, .tool .ew-card.is-no .ew-stamp-no { opacity: 1; }

.tool .ew-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tool .ew-btns .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.tool .ew-btns .ew-yes { background: rgb(var(--ew-who)); }
.tool .ew-keys { text-align: center; }
@media (hover: none) { .tool .ew-keys { display: none; } }

/* Hand-off */
.tool .ew-handoff { text-align: center; align-items: center; padding: 8px 0; }
.tool .ew-handoff .tool-actions { width: 100%; justify-content: center; }
.tool .ew-pass { display: flex; align-items: center; gap: 12px; height: 64px; }
.tool .ew-dot { width: 48px; height: 48px; border-radius: 24px; }
.tool .ew-dot1 { background: rgb(var(--ew-p1)); } .tool .ew-dot2 { background: rgb(var(--ew-p2)); animation: ew-bob 1.6s ease-in-out infinite; }
.tool .ew-arrow { width: 56px; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, rgb(var(--ink) / .3) 0 8px, transparent 8px 14px); }
@keyframes ew-bob { 50% { transform: translateY(-6px); } }

/* Setup extras */
.tool .ew-more summary { cursor: pointer; font-size: 15px; font-weight: 800; color: var(--link); padding: 6px 0; list-style-position: inside; }
.tool .ew-own-row { display: flex; gap: 8px; margin-top: 8px; }
.tool .ew-own-row input { flex: 1; min-width: 0; }
.tool .ew-own-row select { width: auto; flex: 0 0 auto; }
.tool .ew-own { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tool .ew-own li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border-radius: 18px; background: var(--surface); font-size: 14px; font-weight: 750; }
.tool .ew-own .ew-tag { padding: 2px 6px; font-size: 10px; }
.tool .ew-hist { font-weight: 700; }

/* Result */
.tool .ew-matches { display: grid; gap: 10px; }
.tool .ew-mlab { display: block; font-size: 13px; font-weight: 850; color: rgb(var(--ink) / .55); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.tool .ew-mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tool .ew-chip { padding: 6px 12px; border-radius: 14px; font-size: 14px; font-weight: 800; background: var(--surface); color: rgb(var(--ink) / .8); transition: background-color .2s, color .2s, opacity .2s; }
.tool .ew-chip.is-pick { background: rgb(var(--ink)); color: var(--surface); }
.tool .ew-chip.is-out { opacity: .4; text-decoration: line-through; }
.tool .ew-wheelbox { padding: 14px 0 4px; }
.tool .ew-result { display: block; text-align: left; padding: 20px 20px 18px; }
.tool .ew-result .ew-tag { background: rgb(var(--accent) / .14); color: var(--link); }
.tool .ew-rows { display: grid; gap: 16px; margin-top: 12px; }
.tool .ew-row { display: flex; flex-direction: column; gap: 4px; }
.tool .ew-row + .ew-row { padding-top: 16px; border-top: 1px solid rgb(var(--ink) / .08); }
.tool .ew-row.is-new { animation: card-in .45s var(--ease-out) both; }
.tool .ew-row.is-wait b { color: rgb(var(--ink) / .35); }
.tool .ew-rtop { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.tool .ew-row b { font-size: 28px; line-height: 34px; font-weight: 950; letter-spacing: -.015em; text-wrap: balance; }
.tool .ew-row small { margin: 0; font-size: 14px; line-height: 20px; }
.tool .ew-rl { font-size: 12px; font-weight: 850; color: rgb(var(--ink) / .5); text-transform: uppercase; letter-spacing: .06em; }
.tool .ew-veto { min-height: 44px; min-width: 64px; padding: 0 14px; border-radius: 22px; font-size: 13px; font-weight: 800; color: rgb(var(--ink) / .65); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .15); }
.tool .ew-veto:active { transform: scale(.96); }
.tool .ew-go { font-size: 15px; font-weight: 800; margin-top: 2px; }
.tool .ew-tbox { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tool .ew-titles { display: grid; gap: 6px; }
.tool .ew-title em { font-style: normal; font-size: 13px; font-weight: 700; opacity: .6; white-space: nowrap; }
.tool .ew-ld { font-size: 14px; line-height: 20px; font-weight: 700; color: rgb(var(--ink) / .7); margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: rgb(var(--accent) / .08); }
.tool .ew-tl { font-size: 13px; font-weight: 800; color: rgb(var(--ink) / .5); margin-right: 2px; }
.tool .ew-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; min-height: 44px; padding: 8px 14px; border-radius: 14px; text-align: left; font-size: 15px; line-height: 20px; font-weight: 800; background: rgb(var(--ink) / .06); color: rgb(var(--ink) / .85); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .08); transition: background-color .15s ease, color .15s ease; }
.tool .ew-title[aria-pressed="true"] { background: rgb(var(--ink)); color: var(--surface); }
.tool .ew-vnote { margin-top: 14px; font-size: 13px; line-height: 18px; font-weight: 700; color: rgb(var(--ink) / .5); }
.tool .ew-after .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tool .ew-start .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tool .ew-start .btn svg { width: 18px; height: 18px; }
.tool .ew-undo { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px 0 8px; border-radius: 18px; font-size: 14px; font-weight: 800; color: rgb(var(--ink) / .7); background: var(--surface); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .08); flex: 0 0 auto; }
.tool .ew-undo svg { width: 18px; height: 18px; }
.tool .ew-undo:disabled { opacity: .35; }
.tool .ew-barrow { display: flex; align-items: center; gap: 10px; }
.tool .ew-barrow .ew-progress { flex: 1; height: 8px; }
.tool .ew-count { font-size: 14px; font-weight: 850; color: rgb(var(--ew-who)); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.tool .ew-hobtns { display: grid; gap: 10px; width: 100%; max-width: 420px; }
.tool .ew-hobtns .btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tool .ew-alt { background: rgb(var(--ew-p2)); }
.tool .ew-btns .btn:focus-visible, .tool .ew-title:focus-visible, .tool .ew-veto:focus-visible, .tool .ew-undo:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 2px; }
.tool .tool-actions .btn svg { width: 18px; height: 18px; vertical-align: -3px; }
@media (min-width: 600px) { .tool .ew-stack { height: 280px; } .tool .ew-btns { max-width: 420px; margin: 0 auto; width: 100%; } }
@media (prefers-reduced-motion: reduce) { .tool .ew-card, .tool .ew-dot2 { transition: none; animation: none; } }

/* Setup: 3-way segmented mode, folded options */
.tool .ew-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 22px; background: rgb(var(--ink) / .06); }
.tool .ew-seg button { min-height: 44px; border-radius: 18px; box-shadow: none; background: transparent; font-size: 15px; }
.tool .ew-seg button[aria-pressed="true"] { background: var(--surface); color: rgb(var(--ink)); box-shadow: 0 1px 4px rgb(var(--ink) / .14); }
.tool .ew-more-body { display: flex; flex-direction: column; gap: 14px; padding-top: 10px; }
.tool .ew-ownbox { display: flex; flex-direction: column; gap: 0; }
.tool .ew-handoff.is-apart .ew-alt { order: -1; }
.tool .ew-handoff:not(.is-apart) .ew-alt { background: var(--surface); color: rgb(var(--ink)); box-shadow: inset 0 0 0 1.5px rgb(var(--ew-p2) / .6); }
@media (prefers-color-scheme: dark) {
  .tool .ew-btns .ew-no, .tool .ew-after .btn-secondary, .tool .ew-start .btn-secondary { box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / .22); }
  .tool .ew-chip { box-shadow: inset 0 0 0 1px rgb(var(--ink) / .16); }
  .tool .ew-seg button[aria-pressed="true"] { background: rgb(var(--ink)); color: #12061F; }
}
/* Round 3: card glyph, initials on the hand-off, one title as the hero, full-width actions */
.tool .ew-glyph { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; font-size: 40px; font-weight: 950; color: rgb(var(--ink) / .8); background: var(--surface); box-shadow: 0 6px 18px rgb(var(--ink) / .1); margin: 4px 0 6px; }
.tool .ew-card { border: 1px solid rgb(var(--ink) / .06); }
.tool .ew-dot { display: grid; place-items: center; color: #fff; font-size: 20px; font-weight: 950; }
.tool .ew-tbox { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.tool .ew-tactions { display: flex; gap: 8px; flex-wrap: wrap; }
.tool .ew-tactions > * { flex: 1 1 140px; }
.tool .ew-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; width: 100%; text-align: center; }
.tool .ew-mini { min-height: 44px; padding: 0 14px; border-radius: 22px; font-size: 14px; font-weight: 800; color: rgb(var(--ink) / .8); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .18); }
.tool .ew-mini:active { transform: scale(.96); }
.tool .ew-mini:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 2px; }
.tool .ew-row .ew-big { font-size: 30px; line-height: 36px; }
.tool .ew-undo { color: rgb(var(--ink) / .85); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .2); }
.tool .ew-vnote { color: rgb(var(--ink) / .72); }
.tool .ew-after { flex-wrap: wrap; }
@media (prefers-color-scheme: dark) { .tool { --ew-eat: #5A3A1A; --ew-watch: #24305E; } .tool .ew-glyph { background: rgb(255 255 255 / .08); } }
/* Round 4: line glyphs, one left edge on the result, a pinned action bar on phones */
.tool .ew-glyph { font-size: 0; color: rgb(var(--ink) / .75); }
.tool .ew-result .ew-rows, .tool .ew-result .ew-vnote, .tool .ew-result > .ew-tag { margin-left: 0; margin-right: 0; max-width: none; }
.tool .ew-row, .tool .ew-tbox { align-items: stretch; text-align: left; }
.tool .ew-tactions .btn-secondary, .tool .ew-mini { box-shadow: inset 0 0 0 1px rgb(var(--ink) / .18); background: transparent; }
.tool .ew-cta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 599px) {
  .tool .ew-after { position: sticky; bottom: 10px; z-index: 4; padding: 8px; margin: 0 -8px; border-radius: 26px; background: rgb(var(--ink) / .04); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .tool .ew-after > :first-child { grid-column: span 2; }
  .tool .ew-after .btn { width: 100%; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
  .tool .ew-after .btn svg { width: 18px; height: 18px; }
}
@media (max-width: 599px) { .tool .ew-after .btn svg { display: none; } }
.tool .ew-tactions > a.btn, .tool .ew-tactions > button { margin: 0; }
/* Round 7: one primary action on the result, quiet order links, a quiet New round, room under the pinned bar,
   a raised result card in dark mode, match chips that pop in, removable quick-spin chips. */
.tool .ew-order { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tool .ew-order > * { flex: none; min-width: 0; padding: 0 8px; font-size: 14px; }
.tool .ew-tbox .ew-cta.btn-secondary { background: transparent; box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / .18); color: rgb(var(--ink)); }
.tool .ew-againrow { display: flex; justify-content: center; }
.tool .ew-againrow[hidden] { display: none; }
.tool .ew-newround { min-height: 44px; padding: 0 12px; font-size: 15px; font-weight: 800; color: rgb(var(--ink) / .7); text-decoration: underline; text-underline-offset: 3px; background: transparent; }
.tool .ew-after { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool .ew-after .btn { width: 100%; }
@media (max-width: 599px) {
  .tool .ew-after { grid-template-columns: 1.4fr 1fr; background: var(--bg, var(--surface)); box-shadow: 0 -1px 0 rgb(var(--ink) / .1), 0 8px 24px rgb(var(--ink) / .12); }
  .tool .ew-after > :first-child { grid-column: auto; }
  .tool .ew-tonight { padding-bottom: 8px; }
  .tool .ew-vnote { margin-bottom: 4px; }
}
.tool .ew-chip { animation: ew-chip-in .24s cubic-bezier(.2, 0, 0, 1) both; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes ew-chip-in { from { opacity: 0; transform: scale(.85); } }
.tool .ew-chip.is-match { box-shadow: inset 0 0 0 2px rgb(var(--accent)); }
.tool .ew-qchip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px 0 14px; }
.tool .ew-qchip svg { width: 14px; height: 14px; opacity: .6; }
.tool .ew-qchip:disabled svg { display: none; }
.tool .ew-qchip:disabled { opacity: 1; }
@media (prefers-color-scheme: dark) {
  .tool .ew-result { background: rgb(255 255 255 / .07); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); }
  .tool .tool-setup .tool-chips:not(.ew-seg) button[aria-pressed="true"] { background: rgb(var(--accent) / .32); color: rgb(var(--ink)); box-shadow: inset 0 0 0 1.5px rgb(var(--accent) / .9); }
}
@media (prefers-reduced-motion: reduce) { .tool .ew-chip { animation: none; } }
.tool .ew-result { place-items: normal; justify-items: stretch; }
.tool .ew-result > .ew-tag { justify-self: start; }
@media (max-width: 599px) { .tool .ew-after { grid-template-columns: 1fr 1fr; } .tool .ew-after .btn { white-space: nowrap; padding: 0 10px; } }
