:root {
  --bg: #ffffff;
  --ink: #18181b;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: rgba(24, 24, 27, 0.08);
  --line-strong: rgba(24, 24, 27, 0.14);
  --hover: #f4f4f5;
  --surface: #ffffff;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --tile0a: #6d63f0; --tile0b: #4338ca;
  --tile1a: #f59e7b; --tile1b: #e0617a;
  --tile2a: #4fc3b0; --tile2b: #2a8fa8;
  --tile3a: #d4d4d8; --tile3b: #a1a1aa;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* the frame is as tall as the button and its open panel, so the page never jumps */
.switcher {
  position: relative;
  width: min(300px, calc(100vw - 32px));
  height: min(360px, calc(100vh - 32px));
  text-align: center;
}

.trigger {
  all: unset;
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
}
.trigger__press {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 12px 0 8px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.05), 0 6px 16px -8px rgba(24, 24, 27, 0.12);
  transition: background-color .2s, border-color .2s, box-shadow .2s;
  overflow: hidden;
}
.trigger:focus-visible .trigger__press { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.trigger[aria-expanded="true"] .trigger__press { background: var(--hover); border-color: var(--line-strong); }
@media (hover: hover) {
  .trigger:hover .trigger__press { background: #fafafa; border-color: rgba(24, 24, 27, 0.2); }
}

.tile {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  font-stretch: 105%;
  background: linear-gradient(140deg, var(--tile0a), var(--tile0b));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}
.tile--hue1 { background: linear-gradient(140deg, var(--tile1a), var(--tile1b)); }
.tile--hue2 { background: linear-gradient(140deg, var(--tile2a), var(--tile2b)); }
.tile--hue3 { background: linear-gradient(140deg, var(--tile3a), var(--tile3b)); color: var(--ink); }
.tile__letters { position: relative; display: block; }

.trigger__text {
  position: relative;
  display: block;
  height: 34px;
  overflow: hidden;
}
.trigger__line {
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 34px;
  white-space: nowrap;
}
.trigger__line + .trigger__line { position: absolute; left: 0; top: 0; }
.trigger__name { font-size: 14.5px; font-weight: 600; line-height: 1.15; letter-spacing: -0.005em; }
.trigger__plan { font-size: 12px; color: var(--muted); line-height: 1.3; }
.trigger__end { position: relative; width: 16px; height: 16px; flex: none; margin-left: 6px; }
.trigger__chev, .trigger__spin { position: absolute; inset: 0; width: 16px; height: 16px; }
.trigger__spin { opacity: 0; }
.spin__track { fill: none; stroke: rgba(24, 24, 27, 0.1); stroke-width: 1.6; }
.spin__arc { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.trigger__chev path { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.panel {
  position: absolute;
  left: 0;
  top: 60px;
  width: 100%;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.04), 0 12px 32px -12px rgba(24, 24, 27, 0.18), 0 32px 64px -32px rgba(24, 24, 27, 0.16);
  transform-origin: 50% 0;
  text-align: left;
  z-index: 2;
}
.panel[hidden] { display: none; }
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
}
.panel__label { font-size: 12px; font-weight: 600; color: var(--muted); }
.panel__mail { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel__list-wrap { position: relative; }
.panel__list { list-style: none; padding: 0; outline: none; }

.hl {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 50px;
  border-radius: 12px;
  background: var(--hover);
  box-shadow: inset 0 0 0 1px rgba(24, 24, 27, 0.04);
  opacity: 0;
  pointer-events: none;
}

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 10px 0 8px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.opt .tile { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
.opt__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.opt__name { font-size: 14px; font-weight: 560; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt__meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.badge {
  display: inline-block;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 16px;
  color: var(--muted);
  background: rgba(24, 24, 27, 0.05);
  box-shadow: inset 0 0 0 1px rgba(24, 24, 27, 0.06);
}
.badge--pro { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.14); }

.check { width: 16px; height: 16px; flex: none; }
.check path { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; }

.opt--create { margin-top: 7px; height: 44px; }
.opt--create::before {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: -4px;
  height: 1px;
  background: var(--line);
}
.opt--create .opt__name { font-weight: 520; color: var(--ink); }
.plus {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(24, 24, 27, 0.22);
  flex: none;
}
.plus svg { width: 14px; height: 14px; }
.plus path { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; }
.keys { display: flex; gap: 3px; flex: none; }
kbd {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 560;
  color: var(--muted);
  min-width: 18px;
  height: 19px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #fafafa;
  box-shadow: inset 0 0 0 1px rgba(24, 24, 27, 0.1), 0 1px 0 rgba(24, 24, 27, 0.08);
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 24px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(24, 24, 27, 0.22));
}
.ghost path { fill: var(--ink); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 340px) {
  .panel__mail { display: none; }
}
