/* Michigander Euchre v0.3 shared UI components (app shell + game). Styled only through theme variables
   (themes/lodge.css, night.css, retro.css), modelled on the Schedule I Team Hub component set:
   top bar, panels, pill buttons (primary / secondary / ghost / danger), badges, toasts, modal confirm,
   slide-in panel / bottom sheet. */
.ui-btn, .ui-row, .theme-opt, .ui-sheet, .ui-modal, .ui-toast, .ui-panel, .ui-badge { box-sizing: border-box; }
.ui-btn { font: inherit; font-family: var(--font-ui); font-weight: 700; font-size: 16px; line-height: 1.15; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; margin: 0; border-radius: var(--radius-pill); border: 1px solid var(--secondary-line); background: var(--secondary-bg); color: var(--secondary-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s ease, filter .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent; user-select: none; }
.ui-btn:hover { border-color: var(--accent); filter: brightness(1.06); }
.ui-btn:active { transform: translateY(2px) scale(.98); }
.ui-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ui-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.ui-btn.primary { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; box-shadow: var(--accent-shadow), 0 6px 18px rgba(0,0,0,.25); }
.ui-btn.primary:active { box-shadow: 0 1px 0 rgba(0,0,0,.4); transform: translateY(2px); }
.ui-btn.ghost { background: transparent; }
.ui-btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.ui-btn.dangerfill { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.ui-btn.big { font-size: 20px; min-height: 58px; padding: 14px 30px; }
.ui-btn.sm { font-size: 14px; min-height: 36px; padding: 6px 12px; }
.ui-btn.block { width: 100%; }
.ui-btn.icon { width: 44px; min-width: 44px; padding: 0; font-size: 20px; }
.ui-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.ui-badge { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-ui); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--plan); color: var(--plan-ink); vertical-align: middle; white-space: nowrap; }
.ui-badge.owner, .ui-badge.accent { background: var(--accent); color: var(--accent-ink); }
.ui-badge.admin, .ui-badge.warn { background: var(--warn); color: var(--warn-ink); }
.ui-badge.ok { background: var(--ok); color: var(--ok-ink); }
.ui-display { font-family: var(--font-display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-spacing); color: var(--display-color); }

/* toasts */
.ui-toasts { position: fixed; z-index: 100050; left: 50%; top: calc(var(--eu-bar-h, 56px) + 12px); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.ui-toast { pointer-events: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 11px 16px; box-shadow: var(--shadow);
  font-family: var(--font-ui); font-size: 15px; font-weight: 600; text-align: center; animation: ui-tin .32s cubic-bezier(.2, 1.3, .4, 1); }
.ui-toast.bad { border-color: var(--danger); }
.ui-toast.out { animation: ui-tout .28s ease forwards; }
@keyframes ui-tin { from { transform: translateY(-14px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ui-tout { to { transform: translateY(-10px); opacity: 0; } }

/* modal (in-app confirm / info) */
.ui-modal-back { position: fixed; inset: 0; z-index: 100040; background: var(--overlay); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: ui-fade .16s ease; }
.ui-modal { width: min(440px, 100%); max-height: 88vh; overflow: auto; padding: 20px 22px; text-align: left; font-family: var(--font-ui); animation: ui-pop .2s cubic-bezier(.2, 1.2, .4, 1); }
.ui-modal h3 { margin: 0 0 8px; font-family: var(--font-display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-spacing); color: var(--heading-color); font-size: 22px; }
.ui-modal .ui-mbody { color: var(--text-soft); font-size: 16px; line-height: 1.5; margin: 0 0 16px; }
.ui-modal .ui-mact { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.ui-modal-back.out { animation: ui-fadeout .16s ease forwards; }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-fadeout { to { opacity: 0; } }
@keyframes ui-pop { from { transform: translateY(10px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* slide-in panel (desktop: from the right) / bottom sheet (phones) */
.ui-sheet-back { position: fixed; inset: 0; z-index: 100030; background: var(--overlay); opacity: 0; transition: opacity .22s ease; }
.ui-sheet-back.open { opacity: 1; }
.ui-sheet { position: fixed; z-index: 100031; top: calc(var(--eu-bar-h, 56px) + 10px); right: 10px; bottom: 10px; width: min(380px, calc(100vw - 20px)); display: flex; flex-direction: column;
  font-family: var(--font-ui); transform: translateX(calc(100% + 24px)); transition: transform .28s cubic-bezier(.2, .9, .3, 1); text-align: left; }
.ui-sheet.open { transform: none; }
.ui-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.ui-sheet-head h3 { margin: 0; font-family: var(--font-display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-spacing); color: var(--heading-color); font-size: 21px; }
.ui-sheet-body { padding: 12px 16px 18px; overflow-y: auto; flex: 1; color: var(--text); }
.ui-sheet-body h4 { margin: 14px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ui-sheet-body h4:first-child { margin-top: 2px; }
@media (max-width: 700px) {
  .ui-sheet { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 82vh; border-radius: var(--radius) var(--radius) 0 0; transform: translateY(105%);
    padding-bottom: env(safe-area-inset-bottom); }
  .ui-sheet::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
}

/* list rows (tools, settings) */
.ui-list { display: flex; flex-direction: column; gap: 2px; }
.ui-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 10px; margin: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font: inherit; font-family: var(--font-ui); font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; transition: background-color .15s ease, transform .08s ease; }
.ui-row:hover { background: var(--secondary-bg); }
.ui-row:active { transform: scale(.99); }
.ui-row .ic { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 50%; background: var(--secondary-bg); border: 1px solid var(--line); font-size: 19px; }
.ui-row .lbl { flex: 1; }
.ui-row .chev { color: var(--muted); font-size: 18px; }
.ui-row.on .ic { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ui-toggle { position: relative; width: 46px; height: 28px; flex: 0 0 46px; border-radius: 14px; background: var(--line); transition: background-color .2s ease; }
.ui-toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s ease; }
.ui-row.on .ui-toggle, .ui-toggle.on { background: var(--ok); }
.ui-row.on .ui-toggle::after, .ui-toggle.on::after { transform: translateX(18px); }

/* theme picker */
.theme-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-opt { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 8px; margin: 0; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--secondary-bg);
  color: var(--text); font: inherit; font-family: var(--font-ui); text-align: left; cursor: pointer; transition: border-color .15s ease, transform .08s ease, box-shadow .15s ease; }
.theme-opt:hover { border-color: var(--secondary-line); }
.theme-opt:active { transform: scale(.98); }
.theme-opt.on { border-color: var(--accent); box-shadow: var(--focus-ring); }
.theme-swatch { position: relative; display: block; height: 64px; border-radius: 6px; padding: 7px; overflow: hidden; }
.sw-rail { display: block; height: 100%; border-radius: 22px; padding: 5px; }
.sw-felt { display: flex; height: 100%; border-radius: 18px; align-items: center; justify-content: center; gap: 4px; }
.sw-card { display: block; width: 12px; height: 17px; border-radius: 2px; background: #fbf6ea; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.sw-btn { position: absolute; right: 6px; bottom: 6px; width: 18px; height: 8px; border-radius: 4px; }
.theme-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.theme-blurb { font-size: 12px; color: var(--muted); line-height: 1.25; }
.theme-opt.on .theme-name::after { content: ' ✓'; color: var(--accent); }
@media (max-width: 420px) { .theme-swatch { height: 52px; } .theme-blurb { display: none; } }

/* motion: respect the OS setting, plus the in-app "Reduce motion" switch */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
